Exemple #1
0
        plt.axvline(t, color='green', linewidth=1.)

    max_v = np.max(segment.filter(name='v')[0])
    ax0.plot(segment.spiketrains[0],
             0.99 * max_v * np.ones_like(segment.spiketrains[0]), '.b')

    ax0.plot(segment.filter(name='v')[0], color='blue')


timestep = 1.
runtime = 1000.
sim.setup(timestep)

n_neurons = 1
preExc = sim.Population(n_neurons,
                        sim.SpikeSourcePoisson(rate=100),
                        label='input')
preExc.record('spikes')

preInh = sim.Population(n_neurons,
                        sim.SpikeSourcePoisson(rate=100),
                        label='input')
preInh.record('spikes')

parameters = {
    'v_rest': -65.0,  # Resting membrane potential in mV.
    'cm': 1.0,  # Capacity of the membrane in nF
    'tau_m': 20.0,  # Membrane time constant in ms.
    'tau_refrac': 0.1,  # Duration of refractory period in ms.
    'tau_syn_E': 3.0,  # Decay time of excitatory synaptic current in ms.
    'tau_syn_I': 5.0,  # Decay time of inhibitory synaptic current in ms.
else:
    # create separate populations for excitatory and inhibitory neurons
    exc_cells = sim.Population(n_exc,
                               celltype(**cell_params),
                               label="Excitatory_Cells")
    inh_cells = sim.Population(n_inh,
                               celltype(**cell_params),
                               label="Inhibitory_Cells")

    if use_assembly:
        # group the populations into an assembly
        all_cells = exc_cells + inh_cells

if benchmark == "COBA":
    ext_stim = sim.Population(20,
                              sim.SpikeSourcePoisson(rate=rate,
                                                     duration=stim_dur),
                              label="expoisson")
    rconn = 0.01
    ext_conn = sim.FixedProbabilityConnector(rconn)
    ext_syn = sim.StaticSynapse(weight=0.1)

print("%s Initialising membrane potential to random values..." % node_id)

uniformDistr = RandomDistribution('uniform',
                                  low=v_reset,
                                  high=v_thresh,
                                  rng=rng)
if use_views:
    all_cells.initialize(v=uniformDistr)
else:
    exc_cells.initialize(v=uniformDistr)
                 '.',
                 color=COLORS[nid])

    volts = segment.filter(name='v')[0]
    for nid, vs in enumerate(volts.T):
        # print(volts.shape)
        ax0.plot(vs, color=COLORS[nid])


timestep = 0.1
runtime = 200.
sim.setup(timestep)

n_neurons = 3
preExc = sim.Population(n_neurons,
                        sim.SpikeSourcePoisson(rate=200),
                        label='input')
preExc.record('spikes')

parameters = {
    'v_rest': -65.0,  # Resting membrane potential in mV.
    'cm': 1.0,  # Capacity of the membrane in nF
    'tau_m': 20.0,  # Membrane time constant in ms.
    'tau_refrac': 0.1,  # Duration of refractory period in ms.
    'tau_syn_E': 3.0,  # Decay time of excitatory synaptic current in ms.
    'tau_syn_I': 5.0,  # Decay time of inhibitory synaptic current in ms.
    'tau_syn_S': 5.0,
    'i_offset': 0.0,  # Offset current in nA
    'v_reset': -65.0,  # Reset potential after a spike in mV.
    'v_threshold': -50.0,  # Spike threshold in mV. STATIC, MIN
    'i': 0.0,  # nA total input current
# Take the neuron layers that need to be updated online or that we want to take records of
LGNBright = network.get_population("LGNBright")
LGNDark = network.get_population("LGNDark")
V1 = network.get_population("V1LayerToPlot")
V2 = network.get_population("V2LayerToPlot")
V4Bright = network.get_population("V4Brightness")
V4Dark = network.get_population("V4Darkness")
LGNBright.record("spikes")
LGNDark.record("spikes")
V1.record("spikes")
V2.record("spikes")
V4Bright.record("spikes")
V4Dark.record("spikes")
if inputPoisson:
    LGNBrightInput = sim.Population(ImageNumPixelRows * ImageNumPixelColumns,
                                    sim.SpikeSourcePoisson())
    LGNDarkInput = sim.Population(ImageNumPixelRows * ImageNumPixelColumns,
                                  sim.SpikeSourcePoisson())
    sim.Projection(LGNBrightInput, LGNBright, sim.OneToOneConnector(),
                   sim.StaticSynapse(weight=connections['brightInputToLGN']))
    sim.Projection(LGNDarkInput, LGNDark, sim.OneToOneConnector(),
                   sim.StaticSynapse(weight=connections['darkInputToLGN']))
if numSegmentationLayers > 1:
    if useSurfaceSegmentation:
        SurfaceSegmentationOff = network.get_population(
            "SurfaceSegmentationOff")
        SurfaceSegmentationOn = network.get_population("SurfaceSegmentationOn")
    if useBoundarySegmentation:
        BoundarySegmentationOff = network.get_population(
            "BoundarySegmentationOff")
        BoundarySegmentationOn = network.get_population(
Exemple #5
0
    'tau_syn_E': 1.0,  # ms
    'tau_syn_I': 5.0,  # ms
}

timestep = 0.1
max_w = 0.01
start_w = max_w / 2.0
min_delay = 0.1

sim.setup(timestep,
          min_delay=min_delay,
          backend='CUDA'
          # backend='SingleThreadedCPU'
          )

pre = sim.Population(10, sim.SpikeSourcePoisson(**{'rate': 10}))
post = sim.Population(100, neuron_class(**base_params))

# w = 1.0
w = sim.RandomDistribution('normal', [5.0, 1.0])
synapse = sim.StaticSynapse(weight=w)

prj = sim.Projection(
    pre,
    post,
    sim.FixedProbabilityConnector(0.25),
    # prj = sim.Projection(pre, post, sim.AllToAllConnector(),
    # prj = sim.Projection(pre, post, sim.OneToOneConnector(),
    synapse_type=synapse,
    receptor_type='excitatory')
sim.run(100)