本文整理汇总了Python中pyNN.utility.Timer.mark方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.mark方法的具体用法?Python Timer.mark怎么用?Python Timer.mark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyNN.utility.Timer
的用法示例。
在下文中一共展示了Timer.mark方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main_pynest
# 需要导入模块: from pyNN.utility import Timer [as 别名]
# 或者: from pyNN.utility.Timer import mark [as 别名]
def main_pynest(parameters):
P = parameters
assert P.sim_name == "pynest"
timer = Timer()
import nest
timer.mark("import")
nest.SetKernelStatus({"resolution": 0.1})
timer.mark("setup")
p = nest.Create("iaf_neuron", n=P.n, params={"I_e": 1000.0})
timer.mark("build")
# todo: add recording and data retrieval
nest.Simulate(P.sim_time)
timer.mark("run")
mpi_rank = nest.Rank()
num_processes = nest.NumProcesses()
data = P.as_dict()
data.update(num_processes=num_processes,
timings=timer.marks)
return mpi_rank, data
示例2: main_pyNN
# 需要导入模块: from pyNN.utility import Timer [as 别名]
# 或者: from pyNN.utility.Timer import mark [as 别名]
def main_pyNN(parameters):
timer = Timer()
sim = import_module(parameters.simulator)
timer.mark("import")
sim.setup(threads=parameters.threads)
timer.mark("setup")
populations = {}
for name, P in parameters.populations.parameters():
populations[name] = sim.Population(P.n, getattr(sim, P.celltype)(**P.params), label=name)
timer.mark("build")
if parameters.projections:
projections = {}
for name, P in parameters.projections.parameters():
connector = getattr(sim, P.connector.type)(**P.connector.params)
synapse_type = getattr(sim, P.synapse_type.type)(**P.synapse_type.params)
projections[name] = sim.Projection(populations[P.pre],
populations[P.post],
connector,
synapse_type,
receptor_type=P.receptor_type,
label=name)
timer.mark("connect")
if parameters.recording:
for pop_name, to_record in parameters.recording.parameters():
for var_name, n_record in to_record.items():
populations[pop_name].sample(n_record).record(var_name)
timer.mark("record")
sim.run(parameters.sim_time)
timer.mark("run")
spike_counts = {}
if parameters.recording:
for pop_name in parameters.recording.names():
block = populations[pop_name].get_data() # perhaps include some summary statistics in the data returned?
spike_counts["spikes_%s" % pop_name] = populations[pop_name].mean_spike_count()
timer.mark("get_data")
mpi_rank = sim.rank()
num_processes = sim.num_processes()
sim.end()
data = dict(timer.marks)
data.update(num_processes=num_processes)
data.update(spike_counts)
return mpi_rank, data