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

V_ddt(V, W, I_ext)[source]

Time derivative of the potential V.

W_ddt(V, W)[source]

Time derivative of the recovery variable W.

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:

V_ddt(V, I_ext)[source]

Time derivative of the membrane potential.

fire_condition(V)[source]

Return True if the fire condition is satisfied.

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.
class neuronunit.models.backends.fhn.Neuron[source]

Bases: object

neuronunit.models.backends.general_pyNN module

neuronunit.models.backends.geppetto module

jNeuroML Backend.

class neuronunit.models.backends.geppetto.GeppettoBackend[source]

Bases: neuronunit.models.backends.jNeuroML.jNeuroMLBackend

Use for simulation with the Geppetto backend for SciDash.

backend = 'Geppetto'
init_backend(*args, **kwargs)[source]

Initialize the Geppetto backend.

neuronunit.models.backends.glif module

class neuronunit.models.backends.glif.GLIFBackend[source]

Bases: sciunit.models.backends.Backend

apply_stimulus(n)[source]
as_lems_model(backend=None)[source]
get_membrane_potential()[source]

Must return a neo.core.AnalogSignal. And must destroy the hoc vectors that comprise it.

get_spike_train()[source]
get_stimulus(n)[source]
get_sweep(n, specimen_id=None)[source]
get_sweeps(specimen_id=None)[source]
init_backend(attrs=None, cell_name='alice', current_src_name='hannah', DTC=None)[source]

Initialize the backend.

inject_square_current(current)[source]
set_attrs(**attrs)[source]

Set model attributes on the backend.

set_stop_time(stop_time=array(650.) * ms)[source]

Sets the simulation duration stopTimeMs: duration in milliseconds

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.

set_attrs(**attrs)[source]

Set model attributes on the backend.

set_stop_time(stop_time=array(650.) * ms)[source]

Sets the simulation duration stopTimeMs: duration in milliseconds

neuronunit.models.backends.hhrawf.Id(t, delay, duration, tmax, amplitude)[source]
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.hhrawf.dALLdt[source]

Integrate

:param X:
:param t:
:return: calculate membrane potential & activation variables
neuronunit.models.backends.hhrawf.get_vm(attrs)[source]

dt determined by Apply Hodgkin Huxley equation corresponding to point as model This function can’t get too pythonic (functional), it needs to be a simple loop for numba/jit to understand it.

neuronunit.models.backends.jNeuroML module

jNeuroML Backend.

class neuronunit.models.backends.jNeuroML.jNeuroMLBackend[source]

Bases: sciunit.models.backends.Backend

Use for simulation with jNeuroML, a reference simulator for NeuroML.

backend = 'jNeuroML'
init_backend(*args, **kwargs)[source]

Initialize the jNeuroML backend.

inject_square_current(current)[source]

Inject a square current into the cell.

set_attrs(**attrs)[source]

Set the model attributes, i.e. model parameters.

set_run_params(**run_params)[source]

Sey the backend runtime parameters, i.e. simulation parameters.

set_stop_time(t_stop)[source]

Set the stop time of the simulation.

set_time_step(dt)[source]

Set the time step of the simulation.

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.
  1. Strip away quantities representation of physical units.
  2. Translate the dictionary of current injection parameters into executable HOC code.
linearInterpolate(tStart, tEnd, vStart, vEnd, tTarget)[source]

Perform linear interpolation.

load(tstop=array(650.) * ms)[source]
load_mechanisms()[source]
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
reset_vm()[source]
set_attrs(**attrs)[source]

Set model attributes on the backend.

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_run_params(**run_params)[source]

Set model attributes on the backend.

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
set_tolerance(tolerance=0.001)[source]

Set the variable time step integration method absolute tolerance.

Args:
tolerance (float): absolute tolerance value

neuronunit.models.backends.parse_glif module

neuronunit.models.backends.parse_glif.generate_lems(glif_package, curr_pA=None, show_plot=False)[source]

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.

set_attrs(**attrs)[source]

Set model attributes on the backend.

set_stop_time(stop_time=array(650.) * ms)[source]

Sets the simulation duration stopTimeMs: duration in milliseconds

neuronunit.models.backends.rawpy.get_vm[source]

dt determined by Apply izhikevich equation as model This function can’t get too pythonic (functional), it needs to be a simple loop for numba/jit to understand it.

Module contents

Neuronunit-specific model backends.