Saving simulation results

The processes ocurring during a DeNSE simulation can be monitored, to understand what happened during the simulation, and be stored on disk to be reused afterwards.

There are mainly two kinds of data you can save, those generated during the simulation, which we call “runtime data” or those representing the final state at the end of the simulation, or “static data”.

Recording information

DeNSE enables to record “runtime data”, i.e. dynamical information about the growth process of neurons or their subprocesses, that occured during the simulation, via create_recorders().

Recorders will save information about neurons, neurites, or growth cones in memory so that it can be plotted after the simulation using plot_recording().

Each unit has different kind of “observables” that can be recorded via a recorder. To find out what observables are available, you can use:

neuron.observables                                                    # for a neuron
neuron.axon.observables                                               # for the axon
neuron.dendrites["dendrite_1"].observables                            # for a dendrite
ds.get_object_properties(neuron, "observables", level="growth_cone")  # for a growth cone

To be able to plot the recorded information, use the plot_recording().

Saving neuronal morphologies

After a call to simulate(), the state of the neuron (its morphology) is a static data that can be stored to file to be processed later.

To save simulation information to files, you can use the following functions:

The first two aim at saving morphological information about the neurons to disk. dense.io.save_to_swc() uses the SWC format as detailed on this reference page. SWC is one of the most widely used neuron morphology formats (it is used, in particular, by the neuromorpho archive). DeNSE can also store neuron morphologies in the NeuroML format, an alternative data format to define and exchange models in computational neuroscience, focused on biophysical and anatomical models.

Finally dense.io.save_json_info() is used to save an info.json file meant to store the simulation configuration.

Working with saved data

After the data has been saved to disk, you can either load it in other libraries reading SWC or NeuroML formats, or reload it in DeNSE.

Note

Apart from DeNSE, most other libraries require the neurons to be split into separate SWC files, so make sure not to set split to True if you want external compatibility.

You can reload the neurons in DeNSE, then plot them directly via:

neurons = ds.io.load_swc("file.swc")
ds.plot.plot_neurons(neurons, show=True)