本文整理汇总了Python中pypet.trajectory.Trajectory.f_merge方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.f_merge方法的具体用法?Python Trajectory.f_merge怎么用?Python Trajectory.f_merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.trajectory.Trajectory
的用法示例。
在下文中一共展示了Trajectory.f_merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TrajectoryMergeTest
# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_merge [as 别名]
class TrajectoryMergeTest(unittest.TestCase):
def setUp(self):
name = 'Moop'
self.traj = Trajectory(name,[ImAParameterInDisguise])
comment = 'This is a comment'
self.traj.v_comment=comment
self.assertTrue(comment == self.traj.v_comment)
self.traj.f_add_parameter('IntParam',3)
sparsemat = spsp.csr_matrix((1000,1000))
sparsemat[1,2] = 17.777
#self.traj.f_add_parameter('SparseParam', sparsemat, param_type=PickleParameter)
self.traj.f_add_parameter('FloatParam')
self.traj.f_add_derived_parameter(Parameter('FortyTwo', 42))
self.traj.f_add_parameter('Trials',0)
self.traj.f_add_result(Result,'Im.A.Simple.Result',44444)
self.traj.FloatParam=4.0
self.traj.v_storage_service = LazyStorageService()
self.traj.f_explore({'FloatParam':[1.0,1.1,1.2,1.3],'Trials':[0,1,2,3]})
self.assertTrue(len(self.traj) == 4)
name2 = 'aaaaah'
self.traj2 = Trajectory(name2,[ImAParameterInDisguise])
comment = 'This is a comment'
self.traj2.v_comment=comment
self.assertTrue(comment == self.traj2.v_comment)
self.traj2.f_add_parameter('IntParam',3)
sparsemat = spsp.csr_matrix((1000,1000))
sparsemat[1,2] = 17.777
#self.traj2.f_add_parameter('SparseParam', sparsemat, param_type=PickleParameter)
self.traj2.f_add_parameter('Trials',0)
self.traj2.f_add_parameter('FloatParam')
self.traj2.f_add_derived_parameter(Parameter('FortyTwo', 42))
self.traj2.f_add_result(Result,'Im.A.Simple.Result',44444)
self.traj2.FloatParam=4.0
self.traj2.f_explore({'FloatParam':[42.0,43.0,1.2,1.3],'Trials':[0,1,2,3]})
self.traj2.v_storage_service = LazyStorageService()
self.assertTrue(len(self.traj2) == 4)
def test_merge_parameters_without_remove(self):
# remove_duplicates = True should be discarded by the trial parameter
self.traj._merge_parameters(self.traj2, trial_parameter_name='Trials',remove_duplicates=True)
def test_merge_parameters_with_remove(self):
self.traj._merge_parameters(self.traj2,remove_duplicates=True)
def test_merge_without_remove(self):
self.traj.f_merge(self.traj2, remove_duplicates=True,trial_parameter='Trials')
def test_merge_with_remove(self):
self.traj.f_merge(self.traj2, remove_duplicates=True)