本文整理汇总了Python中pypet.trajectory.Trajectory.f_idx_to_run方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.f_idx_to_run方法的具体用法?Python Trajectory.f_idx_to_run怎么用?Python Trajectory.f_idx_to_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.trajectory.Trajectory
的用法示例。
在下文中一共展示了Trajectory.f_idx_to_run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_f_is_completed
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_idx_to_run [as 别名]
def test_f_is_completed(self):
traj = Trajectory()
traj.f_add_parameter('test', 42)
traj.f_explore({'test':[1,2,3,4]})
self.assertFalse(traj.f_is_completed())
for run_name in traj.f_get_run_names():
self.assertFalse(traj.f_is_completed(run_name))
traj._run_information[traj.f_idx_to_run(1)]['completed']=1
self.assertFalse(traj.f_is_completed())
self.assertTrue(traj.f_is_completed(1))
for run_name in traj.f_get_run_names():
traj._run_information[run_name]['completed']=1
self.assertTrue(traj.f_is_completed())
for run_name in traj.f_get_run_names():
self.assertTrue(traj.f_is_completed(run_name))
示例2: TrajectoryTest
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_idx_to_run [as 别名]
#.........这里部分代码省略.........
# x= [x for x in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS')]
#
# for node in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS'):
# if not prev_node is None:
# if not prev_node.v_is_leaf and len(prev_node._children) > 0:
# self.assertTrue(node.v_name in prev_node._children)
#
# prev_node = node
#
# prev_node = None
#
# self.traj.v_iter_recursive=True
# self.traj.v_search_strategy='DFS'
#
# y = [y for y in self.traj]
#
# self.assertEqual(x,y)
#
# for node in self.traj:
# if not prev_node is None:
# if not prev_node.v_is_leaf and len(prev_node._children) > 0:
# self.assertTrue(node.v_name in prev_node._children)
#
# prev_node = node
def test_iter_bfs_as_run(self):
as_run = 1
self.traj.f_add_result('results.run_00000000.resulttest', 42)
self.traj.f_add_result('results.run_00000001.resulttest', 43)
self.traj.f_as_run(as_run)
depth_dict = self.get_depth_dict(self.traj, self.traj.f_idx_to_run(as_run))
depth_dict[0] =[]
prev_depth = 0
for node in self.traj.f_iter_nodes(recursive=True):
self.assertTrue('run_00000000' not in node.v_full_name)
if prev_depth != node.v_depth:
self.assertEqual(len(depth_dict[prev_depth]),0)
prev_depth = node.v_depth
depth_dict[node.v_depth].remove(node)
# def test_iter_dfs_as_run(self):
#
# self.traj.f_add_result('results.run_00000000.resulttest', 42)
# self.traj.f_add_result('results.run_00000001.resulttest', 43)
#
# self.traj.f_as_run('run_00000001')
#
# prev_node = None
#
# x= [x for x in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS')]
#
# for node in self.traj.f_iter_nodes(recursive=True, search_strategy='DFS'):
# self.assertTrue('run_00000000' not in node.v_full_name)
#
# if not prev_node is None:
# if not prev_node.v_is_leaf and len(prev_node._children) > 0:
# self.assertTrue(node.v_name in prev_node._children)
#
# prev_node = node