本文整理汇总了Python中pypet.trajectory.Trajectory.v_auto_load方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.v_auto_load方法的具体用法?Python Trajectory.v_auto_load怎么用?Python Trajectory.v_auto_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.trajectory.Trajectory
的用法示例。
在下文中一共展示了Trajectory.v_auto_load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_auto_load
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_auto_load [as 别名]
def test_auto_load(self):
traj = Trajectory(name='Test', filename=make_temp_file('autoload.hdf5'))
traj.v_auto_load = True
traj.f_add_result('I.am.$.a.mean.resu', 42, comment='Test')
traj.f_add_derived_parameter('ffa', 42)
traj.f_store()
ffa=traj.f_get('ffa')
ffa.f_unlock()
ffa.f_empty()
self.assertTrue(ffa.f_is_empty())
traj.f_remove_child('results', recursive=True)
# check auto load
val = traj.res.I.am.crun.a.mean.resu
self.assertTrue(val==42)
val = traj.ffa
self.assertTrue(val==42)
with self.assertRaises(Exception):
traj.kdsfdsf
示例2: test_wildcard_search
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_auto_load [as 别名]
def test_wildcard_search(self):
traj = Trajectory(name='Test', filename=make_temp_file('wilcard.hdf5'))
traj.f_add_parameter('expl', 2)
traj.f_explore({'expl':[1,2,3,4]})
traj.f_add_result('wc2test.$.hhh', 333)
traj.f_add_leaf('results.wctest.run_00000000.jjj', 42)
traj.f_add_result('results.wctest.run_00000001.jjj', 43)
traj.v_as_run = 1
self.assertTrue(traj.results.wctest['$'].jjj==43)
self.assertTrue(traj.results.wc2test.crun.hhh==333)
traj.f_store()
traj.f_remove_child('results', recursive=True)
traj.v_auto_load = True
self.assertTrue(traj.results.wctest['$'].jjj==43)
self.assertTrue(traj.results.wc2test.crun.hhh==333)
traj.f_remove_child('results', recursive=True)
traj.v_auto_load = True
self.assertTrue(traj.results.wctest[-2].jjj==43)
self.assertTrue(traj.results.wc2test[-2].hhh==333)
traj.f_remove_child('results', recursive=True)
traj.v_auto_load = True
self.assertTrue(traj.results.wctest[1].jjj==43)
self.assertTrue(traj.results.wc2test[-1].hhh==333)
示例3: test_migrations
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_auto_load [as 别名]
def test_migrations(self):
traj = Trajectory(name='Test', filename=make_temp_file('migrate.hdf5'))
traj.f_add_result('I.am.a.mean.resu', 42, comment='Test')
traj.f_add_derived_parameter('ffa', 42)
traj.f_store()
new_file = make_temp_file('migrate2.hdf5')
traj.f_migrate(new_filename=new_file)
traj.f_store()
new_traj = Trajectory()
new_traj.f_migrate(new_name=traj.v_name, new_filename=new_file, in_store=True)
new_traj.v_auto_load=True
self.assertTrue(new_traj.results.I.am.a.mean.resu == 42)
示例4: test_f_iter_runs_auto_load
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_auto_load [as 别名]
def test_f_iter_runs_auto_load(self):
###Explore
self.explore(self.traj)
results = self.env.f_run(multiply)
self.are_results_in_order(results)
traj = self.traj
self.assertTrue(len(traj) == len(compat.listvalues(self.explore_dict)[0]))
self.traj.f_load_skeleton()
self.traj.f_load_items(self.traj.f_to_dict().keys(), only_empties=True)
self.check_if_z_is_correct(traj)
newtraj = Trajectory()
newtraj.v_storage_service=HDF5StorageService(filename=self.filename)
newtraj.f_load(name=self.traj.v_name, index=None, as_new=False, load_data=0)
newtraj.v_auto_load = True
newtraj.par.f_load_child('y', load_data=1)
for idx, run_name in enumerate(self.traj.f_iter_runs()):
newtraj.v_crun=run_name
self.traj.v_idx = idx
newtraj.v_idx = idx
nameset = set((x.v_name for x in traj.f_iter_nodes(predicate=(idx,))))
self.assertTrue('run_%08d' % (idx+1) not in nameset)
self.assertTrue('run_%08d' % idx in nameset)
self.assertTrue(traj.v_crun == run_name)
self.assertTrue(newtraj.res.runs.crun.z==newtraj.par.x*newtraj.par.y,' z != x*y: %s != %s * %s' %
(str(newtraj.crun.z),str(newtraj.x),str(newtraj.y)))
traj = self.traj
self.assertTrue(traj.v_idx == -1)
self.assertTrue(traj.v_crun is None)
self.assertTrue(traj.v_crun_ == pypetconstants.RUN_NAME_DUMMY)
self.assertTrue(newtraj.v_idx == idx)
示例5: main
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_auto_load [as 别名]
def main():
# This time we don't need an environment since we just going to look
# at data in the trajectory
traj = Trajectory('FiringRate', add_time=False)
# Let's load the trajectory from the file
# Only load the parameters, we will load the results on the fly as we need them
traj.f_load(filename='./hdf5/FiringRate.hdf5', load_parameters=2,
load_results=0, load_derived_parameters=0)
# We'll simply use auto loading so all data will be loaded when needed.
traj.v_auto_load = True
rates_frame = traj.res.summary.firing_rates.rates_frame
# Here we load the data automatically on the fly
plt.figure()
plt.subplot(2,1,1)
#Let's iterate through the columns and plot the different firing rates :
for tau_ref, I_col in rates_frame.iteritems():
plt.plot(I_col.index, I_col, label='Avg. Rate for tau_ref=%s' % str(tau_ref))
# Label the plot
plt.xlabel('I')
plt.ylabel('f[Hz]')
plt.title('Firing as a function of input current `I`')
plt.legend()
# Also let's plot an example run, how about run 13 ?
example_run = 13
traj.v_idx = example_run # We make the trajectory behave as a single run container.
# This short statement has two major effects:
# a) all explored parameters are set to the value of run 13,
# b) if there are tree nodes with names other than the current run aka `run_00000013`
# they are simply ignored, if we use the `$` sign or the `crun` statement,
# these are translated into `run_00000013`.
# Get the example data
example_I = traj.I
example_tau_ref = traj.tau_ref
example_V = traj.results.neuron.crun.V # Here crun stands for run_00000013
# We need the time step...
dt = traj.dt
# ...to create an x-axis for the plot
dt_array = [irun * dt for irun in range(len(example_V))]
# And plot the development of V over time,
# Since this is rather repetitive, we only
# plot the first eighth of it.
plt.subplot(2,1,2)
plt.plot(dt_array, example_V)
plt.xlim((0, dt*len(example_V)/8))
# Label the axis
plt.xlabel('t[ms]')
plt.ylabel('V')
plt.title('Example of development of V for I=%s, tau_ref=%s in run %d' %
(str(example_I), str(example_tau_ref), traj.v_idx))
# And let's take a look at it
plt.show()
# Finally revoke the `traj.v_idx=13` statement and set everything back to normal.
# Since our analysis is done here, we could skip that, but it is always a good idea
# to do that.
traj.f_restore_default()