snudda.place.place

class snudda.place.place.SnuddaPlace(config_file=None, network_path=None, snudda_data=None, verbose=False, log_file=None, rc=None, d_view=None, h5libver=None, raytrace_borders=False, random_seed=None, griddata_interpolation=False)[source]

Places neurons in 3D space. Use detect to add connections, and prune to remove redundant connections.

Constructor.

Parameters
  • config_file (str) – Path to config file, e.g. network-config.json in network_path

  • network_path (str) – Path to network directory

  • snudda_data (str) – Path to snudda data

  • verbose (bool) – Print extra information on screen

  • log_file (str) – Log file for place

  • rc – ipyparallel remote client

  • d_view – ipyparallel direct view object

  • h5libver – Version of h5py library

  • raytrace_borders (bool) – Should positions in border voxels be raytraces, slower but more accurate

  • random_seed (int) – Numpy random seed

  • griddata_interpolation (bool) – Should we interpolate density data (5x slower)

add_neurons(swc_path, num_neurons, param_filename=None, mech_filename=None, modulation=None, name='Unnamed', hoc=None, volume_id=None, virtual_neuron=False, axon_density=None, parameter_key=None, morphology_key=None, modulation_key=None)[source]

Add neurons to volume specified.

Parameters
  • swc_path (str) – Path to morphology directory (or single morphology)

  • num_neurons (int) – Number of neurons to add

  • param_filename (str) – Path to parameter file

  • mech_filename (str) – Path to mechanism file

  • modulation (str) – Path to neuromodulation file

  • name (str) – Name of neuron population, e.g. DSPN (which will become DSPN_0, DSPN_1, etc…)

  • hoc (str) – Path to hoc file (currently disabled)

  • volume_id (str) – ID of the volume to place neurons in

  • virtual_neuron (bool) – Real or virtual neuron, the latter can be used to model axons giving input to network

  • axon_density (str) – Axon density

  • parameter_key (str, optional) – Parameter Key to use, default=None (Randomise between all available)

  • morphology_key (str, optional) – Morphology Key to use, default=None (Randomise between all available)

  • modulation_key (str, optional) – Key for neuromodulation, default=None (Randomise between all available)

all_neuron_names()[source]

Returns all neuron names as a list.

all_neuron_positions()[source]

Returns all neuron positions as a n x 3 matrix.

all_neuron_rotations()[source]

Returns all neuron rotations as a n x 3 x 3 matrix.

cluster_neurons(n_trials=5)[source]

Cluster neurons, so that nearby neurons are grouped on same worker, to speed up simulations.

Parameters

n_trials (int) – Number of trials for k-means clustering (default 5)

define_population_units(population_unit_info)[source]

Defines population units.

Parameters

population_unit_info (dict) – Has keys “AllUnitID” with a list of all Unit IDs, and <VolumeID> which points to a dictionary. This dictionary has keys: “method” : “random” or “radialDensity” ” “unitID” : ID of population unit “fractionOfNeurons” : How large fraction of neurons belong to this unit (used by “random” method) “neuronTypes” : List of Neuron types that belong to this population unit “numNeurons” : Number of neurons in each population unit, only used with radialDensity method “structure” : Name of structure population unit is located in (VolumeID) “centres” : Centre of radial density “ProbabilityFunctions” : Probability function defining unit membership, function of radius

init_population_units()[source]

Initialise population units. If none are given they are all set to 0.

parse_config(config_file=None, resort_neurons=True)[source]

Parse network config_file

place()[source]

Place neurons in 3D space.

population_unit_density_labeling(population_unit_info, neuron_id)[source]

Creates population units based on radial density functions.

Parameters
  • neuron_id (list) – All potential neuron ID

  • population_unit_info (dict) – “method” must be “radialDensity” “neuronTypes” list of neuron types “centres” of radial probabilityes, one per neuron type “numNeurons” : Number of neurons in each population unit, only used with radialDensity method “probabilityFunctions” list of probability functions of r (as str) “unitID” ID of population unit

random_labeling(population_unit_info, neuron_id)[source]

Creates random labeling.

Parameters
  • neuron_id (list) – All potential neuron ID

  • population_unit_info (dict) – Dictionary with “method” = “random” “unitID” = ID of population unit “fractionOfNeurons” = Fraction of neurons in this unit “neuronTypes” = List of neuron types that are in this unit “structure” = Name of the structure the unit is located in

sort_neurons(sort_idx=None)[source]

Sorting neurons. If no argument is given they will be sorted along x,y,z axis.

To use cluster sorting, use:

sp.sort_neurons(sort_idx=sp.cluster_neurons())

Parameters

sort_idx (list, optional) – Sort order

write_data(file_name=None)[source]

Writes positition data to HDF5 file file_name.

write_log(text)[source]

Write text to log file.