當前位置: 首頁>>代碼示例>>Python>>正文


Python Trajectory._make_single_run方法代碼示例

本文整理匯總了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()
開發者ID:ilonajulczuk,項目名稱:pypet,代碼行數:69,代碼來源:test_mp_logging.py

示例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)))
開發者ID:lsolanka,項目名稱:pypet,代碼行數:104,代碼來源:trajectory_test.py


注:本文中的pypet.trajectory.Trajectory._make_single_run方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。