当前位置: 首页>>代码示例>>Python>>正文


Python utility.normalized_filename函数代码示例

本文整理汇总了Python中pyNN.utility.normalized_filename函数的典型用法代码示例。如果您正苦于以下问题:Python normalized_filename函数的具体用法?Python normalized_filename怎么用?Python normalized_filename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了normalized_filename函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: plotGraphOfMembranePotential

def plotGraphOfMembranePotential(network=None):
    assert network is not None, "Network is not initialised."
      
    from pyNN.utility import normalized_filename
    filename = normalized_filename("Results", "cell_type_demonstration", "pkl", "nest")
    
    cells = network.get_population("Cell Output Population of Network")
    inhL = network.get_population("Inhibitory Population of Left Retina")
    inhR = network.get_population("Inhibitory Population of Right Retina")
    
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = filename.replace("pkl", "png")
    Figure(
        Panel(cells.get_data().segments[0].filter(name='v')[0],
              ylabel="Membrane potential (mV)", xlabel="Time (ms)",
              data_labels=[cells.label], yticks=True, xticks=True, ylim=(-110, -40)),
        Panel(inhL.get_data().segments[0].filter(name='v')[0],
              ylabel="Membrane potential (mV)", xlabel="Time (ms)",
              data_labels=[inhL.label], yticks=True, xticks=True, ylim=(-110, -40)),
        Panel(inhR.get_data().segments[0].filter(name='v')[0],
              ylabel="Membrane potential (mV)", xlabel="Time (ms)",
              data_labels=[inhR.label], yticks=True, xticks=True, ylim=(-110, -40)),        
        title="Cooperative Network"
    ).save(figure_filename)  
    print "Graph is saved under the name: {0}".format(figure_filename)
    
    
    
开发者ID:AMFtech,项目名称:StereoMatching,代码行数:25,代码来源:NetworkVisualiser.py

示例2: print

    projections[label].initialize(a=synapse_types[label].parameter_space['n'], u=synapse_types[label].parameter_space['U'])

spike_source.record('spikes')

if "nest" in sim.__name__:
    print(sim.nest.GetStatus([projections['depressing, n=5'].nest_connections[0]]))

# === Run the simulation =====================================================

sim.run(400.0)


# === Save the results, optionally plot a figure =============================

for label, p in populations.items():
    filename = normalized_filename("Results", "multiquantal_synapses_%s" % label,
                                   "pkl", options.simulator)
    p.write_data(filename, annotations={'script_name': __file__})


if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    #figure_filename = normalized_filename("Results", "multiquantal_synapses",
    #                                      "png", options.simulator)
    figure_filename = "Results/multiquantal_synapses_{}.png".format(options.simulator)

    data = {}
    for label in synapse_types:
        data[label] = populations[label].get_data().segments[0]
        gsyn = data[label].filter(name='gsyn_inh')[0]
        gsyn_mean = neo.AnalogSignal(gsyn.mean(axis=1).reshape(-1, 1),
                                     sampling_rate=gsyn.sampling_rate,
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:32,代码来源:multiquantal_synapses.py

示例3: get_script_args

"""
Simple test of injecting time-varying current into a cell

Andrew Davison, UNIC, CNRS
May 2009

$Id$
"""

from pyNN.utility import get_script_args, normalized_filename

simulator_name = get_script_args(1)[0]
exec("from pyNN.%s import *" % simulator_name)

setup()

cell = create(IF_curr_exp(v_thresh=-55.0, tau_refrac=5.0))
current_source = StepCurrentSource(times=[50.0, 110.0, 150.0, 210.0],
                                   amplitudes=[0.4, 0.6, -0.2, 0.2])
cell.inject(current_source)

filename = normalized_filename("Results", "StepCurrentSource", "pkl", simulator_name)
record('v', cell, filename, annotations={'script_name': __file__})
run(250.0)

end()
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:26,代码来源:StepCurrentSource.py

示例4: int

n_spikes = int(2*tstop*input_rate/1000.0)
spike_times = numpy.add.accumulate(rng.next(n_spikes, 'exponential',
                                            {'beta': 1000.0/input_rate}, mask_local=False))

input_population  = sim.Population(10, sim.SpikeSourceArray(spike_times=spike_times), label="input")
output_population = sim.Population(20, sim.IF_curr_exp(**cell_params), label="output")
print("[%d] input_population cells: %s" % (node, input_population.local_cells))
print("[%d] output_population cells: %s" % (node, output_population.local_cells))
print("tau_m =", output_population.get('tau_m'))

print("[%d] Connecting populations" % node)
connector = sim.FixedProbabilityConnector(0.5, rng=rng)
syn = sim.StaticSynapse(weight=1.0)
projection = sim.Projection(input_population, output_population, connector, syn)

filename = normalized_filename("Results", "simpleRandomNetwork", "conn",
                               simulator_name, sim.num_processes())
projection.save('connections', filename)

input_population.record('spikes')
output_population.record('spikes')
output_population.sample(n_record, rng).record('v')

print("[%d] Running simulation" % node)
sim.run(tstop)

print("[%d] Writing spikes and Vm to disk" % node)
filename = normalized_filename("Results", "simpleRandomNetwork_output", "pkl",
                               simulator_name, sim.num_processes())
output_population.write_data(filename, annotations={'script_name': __file__})
##input_population.write_data('%s_input.h5' % file_stem)
spike_counts = output_population.get_spike_counts()
开发者ID:Haptein,项目名称:PyNN,代码行数:32,代码来源:simpleRandomNetwork.py

示例5: normalized_filename

    projections[label] = sim.Projection(spike_source, populations[label], connector,
                                        receptor_type='inhibitory',
                                        synapse_type=synapse_types[label])

spike_source.record('spikes')


# === Run the simulation =====================================================

sim.run(400.0)


# === Save the results, optionally plot a figure =============================

for label, p in populations.items():
    filename = normalized_filename("Results", "stochastic_tsodyksmarkram_%s" % label,
                                   "pkl", options.simulator)
    p.write_data(filename, annotations={'script_name': __file__})


if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    #figure_filename = normalized_filename("Results", "stochastic_tsodyksmarkram",
    #                                      "png", options.simulator)
    figure_filename = "Results/stochastic_tsodyksmarkram_{}.png".format(options.simulator)
    panels = []
    for variable in ('gsyn_inh',):  # 'v'):
        for population in sorted(populations.values(), key=lambda p: p.label):
            panels.append(
                Panel(population.get_data().segments[0].filter(name=variable)[0],
                      data_labels=[population.label], yticks=True),
            )
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:32,代码来源:stochastic_tsodyksmarkram.py

示例6: setup

rate = 100.0

setup(timestep=0.1, min_delay=0.2, max_delay=1.0)

cell_params = {'tau_refrac': 2.0, 'v_thresh': [-50.0, -48.0] ,
               'tau_syn_E': 2.0, 'tau_syn_I': 2.0}
output_population = Population(2, IF_curr_alpha(**cell_params), label="output")

number = int(2*tstop*rate/1000.0)
numpy.random.seed(26278342)
spike_times = numpy.add.accumulate(numpy.random.exponential(1000.0/rate, size=number))
assert spike_times.max() > tstop
print spike_times.min()

input_population  = Population(1, SpikeSourceArray(spike_times=spike_times), label="input")

projection = Projection(input_population, output_population,
                        AllToAllConnector(), StaticSynapse(weight=1.0))

input_population.record('spikes')
output_population.record(('spikes', 'v'))

run(tstop)

filename = normalized_filename("Results", "simpleNetwork_output", "pkl",
                               simulator_name)
output_population.write_data(filename, annotations={'script_name': __file__})
##input_population.write_data("Results/simpleNetwork_input_%s.h5" % simulator_name)

end()
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:30,代码来源:simpleNetwork.py

示例7: range

for pixel in range(0, dimensionRetinaX):
    for disp in range(disparityMin, disparityMax+1):
        # connect each pixel with as many cells on the same row as disparity values allow. Weight and delay are set to 1 and 0 respectively.
        indexInNetworkLayer = pixel*dimensionRetinaX + pixel - disp*dimensionRetinaX
        if indexInNetworkLayer < 0:
            break
        connectionPaternRetinaRight.append((pixel, indexInNetworkLayer, 0.189, 0.2))   
print connectionPaternRetinaRight
       
connectionRetinaLeft = Projection(retinaLeft, oneNeuralLayer, FromListConnector(connectionPaternRetinaLeft), StaticSynapse(), receptor_type='excitatory')
connectionRetinaRight = Projection(retinaRight, oneNeuralLayer, FromListConnector(connectionPaternRetinaRight), StaticSynapse(), receptor_type='excitatory')

run(200.0)

# plot results
filename = normalized_filename("Results", "cell_type_demonstration", "pkl", "nest")
oneNeuralLayer.write_data(filename, annotations={'script_name': __file__})
retinaLeft.write_data(filename, annotations={'script_name': __file__})
retinaRight.write_data(filename, annotations={'script_name': __file__})

cellActivity = oneNeuralLayer.get_data().segments[0]
retinaLeftActivity = retinaLeft.get_data().segments[0]
retinaRightActivity = retinaRight.get_data().segments[0]

# from pyNN.utility.plotting import Figure, Panel
# figure_filename = filename.replace("pkl", "png")
# Figure(Panel(cellActivity.spiketrains, xlabel="Time (ms)", xticks=True, yticks=True), 
#        Panel(cellActivity.filter(name='v')[0], ylabel="Membrane potential (mV)", yticks=True, ylim=(-66, -48)), 
#        Panel(retinaLeftActivity.spiketrains, xlabel="Time (ms)", xticks=True, yticks=True),
#        Panel(retinaRightActivity.spiketrains, xlabel="Time (ms)", xticks=True, yticks=True),
#        title="Simple CoNet", annotations="Simulated with NEST").save(figure_filename)
开发者ID:AMFtech,项目名称:StereoMatching,代码行数:31,代码来源:simpleCoNet.py

示例8: gen

        return [gen() for j in i]
    else:
        return gen()


assert generate_spike_times(0).max() > simtime

spike_source = Population(n, SpikeSourceArray(spike_times=generate_spike_times))

spike_source.record("spikes")
cells.record("spikes")
cells[0:1].record("v")

input_conns = Projection(spike_source, cells, AllToAllConnector(), StaticSynapse())
input_conns.setWeights(w)
input_conns.setDelays(syn_delay)

# === Run simulation ===========================================================

run(simtime)

# spike_source.write_data("Results/small_network_input_np%d_%s.pkl" % (num_processes(), simulator_name))
filename = normalized_filename("Results", "small_network", "pkl", simulator_name, num_processes())
cells.write_data(filename, annotations={"script_name": __file__})

print "Mean firing rate: ", cells.mean_spike_count() * 1000.0 / simtime, "Hz"

# === Clean up and quit ========================================================

end()
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:30,代码来源:small_network.py

示例9: MyProgressBar

        return t + self.interval


class MyProgressBar(object):
    def __init__(self, interval, t_stop):
        self.interval = interval
        self.t_stop = t_stop
        self.pb = ProgressBar(width=int(t_stop / interval), char=".")

    def __call__(self, t):
        self.pb(t / self.t_stop)
        return t + self.interval


sim.setup()

p = sim.Population(50, sim.SpikeSourcePoisson())
p.record("spikes")

rate_generator = iter(range(0, 100, 20))
progress_bar = ProgressBar()
sim.run(1000, callbacks=[MyProgressBar(10.0, 1000.0), SetRate(p, rate_generator, 200.0)])

data = p.get_data().segments[0]

Figure(Panel(data.spiketrains, xlabel="Time (ms)", xticks=True), title="Time varying Poisson spike trains").save(
    normalized_filename("Results", "varying_poisson", "png", args.simulator)
)

sim.end()
开发者ID:tillschumann,项目名称:PyNN,代码行数:30,代码来源:varying_poisson.py

示例10: zip

# === Create four cells and inject current into each one =====================

cells = sim.Population(4, sim.IF_curr_exp(v_thresh=-55.0, tau_refrac=5.0, tau_m=10.0))

current_sources = [sim.DCSource(amplitude=0.5, start=50.0, stop=400.0),
                   sim.StepCurrentSource(times=[50.0, 210.0, 250.0, 410.0],
                                         amplitudes=[0.4, 0.6, -0.2, 0.2]),
                   sim.ACSource(start=50.0, stop=450.0, amplitude=0.2,
                                offset=0.1, frequency=10.0, phase=180.0),
                   sim.NoisyCurrentSource(mean=0.5, stdev=0.2, start=50.0,
                                          stop=450.0, dt=1.0)]

for cell, current_source in zip(cells, current_sources):
    cell.inject(current_source)

filename = normalized_filename("Results", "current_injection", "pkl", options.simulator)
sim.record('v', cells, filename, annotations={'script_name': __file__})

# === Run the simulation =====================================================

sim.run(500.0)


# === Save the results, optionally plot a figure =============================

vm = cells.get_data().segments[0].filter(name="v")[0]
sim.end()

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    from quantities import mV
开发者ID:Haptein,项目名称:PyNN,代码行数:31,代码来源:current_injection.py

示例11: print

print("tau_eta = ", neurons.get('tau_eta'))
print("a_gamma = ", neurons.get('a_gamma'))

electrode = sim.DCSource(**parameters['stimulus'])
electrode.inject_into(neurons)

neurons.record(['v', 'i_eta', 'v_t'])


# === Run the simulation =====================================================

sim.run(t_stop)

# === Save the results, optionally plot a figure =============================

filename = normalized_filename("Results", "gif_neuron", "pkl",
                               options.simulator, sim.num_processes())
neurons.write_data(filename, annotations={'script_name': __file__})

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = filename.replace("pkl", "png")
    data = neurons.get_data().segments[0]
    v = data.filter(name="v")[0]
    v_t = data.filter(name="v_t")[0]
    i_eta = data.filter(name="i_eta")[0]
    Figure(
        Panel(v, ylabel="Membrane potential (mV)",
              yticks=True, ylim=[-66, -52]),
        Panel(v_t, ylabel="Threshold (mV)",
              yticks=True),
        Panel(i_eta, ylabel="i_eta (nA)", xticks=True,
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:32,代码来源:gif_neuron.py

示例12: print

print("Height of first EPSP:")
for population in all_neurons.populations:
    # retrieve the recorded data
    vm = population.get_data().segments[0].filter(name='v')[0]
    # take the data between the first and second incoming spikes
    vm12 = vm.time_slice(spike_times[0] * ms, spike_times[1] * ms)
    # calculate and print the EPSP height
    for channel in (0, 1):
        v_init = vm12[:, channel][0]
        height = vm12[:, channel].max() - v_init
        print("  {:<30} at {}: {}".format(population.label, v_init, height))

# === Save the results, optionally plot a figure =============================

filename = normalized_filename("Results", "synaptic_input", "pkl", options.simulator)
all_neurons.write_data(filename, annotations={'script_name': __file__})

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = filename.replace("pkl", "png")
    Figure(
        Panel(cuba_exp.get_data().segments[0].filter(name='v')[0],
              ylabel="Membrane potential (mV)",
              data_labels=[cuba_exp.label], yticks=True, ylim=(-66, -50)),
        Panel(cuba_alpha.get_data().segments[0].filter(name='v')[0],
              data_labels=[cuba_alpha.label], yticks=True, ylim=(-66, -50)),
        Panel(coba_exp.get_data().segments[0].filter(name='v')[0],
              data_labels=[coba_exp.label], yticks=True, ylim=(-66, -50)),
        Panel(coba_alpha.get_data().segments[0].filter(name='v')[0],
              data_labels=[coba_alpha.label], yticks=True, ylim=(-66, -50)),
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:30,代码来源:synaptic_input.py

示例13: normalized_filename

electrode = sim.DCSource(start=2.0, stop=92.0, amplitude=0.014)
electrode.inject_into(neurons[2:3])

neurons.record(['v'])  #, 'u'])
neurons.initialize(v=-70.0, u=-14.0)


# === Run the simulation =====================================================

sim.run(100.0)


# === Save the results, optionally plot a figure =============================

filename = normalized_filename("Results", "Izhikevich", "pkl",
                               options.simulator, sim.num_processes())
neurons.write_data(filename, annotations={'script_name': __file__})

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = filename.replace("pkl", "png")
    data = neurons.get_data().segments[0]
    v = data.filter(name="v")[0]
    #u = data.filter(name="u")[0]
    Figure(
        Panel(v, ylabel="Membrane potential (mV)", xticks=True, xlabel="Time (ms)",
              data_labels=[options.simulator.upper()], yticks=True),
        #Panel(u, ylabel="u variable (units?)"),
    ).save(figure_filename)
    print(figure_filename)
开发者ID:Huitzilo,项目名称:PyNN,代码行数:30,代码来源:Izhikevich.py

示例14: report_time

def report_time(t):
    print "The time is %gms" % t
    return t + 500

sim.run(t_stop, callbacks=[report_time])

scipy.io.savemat('weights.mat', {
    'la':connections.get('weight', format='list', with_address=True),
    'ln':connections.get('weight', format='list', with_address=False),
    'aa':connections.get('weight', format='array', with_address=True),
    'an':connections.get('weight', format='array', with_address=False)
})

# === Save the results, optionally plot a figure =============================

filename = normalized_filename("Results", "ball_trajectories", "pkl", options.simulator)
p2.write_data(filename, annotations={'script_name': __file__})

presynaptic_data = p1.get_data().segments[0]
postsynaptic_data = p2.get_data().segments[0]
print("Post-synaptic spike times: %s" % postsynaptic_data.spiketrains[0])

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel, DataTable
    figure_filename = filename.replace("pkl", "png")
    Figure(
        # raster plot of the presynaptic neuron spike times
        Panel(presynaptic_data.spiketrains,
              yticks=True, markersize=0.2, xlim=((episodes-10)*(t_stop/episodes), t_stop)),
        Panel(postsynaptic_data.spiketrains,
              yticks=True, markersize=0.2, xlim=((episodes-10)*(t_stop/episodes), t_stop)),
开发者ID:darioml,项目名称:fyp-public,代码行数:31,代码来源:ball_trajectories.py

示例15: normalized_filename

    projections[label] = sim.Projection(spike_source, populations[label], connector,
                                        receptor_type='inhibitory',
                                        synapse_type=synapse_types[label])

spike_source.record('spikes')


# === Run the simulation =====================================================

sim.run(200.0)


# === Save the results, optionally plot a figure =============================

for label, p in populations.items():
    filename = normalized_filename("Results", "tsodyksmarkram_%s" % label,
                                   "pkl", options.simulator)
    p.write_data(filename, annotations={'script_name': __file__})


if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    figure_filename = normalized_filename("Results", "tsodyksmarkram",
                                          "png", options.simulator)
    panels = []
    for variable in ('gsyn_inh', 'v'):
        for population in populations.values():
            panels.append(
                Panel(population.get_data().segments[0].filter(name=variable)[0],
                      data_labels=[population.label], yticks=True),
            )
    # add ylabel to top panel in each group
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:32,代码来源:tsodyksmarkram.py


注:本文中的pyNN.utility.normalized_filename函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。