当前位置: 首页>>代码示例>>Python>>正文


Python Trajectory.f_explore方法代码示例

本文整理汇总了Python中pypet.trajectory.Trajectory.f_explore方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.f_explore方法的具体用法?Python Trajectory.f_explore怎么用?Python Trajectory.f_explore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypet.trajectory.Trajectory的用法示例。


在下文中一共展示了Trajectory.f_explore方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setUp

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [as 别名]
    def setUp(self):

        logging.basicConfig(level = logging.INFO)
        traj = Trajectory('Test')

        traj.v_storage_service = LazyStorageService()

        large_amount = 111

        for irun in range(large_amount):
            name = 'There.Are.Many.Parameters.Like.Me' + str(irun)

            traj.f_add_parameter(name, irun)


        traj.f_add_parameter('TestExplorer', 1)

        traj.v_fast_access=False
        traj.f_explore({traj.TestExplorer.v_full_name:[1,2,3,4,5]})
        traj.v_fast_access=True

        self.traj = traj
        self.n = 1
        self.single_run = self.traj._make_single_run(self.n)
        self.assertTrue(len(self.single_run)==1)
开发者ID:lsolanka,项目名称:pypet,代码行数:27,代码来源:trajectory_test.py

示例2: test_f_is_completed

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [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))
开发者ID:lsolanka,项目名称:pypet,代码行数:27,代码来源:trajectory_test.py

示例3: test_wildcard_search

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [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)
开发者ID:ilonajulczuk,项目名称:pypet,代码行数:40,代码来源:hdf5_storage_test.py

示例4: main

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [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()
开发者ID:ilonajulczuk,项目名称:pypet,代码行数:69,代码来源:test_mp_logging.py

示例5: TrajectoryMergeTest

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [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)
开发者ID:lsolanka,项目名称:pypet,代码行数:79,代码来源:trajectory_test.py

示例6: TrajectoryTest

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_explore [as 别名]
class TrajectoryTest(unittest.TestCase):


    def setUp(self):
        name = 'Moop'

        self.traj = Trajectory(name,dynamically_imported_classes=[ImAParameterInDisguise,
                                                'pypet.tests.test_helpers.ImAResultInDisguise'])

        self.assertTrue(self.traj.f_is_empty())

        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(PickleParameter,'SparseParam', sparsemat)

        self.traj.f_add_parameter('FloatParam')

        self.traj.f_add_derived_parameter(Parameter('FortyTwo', 42))

        self.traj.f_add_result(Result,'Im.A.Simple.Result',44444)

        self.traj.FloatParam=4.0


        self.explore_dict = {'FloatParam':[1.0,1.1,1.2,1.3]}

        self.traj.f_explore(self.explore_dict)

        self.assertTrue(len(self.traj) == 4)

        self.traj.f_add_parameter_group('peter.paul')

        self.traj.f_add_parameter('peter.markus.yve',6)

        self.traj.f_add_result('Test',42)

        self.traj.peter.f_add_parameter('paul.peter')

        self.traj.f_add_config('make.impossible.promises',1)

        with self.assertRaises(AttributeError):
            self.traj.markus.peter

        with self.assertRaises(ValueError):
            self.traj.f_add_parameter('Peter.  h ._hurz')

    def test_shrink(self):

        self.assertTrue(len(self.traj)>1)

        self.traj.f_shrink()

        self.assertTrue(len(self.traj)==1)

        self.assertTrue(len(self.traj.f_get_explored_parameters())==0)

    def test_get_all(self):
        all_nodes = self.traj.f_get_all('peter')

        self.assertTrue(len(all_nodes)==2)

        all_nodes = self.traj.f_get_all('peter.yve')

        self.assertTrue(len(all_nodes)==1)

        all_nodes = self.traj.f_get_all('paul.yve')

        self.assertTrue(len(all_nodes)==0)

        self.traj.f_add_parameter('paul.paul')

        all_nodes = self.traj.peter.f_get_all('paul')

        self.assertTrue(len(all_nodes)==1)

        self.traj.f_add_result('results.runs.run_00000000.x.y',10)

        self.traj.f_add_result('results.runs.run_00000001.x.y',10)

        self.traj.f_add_derived_parameter('hfhfhf.x.y')

        self.traj.f_add_result('x.y.y')

        self.traj.f_as_run(1)

        all_nodes=self.traj.f_get_all('x.y')

        self.assertTrue(len(all_nodes)==4)

    def test_backwards_search(self):

        x=self.traj.peter.f_get('paul.peter', backwards_search=False)

#.........这里部分代码省略.........
开发者ID:lsolanka,项目名称:pypet,代码行数:103,代码来源:trajectory_test.py


注:本文中的pypet.trajectory.Trajectory.f_explore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。