The io module

dense.io.generate_hash_id(*args)

Return the hash ID of an experiment.

dense.io.load_swc(swc_path[, info])

Import SWC files as a Neuron or a Population.

dense.io.save_json_info([filepath, gid])

Save the simulation data to "info.json" file into the folder 'filepath'.

dense.io.save_to_neuroml(filename[, gid, ...])

Save the morphology of each neuron to a single NeuroML file.

dense.io.save_to_swc(filename[, gid, ...])

Save neurons to SWC file.

IO functions

dense.io.generate_hash_id(*args)[source]

Return the hash ID of an experiment.

dense.io.load_swc(swc_path, info=None)[source]

Import SWC files as a Neuron or a Population. SWC data will be automatically loaded from the file given by swc_path or from all SWC file inside swc_path if it is a folder.

Parameters
  • swc_path (str) – Path to a file or folder containing SWC information to load.

  • info (str, optional (default: None)) – Optional JSON file containing additional information about the neurons.

Returns

  • a Neuron if a single neuron is concerned or

  • a Population object if several neurons are involved.

See also

save_to_swc()

dense.io.save_json_info(filepath='default', gid=None)[source]

Save the simulation data to “info.json” file into the folder ‘filepath’. filepath is usually the simulation_ID.

dense.io.save_to_neuroml(filename, gid=None, resolution=10)[source]

Save the morphology of each neuron to a single NeuroML file.

NeuroML is an XML (eXtensible Markup Language) based model description language that aims to provide a common data format for defining and exchanging models in computational neuroscience. It is focused on biophysical and anatomical detailed models.

Parameters
  • filename (str) – Name of the file. If not present, the .nml suffix will be automatically added.

  • gid (int or list, optional (default: all neurons)) – Ids of the neurons to save.

  • resolution (int, optional (default: 10)) – Subsampling coefficient for points on a neurite (sample on point every resolution).

See also

save_to_swc()

dense.io.save_to_swc(filename, gid=None, resolution=10, split=True)[source]

Save neurons to SWC file.

SWC files are a common format used to store neuron morphologies, and are especially used to share digitally reconstructed neurons using NeuroMorpho.org. The format was designed to store trees as connected cylindrical segments to form the basis of compartmental models.

Parameters
  • filename (str) – Name of the SWC file to write. If split is True, it will be combined with the neurons’ gids to form each final filename.

  • gid (int or list of ints) – Neurons to save.

  • resolution (int, optional (default: 10)) – Coarse-graining factor of the structure: only one point every resolution will be kept.

  • split (bool, optional (default: True)) – Whether the neurons should be stored into a single SWC file or each into its own SWC file (ignored if gid contains only one neuron). If split is True, the gid of the neurons will automatically be appended to filename to make each independent SWC file.