Simulation¶
Functions for performing SPICE-based electrical simulation of a neuron given its synapses and skeleton using a simple linear passive model.
Try the interactive simulation tutorial for a tour of basic simulation options.
Note
The simulation
module depends on additional packages.
Install them from conda-forge
:
conda install -c conda-forge ngspice umap-learn scikit-learn matplotlib
NeuronModel¶
|
Neuron model constructor. |
|
Simulate passive model based on neuron inputs and outputs. |
Simulate delay between random parts of a neuron. |
TimingResult¶
|
Timing result constructor. |
Generate delay and amplitude matrix based on primary brain regions. |
|
Show neuron response to brain regions based on inputs from a given region. |
|
|
Show how the different simulation points cluster in the neuron and their corresponding ROI. |
|
Estimate the domains based on timing estimates. |
- class neuprint.simulation.NeuronModel(bodyid, Ra=1.2, Rm=0.8, Cm=0.01, *, client=None)[source]¶
Neuron model constructor.
Create model of a neuron which can be simulated. in different ways.
- Parameters
bodyid (int) – Segment id for neuron.
Ra (float) – axon resistance Examples: 0.4 (
Ra_LOW
), 1.2 (Ra_MED
), 4.0 (Ra_HIGH
)Rm (float) – membrane resistance Examples: 0.2 (
Rm_LOW
), 0.8 (Rm_MED
), 3.11 (Rm_HIGH
)Cm (float) – membrane capacitance (should not very too much between neurons)
- estimate_intra_neuron_delay(num_points=100)[source]¶
Simulate delay between random parts of a neuron.
This function produces a delay matrix for a set of points determined by pre or post-synaptic sites. The result is a square distance matrix which can be clustered to determine isopotential regions. The points where current are injected do not represent real neural mechanisms and in practice random points could be chosen for simulation. Synapse location are chosen for convenience and to ensure proper weighting on ‘important’ parts of the neuron.
- Parameters
num_points (int) – number of points to simulate.
- Returns
TimingResult (contains input/output delay matrix)
- class neuprint.simulation.TimingResult(bodyid, delay_matrix, amplitude_matrix, neuron_io, neuron_conn_info, symmetric=False)[source]¶
Timing result constructor.
Provides methods for parsing timing results.
- Parameters
bodyid (int) – Segment id for neuron
delay_matrix (dataframe) – nxm matric of source to sink (if source set == sink set, the data can be used to cluster the provided io into different domains.
neuron_io (dataframe) – synapse information: location, ispre, brain region
- compute_region_delay_matrix()[source]¶
Generate delay and amplitude matrix based on primary brain regions.
Averages the delay and amplitude between the sources and sinks of the timing results.
- Returns
(dataframe, dataframe) for the delay and amplitude from brain region to brain region.
- estimate_neuron_domains(num_components, plot=False)[source]¶
Estimate the domains based on timing estimates.
Note: only works for symmetric sink and source simulation.
- Parameters
num_components (int) – number of cluster domains
plot (bool) – If True, create and return a plot that shows cluster results with predicted labels (can compare with roi labels from plot_neuron_domains). If
plot
is a string, it is interpreted as a filepath, to which the plot is also written to disk as a PNG.
- Returns
(dataframe, dataframe, plot) input and output connection summary split by domain, synapse-level neuron_io indicating component partition. If a
plot
was requested, then the generated plot is returned as the third tuple element, otherwise that element isNone
.