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, random_seed=None, griddata_interpolation=False, morphologies_stay_inside=True)[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
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, reaction_diffusion=None, name='Unnamed', hoc=None, volume_id=None, virtual_neuron=False, axon_density=None, parameter_key=None, morphology_key=None, modulation_key=None, config=None, rng=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
reaction_diffusion (str) – Path to RxD reaction diffusion 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)
config (dict) – dict representation of network-config.json
- cluster_neurons(n_trials=5, rng=None)[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)
- init_population_units()[source]¶
Initialise population units. If none are given they are all set to 0.
- 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 “radial_density” “neuron_types” list of neuron types “centres” of radial probabilityes, one per neuron type “num_neurons” : Number of neurons in each population unit, only used with radial_density method “probability_functions” list of probability functions of r (as str) “unit_id” 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” “unit_id” = ID of population unit “fraction_of_neurons” = Fraction of neurons in this unit “neuron_types” = 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_log(text, flush=True, is_error=False, force_print=False)[source]¶
Writes to log file. Use setup_log first. Text is only written to screen if self.verbose=True, or is_error = True, or force_print = True.
test (str) : Text to write flush (bool) : Should all writes be flushed to disk directly? is_error (bool) : Is this an error, always written. force_print (bool) : Force printing, even if self.verbose=False.