Exemplo n.º 1
0
def single():
    cell = IzhCell()
    cell.class1()
    #    cell.izh.amp = 0
    #    cell.izh.delay = 0
    #    cell.izh.dur = 1e9

    tvec = h.Vector()
    tvec.record(h._ref_t)
    vvec = h.Vector()
    vvec.record(cell.soma(0.5)._ref_v)

    recording = nu.SpikeRecorder([cell])
    run(30 * 60000)

    times = recording.tvec.as_numpy()
    deltas = np.diff(times)
    plt.hist(deltas, bins=50, normed=True)
    x = np.linspace(1, 10000, 10000)
    mu, std = stats.norm.fit(deltas)
    norm = stats.norm.pdf(x, mu, std)
    plt.plot(x, norm, 'r')
    print(stats.kstest(deltas, 'norm', args=stats.norm.fit(deltas)))
    a, b = stats.expon.fit(deltas)
    print(a, b)
    exp = stats.expon.pdf(x, a, b)
    plt.plot(x, exp, 'g')
    print(stats.kstest(deltas, 'expon', args=stats.norm.fit(deltas)))
    plt.figure()
Exemplo n.º 2
0
def simulate():
    ''' create a neuron '''

    cell = IzhCell()
    cell.RS()
    cell.izh.amp = 10
    cell.izh.delay = 100
    cell.izh.dur = 1e9

    tvec = h.Vector()
    tvec.record(h._ref_t)
    vvec = h.Vector()
    vvec.record(cell.soma(0.5)._ref_v)
    h.v_init = -70
    h.dt = 0.1
    h.tstop = 300
    h.run()
    plt.plot(tvec, vvec)
    plt.show()
Exemplo n.º 3
0
def simulate_pair():

    cell1 = IzhCell()
    cell1.class2()
    cell2 = IzhCell()
    cell2.class1()
    nc1 = cell1.connect2target(cell2.synlist[0])
    nc1.weight[0] = 0.0002
    nc1.delay = 1

    tvec = h.Vector()
    tvec.record(h._ref_t)
    vvec = h.Vector()
    vvec.record(cell2.soma(0.5)._ref_v)
    h.v_init = -65
    h.dt = 0.1
    h.tstop = 1000
    h.run()
    plt.plot(tvec, vvec)
    plt.show()
Exemplo n.º 4
0
def pair():
    cell1 = IzhCell()
    cell1.class1()
    cell2 = IzhCell()
    cell2.class1()

    tvec = h.Vector()
    tvec.record(h._ref_t)
    vvec1 = h.Vector()
    vvec2 = h.Vector()
    vvec1.record(cell1.soma(0.5)._ref_v)
    vvec2.record(cell2.soma(0.5)._ref_v)

    recording = nu.SpikeRecorder([cell1, cell2])
    run(20000)

    plt.plot(tvec, vvec1)
    plt.plot(tvec, vvec2)

    nu.draw_raster_plot(recording)
    spike_times = nu.separate_cells(recording)
    print(spike_times.keys())
    print(spike_times[1])
Exemplo n.º 5
0
def test_noise():
    cell = IzhCell()
    cell.RS()

    cell.rs = RandomStream(1)
    cell.rs.normal(0, 1)

    cell.noise = h.InGauss(0.5, sec=cell.soma)
    cell.noise.mean = 0
    cell.noise.stdev = 0.02
    cell.noise.delay = 0
    cell.noise.dur = 1e9
    cell.noise.noiseFromRandom(cell.rs.r)

    tvec = h.Vector()
    tvec.record(h._ref_t)
    vvec = h.Vector()
    vvec.record(cell.soma(0.5)._ref_v)
    h.v_init = -70
    h.dt = 0.1
    h.tstop = 1000
    h.run()
    plt.plot(tvec, vvec)
    plt.show()