Exemple #1
0
 def __init__(self):
     self.cells = [Cell(i) for i in range(5)]
     cvode.use_fast_imem(1)
     # a few intrinsically firing ARTIFICIAL_CELLS with and without gids
     self.acells = [h.IntervalFire() for _ in range(8)]
     r = h.Random()
     r.Random123(6, 0, 0)
     for a in self.acells:
         a.tau = r.uniform(2, 5)
         a.invl = r.uniform(2, 4)
     for i, a in enumerate(self.acells[5:]):
         pc.set_gid2node(i + 5, pc.id())
         pc.cell(i + 5, h.NetCon(a, None))
Exemple #2
0
 def __init__(self):
     self.cells = [Cell(i) for i in range(5)]
     # This is not supported on GPU, see:
     # https://github.com/BlueBrain/CoreNeuron/issues/197
     cvode.use_fast_imem(not enable_gpu)
     # a few intrinsically firing ARTIFICIAL_CELLS with and without gids
     self.acells = [h.IntervalFire() for _ in range(8)]
     r = h.Random()
     r.Random123(6, 0, 0)
     for a in self.acells:
         a.tau = r.uniform(2, 5)
         a.invl = r.uniform(2, 4)
     for i, a in enumerate(self.acells[5:]):
         pc.set_gid2node(i + 5, pc.id())
         pc.cell(i + 5, h.NetCon(a, None))
Exemple #3
0
def test_inputpresyn():
    # NetStim with gid = 1 connected to IntFire1 with gid = 2
    # sadly IntFire1 does not exist in coreneuron so use IntervalFire
    # make cells
    nstim = 3
    ncell = 15
    cells = {gid: None for gid in range(pc.id(), ncell, pc.nhost())}
    for gid in cells:
        pc.set_gid2node(gid, pc.id())
        cells[gid] = h.NetStim() if gid < nstim else h.IntervalFire()
        pc.cell(gid, h.NetCon(cells[gid], None))

    # connect
    netcons = {}
    for gid in cells:
        if gid >= nstim:
            for srcgid in range(nstim):
                netcons[(srcgid,
                         gid)] = nc = pc.gid_connect(srcgid, cells[gid])
                nc.delay = 1
                nc.weight[0] = 2
        else:  # The NetStim
            ns = cells[gid]
            ns.start = 0
            ns.number = 1
            ns.interval = 10

    # does it look like what we want?
    if False:
        for gid in cells:
            print(pc.id(), gid, cells[gid])
        for con in netcons:
            print(pc.id(), con)

    spiketime = h.Vector()
    gidvec = h.Vector()
    pc.spike_record(-1, spiketime, gidvec)

    def run(tstop):
        spiketime.resize(0)
        gidvec.resize(0)
        pc.set_maxstep(10)
        h.finitialize()
        pc.psolve(tstop)

    run(2)
    spikes_std = sortspikes(spiketime, gidvec)

    def same():
        spikes = sortspikes(spiketime, gidvec)
        assert spikes_std == spikes

    h.CVode().cache_efficient(1)
    from neuron import coreneuron

    coreneuron.enable = 1
    coreneuron.verbose = 0
    run(2)
    same()

    pc.barrier()