Ejemplo n.º 1
0
"""

# PyDSTool imports
from PyDSTool import *
from PyDSTool.ParamEst import LMpest
import HH_model, IF_squarespike_model


# ----------------------------------------------------------------

par_args_HH = {'gna': 100, 'gk': 80, 'gl': 0.1,
            'vna': 50, 'vk': -100, 'vl': -67,
            'I': 1.35, 'C': 1.0}
# deliberately set I not quite 1.3, as used for IF neuron
ic_args_HH = {'v':-70.0, 'm': 0, 'h': 1, 'n': 0}
HH = HH_model.makeHHneuron('goalHH', par_args_HH, ic_args_HH)

HH.set(tdata=[0,15])

HH_traj = HH.compute('test')
HH_sampleData = {}
HH_sampleData['t'] = []
HH_sampleData['v'] = []
sample_dt = 0.06
count = 0
countlim = 5
print "Generating non-uniform samples from HH orbit..."
tsamples = arange(0, 14, sample_dt)
vsamples = HH_traj(tsamples, ['v']).toarray()
for i in range(len(tsamples)):
    t = tsamples[i]
Ejemplo n.º 2
0
import HH_model

# Other imports
from numpy.linalg import norm
from numpy.testing import assert_almost_equal
from time import clock

# ----------------------------------------------------------------

tdata = [0, 15]

par_args_HH_goal = {'gna': 100, 'gk': 80, 'gl': 0.1,
            'vna': 50, 'vk': -100, 'vl': -67,
            'Iapp': 1.3, 'C': 1.0}
ic_args_HH = {'v':-68, 'm': 0, 'h': 1, 'n': 0}
HH_goal = HH_model.makeHHneuron('goalHH', par_args_HH_goal, ic_args_HH,
            extra_terms='-0.04*(sin(9.1*t)*cos(2.6*t)+sin(5.1119*t+2))*(v-60)')

# extra terms simulate low frequency "noise"

HH_goal.set(tdata=tdata,
            algparams={'init_step':0.05})

goaltraj = HH_goal.compute('goalHHtraj')

# event external to the generator
HH_event_args = {'name': 'HH_zerothresh',
               'eventtol': 1e-4,
               'eventdelay': 1e-3,
               'starttime': 0,
               'active': True}
HH_thresh_ev = Events.makePythonStateZeroCrossEvent('v', 0, 1,
Ejemplo n.º 3
0
from time import clock

# print "This test runs much more efficiently using the Dopri integrator"
gentype = 'dopri'
genlang = 'c'

# ----------------------------------------------------------------

tdata = [0, 20]

par_args_HH_goal = {'gna': 100, 'gk': 80, 'gl': 0.1,
            'vna': 50, 'vk': -100, 'vl': -67,
            'Iapp': 1.3, 'C': 1.0}
ic_args_HH = {'v':-70, 'm': 0, 'h': 1, 'n': 0}
HH_goal = HH_model.makeHHneuron('goalHH', par_args_HH_goal, ic_args_HH,
             extra_terms='-0.03*(sin(9.1*t)*cos(2.6*t)+sin(5.1119*t+2))*(v-60)')
HH_goal.set(tdata=tdata, algparams={'init_step':0.1})
goaltraj = HH_goal.compute('goalHHtraj')

HH_event_args = args(name='HH_zerothresh',
               eventtol=1e-3,
               eventdelay=1e-3,
               starttime=0,
               active=True,
               precise=True)
HH_thresh_ev = Events.makePythonStateZeroCrossEvent('v', 0, 1,
                                   HH_event_args, goaltraj.variables['v'])


result = HH_thresh_ev.searchForEvents(tuple(tdata))
HH_spike_t = result[0][0]
Ejemplo n.º 4
0
from __future__ import print_function

# PyDSTool imports
from PyDSTool import *
from PyDSTool.Toolbox.ParamEst import BoundMin, L2_feature_1D
from PyDSTool.common import metric_float_1D
import HH_model, IF_squarespike_model

# ----------------------------------------------------------------

trange = [0, 15]

par_args_HH = {"gna": 100, "gk": 80, "gl": 0.1, "vna": 50, "vk": -100, "vl": -67, "Iapp": 1.35, "C": 1.0}
# deliberately set Iapp not quite 1.3, as used for IF neuron
ic_args_HH = {"v": -70.0, "m": 0, "h": 1, "n": 0}
HH = HH_model.makeHHneuron("goalHH", par_args_HH, ic_args_HH)

HH.set(tdata=trange)

HH_traj = HH.compute("test")
HH_sampleData = {}
HH_sampleData["t"] = []
HH_sampleData["v"] = []
sample_dt = 0.06
count = 0
countlim = 5
print("Generating non-uniform samples from HH orbit...")
tsamples = arange(0, 14, sample_dt)
vsamples = HH_traj(tsamples, ["v"]).toarray()
for i in range(len(tsamples)):
    t = tsamples[i]
import HH_model

from time import clock

# print "This test runs much more efficiently using the Dopri integrator"
gentype = "dopri"
genlang = "c"

# ----------------------------------------------------------------

tdata = [0, 20]

par_args_HH_goal = {"gna": 100, "gk": 80, "gl": 0.1, "vna": 50, "vk": -100, "vl": -67, "Iapp": 1.3, "C": 1.0}
ic_args_HH = {"v": -70, "m": 0, "h": 1, "n": 0}
HH_goal = HH_model.makeHHneuron(
    "goalHH", par_args_HH_goal, ic_args_HH, extra_terms="-0.03*(sin(9.1*t)*cos(2.6*t)+sin(5.1119*t+2))*(v-60)"
)
HH_goal.set(tdata=tdata, algparams={"init_step": 0.1})
goaltraj = HH_goal.compute("goalHHtraj")

HH_event_args = args(name="HH_zerothresh", eventtol=1e-3, eventdelay=1e-3, starttime=0, active=True, precise=True)
HH_thresh_ev = Events.makePythonStateZeroCrossEvent("v", 0, 1, HH_event_args, goaltraj.variables["v"])


result = HH_thresh_ev.searchForEvents(tuple(tdata))
HH_spike_t = result[0][0]
print("True HH spike time based on threshold event is at ", HH_spike_t)
print("but assume the traj is real data so that we have to find the spike")
print("directly from the noisy data")

## Set up external interface for the reference trajectory based on spike time
Ejemplo n.º 6
0
from time import clock

# ----------------------------------------------------------------

par_args_HH_goal = {
    'gna': 100,
    'gk': 80,
    'gl': 0.1,
    'vna': 50,
    'vk': -100,
    'vl': -67,
    'I': 1.3,
    'C': 1.0
}
ic_args_HH = {'v': -70, 'm': 0, 'h': 1, 'n': 0}
HH_goal = HH_model.makeHHneuron('goalHH', par_args_HH_goal, ic_args_HH)
##                        extra_terms='-0.04*(sin(9.1*t)*cos(2.6*t)+sin(5.1119*t+2))*(v-60)')
HH_goal.set(tdata=[0, 20])
goaltraj = HH_goal.compute('goalHHtraj')

HH_event_args = args(name='HH_zerothresh',
                     eventtol=1e-3,
                     eventdelay=1e-3,
                     starttime=0,
                     active=True,
                     precise=True)
HH_thresh_ev = Events.makePythonStateZeroCrossEvent('v', -30, 1, HH_event_args,
                                                    goaltraj.variables['v'])

result = HH_thresh_ev.searchForEvents((0, 20))
HH_spike_t = result[0][0]
"""

# PyDSTool imports
from PyDSTool import *
from PyDSTool.ParamEst import LMpest, BoundMin
import HH_model

from time import clock

# ----------------------------------------------------------------

par_args_HH_goal = {'gna': 100, 'gk': 80, 'gl': 0.1,
            'vna': 50, 'vk': -100, 'vl': -67,
            'I': 1.3, 'C': 1.0}
ic_args_HH = {'v':-70, 'm': 0, 'h': 1, 'n': 0}
HH_goal = HH_model.makeHHneuron('goalHH', par_args_HH_goal, ic_args_HH)
##                        extra_terms='-0.04*(sin(9.1*t)*cos(2.6*t)+sin(5.1119*t+2))*(v-60)')
HH_goal.set(tdata=[0,20])
goaltraj = HH_goal.compute('goalHHtraj')

HH_event_args = args(name='HH_zerothresh',
               eventtol=1e-3,
               eventdelay=1e-3,
               starttime=0,
               active=True,
               precise=True)
HH_thresh_ev = Events.makePythonStateZeroCrossEvent('v', -30, 1, 
                                   HH_event_args, goaltraj.variables['v'])


result = HH_thresh_ev.searchForEvents((0, 20))