本文整理汇总了Python中pypet.trajectory.Trajectory._make_single_run方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory._make_single_run方法的具体用法?Python Trajectory._make_single_run怎么用?Python Trajectory._make_single_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.trajectory.Trajectory
的用法示例。
在下文中一共展示了Trajectory._make_single_run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import _make_single_run [as 别名]
def main():
pool = Pool(2)
lock = Manager().Lock()
logging.basicConfig(level=logging.DEBUG)
log_to_stderr()
traj = Trajectory(name='MyTrajectory',filename='../experiments/test.hdf5')
config['multiproc'] = True
#traj.load_trajectory(trajectoryname='MyTrajectory_2013_05_23_14h29m26s')
traj.f_add_parameter('test.testparam', param_type=ParameterSet, **{'Fuechse':1,'Sapiens':1,'Comment':'ladida'})
traj.last.foo = 'bar'
traj.f_add_parameter('Network.Cm')
traj.Parameters.Network.Cm.value= 1.0
traj.Parameters.Network.Cm.unit = 'pF'
print traj.Parameters.Network.Cm()
traj.last.herbert = 4.5
traj.Parameters.test.testparam.Konstantin = 'Konstantin'
traj.f_add_parameter(full_parameter_name='honky', **{'mirta':np.array([[1,2,7],[3,2,17]])})
traj.f_add_parameter('flonky',**{'val' : 10})
param1 = traj.Parameters.test.testparam
param2 = traj.Parameters.honky
param3 = traj.last
print param1()
print param3('val')
exp2_list = range(3)
exp1_list = range(3)
exp3_list = range(3)
explore_dict = { param1.gfn('Sapiens') : exp1_list,
param2.get_fullname('mirta'):exp2_list,
param3.gfn('val') : exp3_list}
cmb_list=[(param3.gfn('val'),param1.gfn('Sapiens'))]
traj.f_add_derived_parameter(full_parameter_name='foo', **{'bar' : -1}).moo = 'zip'
lilma = spsp.lil_matrix((10000,1000))
lilma[0,100] = 555
lilma[9999,999] = 11
traj.f_add_parameter('sparse', mat=lilma, param_type = SparseParameter)
traj.f_explore(ut.cartesian_product,explore_dict,cmb_list)
traj._prepare_experiment()
traj.f_store()
pathname = config['logfolder']
it = ((traj._make_single_run(n),lock, pathname) for n in xrange(len(traj)))
moo = pool.imap(do_stuff, it)
pool.close()
pool.join()
示例2: TrajectoryTest
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import _make_single_run [as 别名]
#.........这里部分代码省略.........
def test_remove_of_explored_stuff_if_saved(self):
self.traj = Trajectory()
self.traj.f_add_parameter('test', 42)
self.traj.f_explore({'test':[1,2,3,4]})
self.traj._stored=True
self.traj.parameters.f_remove_child('test')
len(self.traj) == 4
def test_remov_of_explored_stuff_if_not_saved(self):
self.traj = Trajectory()
self.traj.f_add_parameter('test', 42)
self.traj.f_explore({'test':[1,2,3,4]})
self.traj.parameters.f_remove_child('test')
self.assertTrue(len(self.traj) == 1)
def test_not_unique_search(self):
self.traj = Trajectory()
self.traj.f_add_parameter('ghgghg.test')
self.traj.f_add_parameter('ghdsfdfdsfdsghg.test')
with self.assertRaises(pex.NotUniqueNodeError):
self.traj.test
self.traj.f_add_parameter('depth0.depth1.depth2.findme', 42)
self.traj.f_add_parameter('depth0.depth1.findme', 43)
self.assertTrue(self.traj.findme==43)
with self.assertRaises(pex.NotUniqueNodeError):
self.traj.f_get('depth0.findme', backwards_search=True)
def test_contains_item_identity(self):
peterpaul = self.traj.f_get('peter.paul')
self.assertTrue(peterpaul in self.traj)
peterpaulcopy = copy.deepcopy(peterpaul)
self.assertFalse(peterpaulcopy in self.traj)
def test_get_children(self):
for node in self.traj.f_iter_nodes():
if not node.v_is_leaf:
self.assertEqual(id(node.f_get_children(copy=False)), id(node._children))
self.assertNotEqual(id(node.f_get_children(copy=True)), id(node._children))
self.assertEqual(sorted(node.f_get_children(copy=True).keys()),
sorted(node._children.keys()))
def test_short_cuts(self):
self.traj = Trajectory()
self.traj.f_add_parameter('test', 42)
self.traj.f_add_config('tefffst', 42)
self.traj.f_add_derived_parameter('dtest', 42)
self.traj.f_add_result('safd', 42)
self.traj.f_explore({'test':[1,2,3,4]})
self.assertEqual(id(self.traj.par), id(self.traj.parameters))
#self.assertEqual(id(self.traj.param), id(self.traj.parameters))
self.assertEqual(id(self.traj.dpar), id(self.traj.derived_parameters))
#self.assertEqual(id(self.traj.dparam), id(self.traj.derived_parameters))
self.assertEqual(id(self.traj.conf), id(self.traj.config))
self.assertEqual(id(self.traj.res), id(self.traj.results))
srun = self.traj._make_single_run(3)
srun.f_add_result('sdffds',42)
self.assertEqual(id(srun.results.crun), id(srun.results.f_get(srun.v_name)))