snudda.utils.load¶
- class snudda.utils.load.SnuddaLoad(network_file, snudda_data=None, load_synapses=True, verbose=False)[source]¶
Load data from network-neuron-positions.hdf5 or network-neuron-synapses.hdf5 into python dictionary
Constructor
- Parameters
network_file (str) – Data file to load
snudda_data (str, optional) – Snudda Data path, if you want to override the one specified in the hdf5 file
load_synapses (bool, optional) – Whether to read synapses into memory, or keep them on disk (this keeps file open)
verbose (bool, optional) – Print more info during execution
- static extract_neurons(hdf5_file)[source]¶
Helper function to extract neuron data from hdf5 file and put it in a dictionary.
- Parameters
hdf5_file – hdf5 file object
- Returns
List containing neurons as dictionary elements.
- find_gap_junctions(neuron_id, n_max=1000000, return_index=False)[source]¶
Find gap junctions associated with neuron_id
- Parameters
neuron_id (int) – Neuron with gap junction (can also be a list)
n_max (int) – Maximum number of gap junctions to return
return_index (bool) – Should third return value index be present
- Returns
Subset of gap junction matrix, gap junction coordinates
- find_synapses(pre_id=None, post_id=None, silent=True, return_index=False)[source]¶
Returns subset of synapses.
- Parameters
pre_id (int) – Pre-synaptic neuron ID
post_id (int) – Post-synaptic neuron ID
silent (bool) – Work quietly or verbosely
- Returns
Subset of synapse matrix.
- find_synapses_slow(pre_id, n_max=1000000)[source]¶
Returns subset of synapses.
- Parameters
pre_id (int) – Pre-synaptic neuron ID (can also be a list)
n_max (int) – Maximum number of synapses to return
- Returns
Subset of synapse matrix, synapse coordinates
- gap_junction_iterator(chunk_size=1000000)[source]¶
Iterates through all gap junctions in chunks (default 1e6 gap junctions).
- Parameters
chunk_size (int) – Number of gap junctions per chunk
- Returns
Iterator over the gap junctions
- get_centre_neurons_iterator(n_neurons=None, neuron_type=None, centre_point=None)[source]¶
Return neuron id:s, starting from the centre most and moving outwards
- Parameters
n_neurons (int) – Number of neurons to return, None = all available
neuron_type (str) – Type of neurons to return, None = all available
centre_point (np.array) – x,y,z of centre position, None = auto detect centre
- get_neuron_id_of_type(neuron_type, num_neurons=None, random_permute=False)[source]¶
Find all neuron ID of a specific neuron type.
- Parameters
neuron_type (string) – Neuron type (e.g. “FS”)
num_neurons (int) – Maximum number of neurons to return
random_permute (bool) – Shuffle the resulting neuron IDs?
- Returns
List of neuron ID of specified neuron type
- get_neuron_id_with_name(neuron_name)[source]¶
Find neuron ID of neurons with a given name.
- Parameters
neuron_name (str) – Name of neurons (e.g. “dSPN_0”)
- Returns
List of neuron ID
- get_population_unit_members(population_unit, num_neurons=None, random_permute=False)[source]¶
Returns neuron ID of neurons belonging to a specific population unit.
- Parameters
population_unit (int) – Population unit ID
num_neurons (int) – Number of neurons to return (None = all hits)
random_permute (bool) – Randomly shuffle neuron IDs?
- Returns
List of neuron ID belonging to population unit.
- load_hdf5(network_file, load_synapses=True, load_morph=False)[source]¶
Load data from hdf5 file.
- Args:
network_file (str) : Network file to load data from load_synapses (bool) : Load synapses into memory, or read on demand from file (keeps file open) load_morph
- Returns:
data (dictionary) : Dictionary with data.
Data format. The top level of the data hierarchy are “meta”, “morphologies”, “network”.
- “meta” hierarchy:
“SlurmID” (int) : Run ID of Slurm job “axonStumpIDFlag” (bool) : Should axon be replaced by a axon stump “config” : Config data “configFile” : Config file “connectivityDistributions” : Information about connections allowed, including pruning information “hyperVoxelIDs” : List of all hyper voxels IDs “hyperVoxelSize” (int, int, int): Number of hyper voxels along each dimension x, y, z “hyperVoxelWidth” (float, float, float) : Size of hypervoxel in meters (x,y,z) “nHyperVoxels” (int) : Number of hyper voxels “positionFile” : Neuron position file “simulationOrigo” (float, float, float) : Simulation origo (x, y, z) in SI-units (m) “voxelSize” (float) : Voxel size in meters
- “morphologies” heirarchy:
List of neuron names, contains the location of the morphologies (either SWC file or directory with multiple SWC files)
- “network” hierarchy:
“gapJunctions” : Gap junction data matrix (see below for format) “nGapJunctions” (int) : Number of gap junctions “nSynapses” (int) : Number of synapses “neurons” : Neuron data structure (see below for format) “synapses” : Synapse data matrix (see below for format)
Neuron data format:
Synapse data format (column within parenthesis):
0: sourceCellID, 1: destCellID, 2: voxelX, 3: voxelY, 4: voxelZ, 5: hyperVoxelID, 6: channelModelID, 7: sourceAxonSomaDist (not SI scaled 1e6, micrometers), 8: destDendSomaDist (not SI scalled 1e6, micrometers) 9: destSegID, 10: destSegX (int 0 - 1000, SONATA wants float 0.0-1.0) 11: conductance (int, not SI scaled 1e12, in pS) 12: parameterID
Note on parameterID:
If there are n parameter sets for the particular synapse type, then the ID to use is parameterID % n, this way we can reuse connectivity if we add more synapse parameter sets later.
Gap junction format (column in parenthesis):
0: sourceCellID, 1: destCellID, 2: sourceSegID, 3: destSegID, 4: sourceSegX, 5: destSegX, 6: voxelX, 7: voxelY, 8: voxelZ, 9: hyperVoxelID, 10: conductance (integer, in pS)
- load_neuron(neuron_id)[source]¶
Loads a specific neuron. Returns a NeuronMorphology object.
- Parameters
neuron_id (int) – Neuron ID
- Returns
NeuronMorphology object.