neuronunit.models.backends package¶
Submodules¶
neuronunit.models.backends.base module¶
Simulator backends for NeuronUnit models
neuronunit.models.backends.brian_multi_comp_ca2_HH module¶
neuronunit.models.backends.fhn module¶
-
class
neuronunit.models.backends.fhn.
FNNeuron
(I_ampl=0.85, V_0=-0.7, W_0=-0.5, a=0.7, b=0.8, tau=12.5, neurondict={})[source]¶ Bases:
neuronunit.models.backends.fhn.Neuron
FitzHugh-Naguno neuron. The units in this model are different from the HH ones. Sources: https://en.wikipedia.org/w/index.php?title=FitzHugh%E2%80%93Nagumo_model&oldid=828788626 http://www.scholarpedia.org/article/FitzHugh-Nagumo_model
-
solve
(ts=None)[source]¶ Integrate the differential equations of the system. The integration is made using an Euler algorithm and the method I_ext() is used to modelize the external current. Parameters ———-
- ts : array
- Times were the solution value is stored.
- Vs : array
- Membrane potential at the given times.
-
-
class
neuronunit.models.backends.fhn.
LinearIFNeuron
(I_ampl=10, V_0=-80, R=0.8, V_thr=-68.5, V_fire=20, V_relax=-80, relaxtime=5, firetime=2, neurondict={})[source]¶ Bases:
neuronunit.models.backends.fhn.Neuron
Linear integrate-and-fire neuron. Sources:
-
solve
(ts=None, timestep=0.1)[source]¶ Integrate the differential equations of the system.
The integration is made using an Euler algorithm and the method I_ext() is used to modelize the external current. Parameters ———-
- ts : array
- Times were the solution value is stored.
- Vs : array
- Membrane potential at the given times.
-
neuronunit.models.backends.general_pyNN module¶
neuronunit.models.backends.geppetto module¶
jNeuroML Backend.
neuronunit.models.backends.glif module¶
-
class
neuronunit.models.backends.glif.
GLIFBackend
[source]¶ Bases:
sciunit.models.backends.Backend
-
get_membrane_potential
()[source]¶ Must return a neo.core.AnalogSignal. And must destroy the hoc vectors that comprise it.
-
neuronunit.models.backends.hhrawf module¶
-
class
neuronunit.models.backends.hhrawf.
HHBackend
[source]¶ Bases:
sciunit.models.backends.Backend
-
get_membrane_potential
()[source]¶ Must return a neo.core.AnalogSignal. And must destroy the hoc vectors that comprise it.
-
init_backend
(attrs=None, cell_name='alice', current_src_name='hannah', DTC=None)[source]¶ Initialize the backend.
-
inject_square_current
(current)[source]¶ Inputs: current : a dictionary with exactly three items, whose keys are: ‘amplitude’, ‘delay’, ‘duration’ Example: current = {‘amplitude’:float*pq.pA, ‘delay’:float*pq.ms, ‘duration’:float*pq.ms}} where ‘pq’ is a physical unit representation, implemented by casting float values to the quanitities ‘type’. Description: A parameterized means of applying current injection into defined Currently only single section neuronal models are supported, the neurite section is understood to be simply the soma.
-
-
neuronunit.models.backends.hhrawf.
alpha_h
[source]¶ Channel gating kinetics. Functions of membrane voltage
-
neuronunit.models.backends.hhrawf.
alpha_m
[source]¶ Channel gating kinetics. Functions of membrane voltage
-
neuronunit.models.backends.hhrawf.
alpha_n
[source]¶ Channel gating kinetics. Functions of membrane voltage
-
neuronunit.models.backends.hhrawf.
beta_h
[source]¶ Channel gating kinetics. Functions of membrane voltage
-
neuronunit.models.backends.hhrawf.
beta_m
[source]¶ Channel gating kinetics. Functions of membrane voltage
-
neuronunit.models.backends.hhrawf.
beta_n
[source]¶ Channel gating kinetics. Functions of membrane voltage
neuronunit.models.backends.jNeuroML module¶
jNeuroML Backend.
neuronunit.models.backends.neuron module¶
-
class
neuronunit.models.backends.neuron.
NEURONBackend
[source]¶ Bases:
sciunit.models.backends.Backend
Use for simulation with NEURON, a popular simulator.
http://www.neuron.yale.edu/neuron/ Units used by NEURON are sometimes different to quantities/neo (note nA versus pA) http://neurosimlab.org/ramcd/pyhelp/modelspec/programmatic/mechanisms/mech.html#IClamp NEURON’s units: del – ms dur – ms amp – nA i – nA
-
cell_name
¶ Get the name of the cell.
-
current_src_name
¶ Get the name of the current source.
-
get_membrane_potential
()[source]¶ Get a membrane potential traces from the simulation.
Must destroy the hoc vectors that comprise it.
- Returns:
- neo.core.AnalogSignal: the membrane potential trace
-
get_variable_step_analog_signal
()[source]¶ Convert variable dt array values to fixed dt array.
Uses linear interpolation.
-
init_backend
(attrs=None, cell_name=None, current_src_name=None, DTC=None)[source]¶ Initialize the NEURON backend for neuronunit.
Arguments should be consistent with an underlying model files.
- Args:
- attrs (dict): a dictionary of items used to update NEURON
- model attributes.
- cell_name (string): A string that represents the cell models name
- in the NEURON HOC space.
- current_src_name (string): A string that represents the current
- source models name in the NEURON HOC space.
- DTC (DataTransportContainer): The data transport container contain
- a dictionary of model attributes When the DTC object is provided, it’s attribute dictionary can be used to update the NEURONBackends model attribute dictionary.
-
inject_square_current
(current, section=None, debug=False)[source]¶ Apply current injection into the soma or a specific compartment.
- Example: current = {‘amplitude’:float*pq.pA, ‘delay’:float*pq.ms,
- ‘duration’:float*pq.ms}}
where ‘pq’ is a physical unit representation, implemented by casting float values to the quanitities ‘type’. Currently only single section neuronal models are supported, the neurite section is understood to be simply the soma.
- Args:
- current (dict): a dictionary with exactly three items,
- whose keys are: ‘amplitude’, ‘delay’, ‘duration’
Implementation: 1. purge the HOC space, by calling reset_neuron() 2. Redefine the neuronal model in the HOC namespace, which was recently
cleared out.- Strip away quantities representation of physical units.
- Translate the dictionary of current injection parameters into executable HOC code.
-
load_model
(verbose=True)[source]¶ Load a NEURON model.
Side Effects: Substantially mutates neuronal model stored in self. Description: Take a declarative model description, and call JneuroML to convert it into an python/neuron implementation stored in a pyho file. Then import the pyhoc file thus dragging the neuron variables into memory/python name space. Since this only happens once outside of the optimization loop its a tolerable performance hit.
Create a pyhoc file using jneuroml to convert from NeuroML to pyhoc. import the contents of the file into the current names space.
-
reset_neuron
(neuronVar)[source]¶ Reset the neuron simulation.
Refreshes the the HOC module, purging it’s variable namespace. Sets the NEURON h variable, and resets the NEURON h variable. The NEURON h variable, may benefit from being reset between simulation runs as a way of insuring that each simulation is freshly initialized. the reset_neuron method is used to prevent a situation where a new model’s initial conditions are erroneously updated from a stale model’s final state.
- Args:
- neuronVar (module): a reference to the neuron module
-
set_integration_method
(method='fixed')[source]¶ Set the simulation itegration method.
cvode is used when method is “variable”
- Args:
- method (string): either “fixed” or “variable”. Defaults to fixed.
-
set_stop_time
(stop_time=array(650.) * ms)[source]¶ Set the simulation duration stopTimeMs: duration in milliseconds
-
set_time_step
(integrationTimeStep=array(0.0078125) * ms)[source]¶ Set the simulation itegration fixed time step integrationTimeStepMs: time step in milliseconds. Powers of two preferred. Defaults to 1/128.0
- Args:
- integrationTimeStep (float): time step in milliseconds.
- Powers of two preferred. Defaults to 1/128.0
-
neuronunit.models.backends.parse_glif module¶
neuronunit.models.backends.rawpy module¶
-
class
neuronunit.models.backends.rawpy.
RAWBackend
[source]¶ Bases:
sciunit.models.backends.Backend
-
get_membrane_potential
()[source]¶ Must return a neo.core.AnalogSignal. And must destroy the hoc vectors that comprise it.
-
init_backend
(attrs=None, cell_name='alice', current_src_name='hannah', DTC=None)[source]¶ Initialize the backend.
-
inject_square_current
(current)[source]¶ Inputs: current : a dictionary with exactly three items, whose keys are: ‘amplitude’, ‘delay’, ‘duration’ Example: current = {‘amplitude’:float*pq.pA, ‘delay’:float*pq.ms, ‘duration’:float*pq.ms}} where ‘pq’ is a physical unit representation, implemented by casting float values to the quanitities ‘type’. Description: A parameterized means of applying current injection into defined Currently only single section neuronal models are supported, the neurite section is understood to be simply the soma.
-
Module contents¶
Neuronunit-specific model backends.