Neurodamus .io Sub-Modules

neurodamus.io.cell_readers

Collection of Cell Readers from different sources (Pure HDF5, SynTool…)

Functions

load_sonata(circuit_conf, all_gids[, ...])

A reader supporting additional dynamic properties from Sonata files.

split_round_robin(all_gids[, stride, ...])

Splits a numpy ndarray[uint32] round-robin.

Exceptions

CellReaderError

exception neurodamus.io.cell_readers.CellReaderError
neurodamus.io.cell_readers.dry_run_distribution(gid_metype_bundle, stride=1, stride_offset=0, total_cells=None)

Distribute gid in metype bundles for dry run.

The principle is the following: all gids with the same metype have to be assigned to the same rank. This function receives a list of list of gids, each sublist containing gids of the same metype. The gid_metype_bundle list of lists is generated by the retrieve_unique_metype function. This function performs a round robin distribution of the inner lists, i.e. it returns a list of gids that are sequentially in the same metype. The return is a flattened numpy array of gids that shall be instantiated on the same rank.

Example

gid_metype_bundle = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]

stride = 2 stride_offset = 0 return = [1, 2, 3, 7, 8, 9]

stride = 2 stride_offset = 1 return = [4, 5, 6, 10]

Parameters:
  • gid_metype_bundle – list of lists of gids to be distributed

  • mpi_size – MPI size

  • mpi_rank – MPI rank

  • total_cells – total number of cells in the circuit

Returns:

A numpy array of gids that are sequentially in the same metype

neurodamus.io.cell_readers.load_sonata(circuit_conf, all_gids, stride=1, stride_offset=0, *, node_population, load_dynamic_props=(), has_extra_data=False, dry_run_stats=None)

A reader supporting additional dynamic properties from Sonata files.

neurodamus.io.cell_readers.split_round_robin(all_gids, stride=1, stride_offset=0, total_cells=None)

Splits a numpy ndarray[uint32] round-robin. If the array is None generates new arrays based on the nr of total cells

neurodamus.io.synapse_reader

Module implementing interfaces to the several synapse readers (eg.: synapsetool, Hdf5Reader)

Classes

SynapseParameters(*_)

Synapse parameters, internally implemented as numpy record

SynapseReader(src[, population])

Synapse Readers base class.

SonataReader(src[, population])

Reader for SONATA edge files.

Exceptions

FormatNotSupported

Exception thrown when the circuit requires SynapseTool and it is NOT built-in.

exception neurodamus.io.synapse_reader.FormatNotSupported

Exception thrown when the circuit requires SynapseTool and it is NOT built-in.

class neurodamus.io.synapse_reader.SonataReader(src, population=None, *_, **kw)

Reader for SONATA edge files.

Uses libsonata directly and contains a bunch of workarounds to accomodate files created in the transition to SONATA. Also translates all GIDs from 0-based as on disk to the 1-based convention in Neurodamus.

Will read each attribute for multiple GIDs at once and cache read data in a columnar fashion.

FIXME Remove the caching at the np.recarray level.

LOOKUP_BY_TARGET_IDS = True
Parameters

alias of SynapseParameters

SYNAPSE_INDEX_NAMES = ('synapse_index',)
custom_parameters = {'ipt', 'isec', 'offset'}

Custom parameters are skipped from direct loading and trigger _load_params_custom()

get_counts(raw_ids, group_by=None)

Counts synapses and groups by the given field. If called with group_by = None returns an int. If called with any group_by it returns a dict.

get_property(gid, field_name)

Retrieves a full pre-loaded property given a gid and the property name.

has_nrrp()

This field is required in SONATA.

has_property(field_name)

Checks whether source data has the given additional field.

parameter_mapping = {'D': 'depression_time', 'DTC': 'decay_time', 'F': 'facilitation_time', 'U': 'u_syn', 'conductance_ratio': 'conductance_scale_factor', 'nrrp': 'n_rrp_vesicles', 'synType': 'syn_type_id', 'weight': 'conductance'}
preload_data(ids)

Preload SONATA fields for the specified IDs

class neurodamus.io.synapse_reader.SynapseParameters(*_)

Synapse parameters, internally implemented as numpy record

classmethod create_array(length)
dtype = {'formats': ['f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8', 'f8'], 'names': ('sgid', 'delay', 'isec', 'ipt', 'offset', 'weight', 'U', 'D', 'F', 'DTC', 'synType', 'nrrp', 'u_hill_coefficient', 'conductance_ratio', 'maskValue', 'location')}
empty = 0
load_fields = {'D', 'DTC', 'F', 'U', 'conductance_ratio', 'delay', 'ipt', 'isec', 'nrrp', 'offset', 'sgid', 'synType', 'u_hill_coefficient', 'weight'}
class neurodamus.io.synapse_reader.SynapseReader(src, population=None, *_, **kw)

Synapse Readers base class. Factory create() will instantiate a SONATA reader.

configure_override(mod_override)
classmethod create(syn_src, population=None, *args, **kw)

Instantiates a synapse reader, by default SonataReader. syn_src must point to a SONATA edge file.

get_synapse_parameters(gid)

Obtains the synapse parameters record for a given gid.

abstract has_nrrp()

Checks whether source data has the nrrp field.

abstract has_property(field_name)

Checks whether source data has the given additional field.

preload_data(ids)

Source

api/subpackages/io.rst