예제 #1
0
def callback():
    print('callback')
    print(h.f())
    h.x = 4
    print(h.x)
    h.y[2] = 6
    print(h.y[2])
예제 #2
0
### Parameters ###
Nsyns = numpy.array([0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60])
Nsyns_PYR = 3
freqs = numpy.array([1, 5, 8, 10, 20])

### Setup holding currents ###

h.cvode_active(1)  # i.e. to make it run faster for this portion
h.cvode.atol(1e-05)
h.tstop = 5000

spikerate_prev = 0
if find7HzHolding:
    for stepcurr in range(40, 101, 1):
        h.ic_hold.amp = stepcurr * 0.001  # holding current
        h.f(0, 0, 0)
        apctimes = numpy.array(h.apctimes)
        apctimes = apctimes[apctimes > 1000]  # Only spike times > 1s
        spikerate = len(apctimes) / 4
        print('Spike Rate = ' + str(spikerate) + ' Hz at ' +
              str(stepcurr * 0.001) + ' nA')
        if (spikerate > 7) & (spikerate < 7.6):
            print('Holding Current = ' + str(stepcurr * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate) + ' Hz')
            break
        elif spikerate > 7.6:
            h.ic_hold.amp = (stepcurr - 1) * 0.001  # holding current
            print('Spike Rate Passed Acceptable Range')
            print('Holding Current = ' + str((stepcurr - 1) * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate_prev) + ' Hz')
            break
예제 #3
0
# use of HocTopLevelInterpreter should always be at the top level regardless
# of what Hoc object context calls into python
# for test, this is imported from hobjcontext.hoc

from neuron import h

h("x = 5")
h("strdef s")
h("objref o")
h.x = 4
h.s = "hello"
h.o = h.List()
print(h.x)
print(h.s)
print(h.o.hname())

h("double y[3]")
h("objref oo[2]")
h.y[1] = 25
h.oo[1] = h.Vector()
print(h.y[1])
print(h.oo[1].hname())

h("func f() { return x*x }")
print(h.f())

예제 #4
0
ILShift = numpy.zeros(len(starttimes))
INaShift = numpy.zeros(len(starttimes))
ICaLShift = numpy.zeros(len(starttimes))

### Setup holding currents ###

h.cvode_active(1)  # i.e. to make it run faster for this portion
h.cvode.atol(1e-05)
h.tstop = 5000

spikerate_prev = 0
if findHolding:
    for stepcurr in numpy.linspace(currhold * 1000, currhold * 1000 + 101,
                                   101):
        h.ic_hold.amp = stepcurr * 0.001  # holding current
        h.f(0, 0, h.tstop)
        apctimes = numpy.array(h.apctimes)
        apctimes = apctimes[apctimes > 1000]  # Only spike times > 1s
        spikerate = len(apctimes) / 4
        print('Spike Rate = ' + str(spikerate) + ' Hz at ' +
              str(stepcurr * 0.001) + ' nA')
        if (spikerate > TargetFreq - 0.2) & (spikerate < TargetFreq + 0.2):
            print('Holding Current = ' + str(stepcurr * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate) + ' Hz')
            break
        elif spikerate > TargetFreq + 0.2:
            h.ic_hold.amp = (stepcurr - 1) * 0.001  # holding current
            print('Spike Rate Passed Acceptable Range')
            print('Holding Current = ' + str((stepcurr - 1) * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate_prev) + ' Hz')
            break
예제 #5
0
### Parameters ###
Nsyns = numpy.array([0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60])
freqs = numpy.array([1, 5, 8, 10, 20])

### Setup holding currents ###

h.cvode_active(1)  # i.e. to make it run faster for this portion
h.cvode.atol(1e-05)
h.tstop = 5000

spikerate_prev = 0
if find7HzHolding:
    for stepcurr in range(40, 101, 1):
        h.ic_hold.amp = stepcurr * 0.001  # holding current
        h.f(0, 0)
        apctimes = numpy.array(h.apctimes)
        apctimes = apctimes[apctimes > 1000]  # Only spike times > 1s
        spikerate = len(apctimes) / 4
        print('Spike Rate = ' + str(spikerate) + ' Hz at ' +
              str(stepcurr * 0.001) + ' nA')
        if (spikerate > 7) & (spikerate < 7.6):
            print('Holding Current = ' + str(stepcurr * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate) + ' Hz')
            break
        elif spikerate > 7.6:
            h.ic_hold.amp = (stepcurr - 1) * 0.001  # holding current
            print('Spike Rate Passed Acceptable Range')
            print('Holding Current = ' + str((stepcurr - 1) * 0.001) + ' nA')
            print('Baseline Spike Rate = ' + str(spikerate_prev) + ' Hz')
            break