In [1]:
%matplotlib inline
import matplotlib.pyplot as g
from neuronunit.neuron.models import *
from neuronunit.tests import *
import neuronunit.neuroelectro
from quantities import nA, pA, s, ms, mV
from neuron import h
In [2]:
soma = h.Section()
soma.L = 100
soma.diam = 100
soma.cm = 1
soma.Ra = 180
soma.insert("pas")
soma.insert("hh")
Out[2]:
In [3]:
mod1 = SingleCellModel(hVar = h, \
section = soma, \
loc = 0.5, # Current and voltage injection and measurement location on the section \
name = "SimpleHHCellModel")
mod1.setIntegrationMethod("fixed") # Or "variable"
mod1.setTimeStep(1/128.0 * ms) # 2^-n are preferable
#mod1.setTolerance() # Only needed if "variable"
mod1.setStopTime(2*s)
In [4]:
# Define which cell's properties to get
# 'nlx_anat_100201' is from Olfactory bulb mitral cell,
# obtained from http://neuroelectro.org/neuron/129/ (Details)
neuron = {'nlex_id': 'nlx_anat_100201'}
# Define injection current
i = {'injected_square_current': {'amplitude':10*nA, 'delay':1000*ms, 'duration':2000*ms } }
# Define the tests to perform on the cell
testTypes = [ \
[InputResistanceTest, None],
[RestingPotentialTest, None],
[InjectedCurrentAPWidthTest, i], \
[InjectedCurrentAPThresholdTest, i], \
[InjectedCurrentAPAmplitudeTest, i],
]
tests = []
In [5]:
# No pooling example
testType = testTypes[0][0]
obs = testType.neuroelectro_summary_observation(neuron)
obs
Out[5]:
In [6]:
# Pooling example
testType = testTypes[0][0]
obs = testType.neuroelectro_pooled_observation(neuron, quiet=True)
obs
Out[6]:
In [7]:
# Fetch NeuroElectro property values for each test
for t in xrange(len(testTypes)):
testType = testTypes[t][0]
params = testTypes[t][1]
# Get the observations: property means and stds
obs = testType.neuroelectro_pooled_observation(neuron)
# Create a test instance using the observations
test = testType(obs)
if(params is not None):
test.params = params
tests.append(test)
# Create a test suite
suite = sciunit.TestSuite("Mitral Cell Membrane Property Tests", tests)
In [8]:
score = suite.judge(mod1)
score.view()
Out[8]: