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


Python Trajectory.f_add_parameter_group方法代码示例

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


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

示例1: test_not_adding_pars_during_single_run

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

        traj._is_run = True

        with self.assertRaises(TypeError):
            traj.f_add_parameter('dd')

        with self.assertRaises(TypeError):
            traj.f_add_parameter_group('dd')

        with self.assertRaises(TypeError):
            traj.f_add_config('dd')

        with self.assertRaises(TypeError):
            traj.f_add_config_group('dd')
开发者ID:lsolanka,项目名称:pypet,代码行数:18,代码来源:trajectory_test.py

示例2:

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_add_parameter_group [as 别名]
# Or the get method
characters = traj.f_get('characters')

# Or square brackets
characters = traj['characters']

# Lets add another character
characters.f_add_parameter('luke_skywalker', 'Mark Hamill', comment='May the force be with you!')

#The full name of luke skywalker is now `parameters.starwars.characters.luke_skywalker`:
print 'The full name of the new Skywalker Parameter is %s' % \
      traj.f_get('luke_skywalker').v_full_name

#Lets see what happens if we have not unique entries:
traj.f_add_parameter_group('spaceballs.characters')

# Now our shortcuts no longer work, since we have two character groups!
try:
    traj.characters
except NotUniqueNodeError as e:
    print 'Damn it, there are two characters groups in the trajectory: %s' % e._msg

# But if we are more specific we have again a unique finding
characters = traj.starwars.characters

# Now let's see what fast access is:
print 'The name of the actor playing Luke is %s.' % traj.luke_skywalker

# And now what happens if you forbid it
traj.v_fast_access=False
开发者ID:ilonajulczuk,项目名称:pypet,代码行数:32,代码来源:example_02_trajectory_access_and_storage.py

示例3: TrajectoryTest

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import f_add_parameter_group [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_add_parameter_group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。