예제 #1
0
def run_sim(ncell):

    print "Cells: ", ncell

    setup0 = time.time()

    sim.setup(timestep=0.1)

    hh_cell_type = sim.HH_cond_exp()

    hh = sim.Population(ncell, hh_cell_type)

    pulse = sim.DCSource(amplitude=0.5, start=20.0, stop=80.0)
    pulse.inject_into(hh)

    hh.record('v')

    setup1 = time.time()

    t0 = time.time()

    sim.run(100.0)

    v = hh.get_data()

    sim.end()

    t1 = time.time()

    setup_total = setup1 - setup0
    run_total = t1 - t0
    print "Setup: ", setup_total
    print "Run: ", run_total
    print "Total sim time: ", setup_total + run_total
    return run_total
import pyNN.nest as simulator
import pyNN.nest.standardmodels.electrodes as elect

N = 1  # Number of neurons
t = 100.0  #Simulation time

# Has to be called at the beginning of the simulation
simulator.setup(timestep=0.1, min_delay=0.1, max_delay=10)

model = simulator.IF_curr_exp()

neurons = simulator.Population(N, model)

# DC source
current = simulator.DCSource(amplitude=0.5, start=20.0, stop=80.0)
#current = elect.DCSource(amplitude=0.5, start=20.0, stop=80.0)
current.inject_into(neurons)
#neurons.inject(current)

# Record the voltage
neurons.record('v')

simulator.run(t)  # Run the simulations for t ms

simulator.end()

# Extracts the data
data = neurons.get_data()  # Crates a Neo Block
segment = data.segments[0]  # Takes the first
vm = segment.analogsignalarrays[0]
예제 #3
0
                                cellparams=neuron_parameters_FS_cell)

    #V value initialization
    sim.initialize(Neurons_RS, v=-65.0)  # v:mV
    sim.initialize(Neurons_FS, v=-65.0)  # v:mV

    #parameters recorded : membrane potential & spikes
    Neurons_RS.record('v')
    Neurons_RS.record('spikes')

    Neurons_FS.record('v')
    Neurons_FS.record('spikes')

    #The external input
    pulse = sim.DCSource(
        amplitude=0.2, start=100,
        stop=400)  #amplitude=200pA, start=100ms and stop=400ms

    #representaton of the pulse injected
    x = [0, 50, 99, 100, 200, 300, 399, 400, 600]
    y = [0, 0, 0, 200, 200, 200, 200, 0, 0]
    fig = plt.figure()
    plt.plot(x, y)
    plt.xlabel("time(ms)")
    plt.ylabel("I(pA)")
    plt.ylim((0, 210))
    plt.title('DC current source')
    plt.setp(plt.gca().get_xticklabels(), visible=True)
    fig.savefig('input.png')

    #Adding the external input to the cells before running the simulation
예제 #4
0
        }) for i in range(1)
]

for ifcell in ifcellscond:
    ifcell.initialize(v=vrest)

####### simulate #######

spkte = array(
    [50., 100., 103., 106., 109., 112., 115., 118., 121., 124., 127.]) + 150.
spkti = spkte + 150.

# Subtract dt to guarantee exact onset of PSPs
spkte -= dt
spkti -= dt
pulse = sim.DCSource(amplitude=0.2, start=50., stop=150.)
spikesource1E = sim.create(sim.SpikeSourceArray, {'spike_times': spkte})
spikesource1I = sim.create(sim.SpikeSourceArray, {'spike_times': spkti})

pulse.inject_into(ifcellscond[0])
sim.connect(spikesource1E,
            ifcellscond[0],
            weight=wconde,
            receptor_type='excitatory',
            delay=0.1)
sim.connect(spikesource1I,
            ifcellscond[0],
            weight=wcondi,
            receptor_type='inhibitory',
            delay=0.1)
예제 #5
0
    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(
            "BoundarySegmentationOn")
        network.get_population("BoundarySegmentationOnInter3").inject(
            sim.DCSource(amplitude=constantInput, start=0.0, stop=simTime))

########################################################################################
### Network is defined, now set up stimulus, segmentation signal and run everything! ###
########################################################################################

# Stuff to plot activity of LGN, V1, V2, etc. layers
cumplotDensityLGNBright = [[0 for j in range(ImageNumPixelColumns)]
                           for i in range(ImageNumPixelRows)]
cumplotDensityLGNDark = [[0 for j in range(ImageNumPixelColumns)]
                         for i in range(ImageNumPixelRows)]
cumplotDensityOrientationV2 = [[[[0 for j in range(numPixelColumns)]
                                 for i in range(numPixelRows)]
                                for h in range(numSegmentationLayers)]
                               for k in range(numOrientations)]
cumplotDensityOrientationV1 = [[[0 for j in range(numPixelColumns)]