本文整理汇总了Python中pypet.Trajectory.f_contains方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.f_contains方法的具体用法?Python Trajectory.f_contains怎么用?Python Trajectory.f_contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.Trajectory
的用法示例。
在下文中一共展示了Trajectory.f_contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_backwards_compatibility
# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import f_contains [as 别名]
def test_backwards_compatibility(self):
# Test only makes sense with python 2.7 or lower
old_pypet_traj = Trajectory()
module_path, init_file = os.path.split(pypet.__file__)
filename= os.path.join(module_path, 'tests','testdata','pypet_v0_1b_6.hdf5')
old_pypet_traj.f_load(index=-1, load_data=2, force=True, filename=filename)
self.assertTrue(old_pypet_traj.v_version=='0.1b.6')
self.assertTrue(old_pypet_traj.par.x==0)
self.assertTrue(len(old_pypet_traj)==9)
self.assertTrue(old_pypet_traj.res.runs.r_4.z==12)
nexplored = len(old_pypet_traj._explored_parameters)
self.assertGreater(nexplored, 0)
for param in old_pypet_traj.f_get_explored_parameters():
self.assertTrue(old_pypet_traj.f_contains(param))
示例2: test_not_getting_links
# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import f_contains [as 别名]
def test_not_getting_links(self):
traj = Trajectory()
traj.f_add_parameter_group('test.test3')
traj.f_add_parameter_group('test2')
traj.test.f_add_link('circle1' , traj.test2)
traj.test2.f_add_link('circle2' , traj.test)
self.assertTrue(traj.test.circle1 is traj.test2)
traj.v_with_links = False
with self.assertRaises(AttributeError):
traj.test.circle1
found = False
for item in traj.test.f_iter_nodes(recursive=True, with_links=True):
if item is traj.test2:
found=True
self.assertTrue(found)
for item in traj.test.f_iter_nodes(recursive=True, with_links=False):
if item is traj.test2:
self.assertTrue(False)
traj.v_with_links=True
self.assertTrue('circle1' in traj)
self.assertFalse(traj.f_contains('circle1', with_links=False))
self.assertTrue('circle1' in traj.test)
self.assertFalse(traj.test.f_contains('circle1', with_links=False))
self.assertTrue(traj.test2.test3 is traj.par.test.test3)
traj.v_with_links = False
with self.assertRaises(AttributeError):
traj.test2.test3
traj.v_with_links = True
self.assertTrue(traj['test2.test3'] is traj.test3)
with self.assertRaises(AttributeError):
traj.f_get('test2.test3', with_links=False)