neuronunit.models package

Submodules

neuronunit.models.bindings module

neuronunit.models.bindings.bind_NU_interface(model)[source]

neuronunit.models.channel module

NeuronUnit model class for ion channels models

class neuronunit.models.channel.ChannelModel(channel_file_path_or_url, channel_index=0, name=None, backend='jNeuroML')[source]

Bases: neuronunit.models.lems.LEMSModel, neuronunit.capabilities.channel.NML2ChannelAnalysis

A model for ion channels

ca_compute_iv_curve(results)[source]
ca_make_lems_file(**params)[source]

Makes a LEMS file using the provided run parameters using the ChannelAnalysis module.

ca_run_lems_file(verbose=True)[source]

Run the LEMS file using ChannelAnalysis module.

plot_iv_curve(v, i, *plt_args, **plt_kwargs)[source]

Plots IV Curve using array-like voltage ‘v’ and array-like current ‘i’

neuronunit.models.channel.snake_to_camel(string)[source]

neuronunit.models.lems module

Model classes for NeuronUnit.

class neuronunit.models.lems.LEMSModel(LEMS_file_path_or_url, name=None, backend=None, attrs=None)[source]

Bases: sciunit.models.runnable.RunnableModel

A generic LEMS model.

create_lems_file_copy(name=None, use=True)[source]

Create a temporary, writable copy of the original LEMS file.

Used so that e.g. edits can be made to it programatically before simulation.

extra_capability_checks = {<class 'neuronunit.capabilities.ReceivesSquareCurrent'>: 'has_pulse_generator'}
from_url = None
get_nml_paths(lems_tree=None, absolute=True, original=False)[source]

Get all NeuroML file paths associated with the model.

get_parsed_trees()[source]

Get a dictionary of parsed XML trees for each model file.

has_pulse_generator(tree=None)[source]

Return True if this model instance contains a pulse generator.

It must be a NeuroML implementation of a pulse generator attached to an explicit input.

set_lems_attrs(path=None)[source]

Set attribite equivalents in the LEMS file and write it to disk.

set_lems_run_params(verbose=False)[source]

Set run_param equivalents in the LEMS file and write it to disk.

temp_dir
url_to_path(possible_url, base=None)[source]

Check for a URL and download the contents.

If it is not a URL, just consider it a local path to the contents.

neuronunit.models.morphology module

NeuronUnit model class for NEURON HOC defined cell models

class neuronunit.models.morphology.SwcCellModel(swc_path, name=None)[source]

Bases: sciunit.models.base.Model, neuronunit.capabilities.morphology.ProducesSWC

A model for cells defined using SWC files. Requires a path to the SWC file.

produce_swc()[source]

Produces morphology description file in SWC file format

Returns:absolute path to the produced SWC file

neuronunit.models.reduced module

NeuronUnit model class for reduced neuron models.

class neuronunit.models.reduced.ReducedModel(LEMS_file_path, name=None, backend=None, attrs=None)[source]

Bases: neuronunit.models.lems.LEMSModel, neuronunit.capabilities.ReceivesSquareCurrent, neuronunit.capabilities.ProducesActionPotentials

Base class for reduced models, using LEMS

get_APs(**run_params)[source]

Get action potential waveform chunks from the model.

Must return a neo.core.AnalogSignal. Each column of the AnalogSignal should be a spike waveform.

get_membrane_potential(**run_params)[source]

Must return a neo.core.AnalogSignal.

get_spike_train(**run_params)[source]

Get computed spike times from the model.

Arguments: None. Returns: a neo.core.SpikeTrain object.

inject_square_current(current)[source]

Injects somatic current into the model.

current : a dictionary like:
{‘amplitude’:-10.0*pq.pA,
‘delay’:100*pq.ms, ‘duration’:500*pq.ms}}

where ‘pq’ is the quantities package

This describes the current to be injected.

class neuronunit.models.reduced.VeryReducedModel(name=None, backend=None, attrs=None)[source]

Bases: neuronunit.models.static.ExternalModel, neuronunit.capabilities.ReceivesCurrent, neuronunit.capabilities.ProducesActionPotentials

Base class for reduced models, using LEMS

get_APs(**run_params)[source]

Get action potential waveform chunks from the model.

Must return a neo.core.AnalogSignal. Each column of the AnalogSignal should be a spike waveform.

get_backend()[source]
get_membrane_potential(**run_params)[source]

Must return a neo.core.AnalogSignal.

get_spike_train(**run_params)[source]

Get computed spike times from the model.

Arguments: None. Returns: a neo.core.SpikeTrain object.

inject_square_current(current)[source]

Injects somatic current into the model.

current : a dictionary like:
{‘amplitude’:-10.0*pq.pA,
‘delay’:100*pq.ms, ‘duration’:500*pq.ms}}

where ‘pq’ is the quantities package

This describes the current to be injected.

run(rerun=None, **run_params)[source]

Run, i.e. simulate the model.

set_attrs(attrs)[source]
set_backend(backend)[source]
set_run_params(**params)[source]

Set parameters for the next run.

Note these are parameters of the simulation itself, not the model.

neuronunit.models.section_extension module

These classes are for compatibility w/ the old neuronunit.neuron module.

class neuronunit.models.section_extension.HasSegment[source]

Bases: sciunit.capabilities.Capability

Model has a membrane segment of NEURON simulator.

getSegment()[source]

Return the segment at the active section location.

setSegment(section, location=0.5)[source]

Set the target NEURON segment object.

section: NEURON Section object location: 0.0-1.0 value that refers to the location along the section length. Defaults to 0.5

class neuronunit.models.section_extension.SingleCellModel(neuronVar, section, loc=0.5, name=None)[source]

Bases: sciunit.models.base.Model

neuronunit.models.static module

class neuronunit.models.static.ExternalModel[source]

Bases: sciunit.models.base.Model, neuronunit.capabilities.ProducesMembranePotential, sciunit.capabilities.Runnable

A model which produces a frozen membrane potential waveform.

get_membrane_potential()[source]

Must return a neo.core.AnalogSignal.

set_membrane_potential(vm)[source]
set_model_attrs(attrs)[source]
class neuronunit.models.static.StaticModel(vm)[source]

Bases: sciunit.models.base.Model, neuronunit.capabilities.ReceivesSquareCurrent, neuronunit.capabilities.ProducesActionPotentials, neuronunit.capabilities.ProducesMembranePotential

A model which produces a frozen membrane potential waveform.

get_APs(**run_params)[source]

Return the APs, if any, contained in the static waveform.

get_membrane_potential(**kwargs)[source]

Return the Vm passed into the class constructor.

inject_square_current(current)[source]

Static model always returns the same waveform. This method is for compatibility only.

neuronunit.models.very_reduced module

NeuronUnit model class for reduced neuron models.

class neuronunit.models.very_reduced.VeryReducedModel(name=None, backend=None, attrs=None)[source]

Bases: neuronunit.models.static.ExternalModel, neuronunit.capabilities.ReceivesCurrent, neuronunit.capabilities.ProducesActionPotentials

Base class for reduced models, not using LEMS, and not requiring file paths this is to wrap pyNN models, Brian models, and other self contained models+model descriptions

get_APs(**run_params)[source]

Get action potential waveform chunks from the model.

Must return a neo.core.AnalogSignal. Each column of the AnalogSignal should be a spike waveform.

get_membrane_potential(**run_params)[source]

Must return a neo.core.AnalogSignal.

get_spike_train(**run_params)[source]

Get computed spike times from the model.

Arguments: None. Returns: a neo.core.SpikeTrain object.

inject_square_current(current)[source]

Injects somatic current into the model.

current : a dictionary like:
{‘amplitude’:-10.0*pq.pA,
‘delay’:100*pq.ms, ‘duration’:500*pq.ms}}

where ‘pq’ is the quantities package

This describes the current to be injected.

Module contents

Model classes for NeuronUnit