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


Python Trajectory.v_fast_access方法代码示例

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


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

示例1: setUp

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_fast_access [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: str

# 需要导入模块: from pypet.trajectory import Trajectory [as 别名]
# 或者: from pypet.trajectory.Trajectory import v_fast_access [as 别名]
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
print 'The object found for luke_skywalker is `%s`.' % str(traj.luke_skywalker)

#Let's store the trajectory:
traj.f_store()

# That was easy, let's assume we already completed a simulation and now we add a veeeery large
# result that we want to store to disk immediately and than empty it
traj.f_add_result('starwars.gross_income_of_film', amount=10.1 ** 11, currency='$$$',
                  comment='George Lucas is rich, dude!')
# This is a large number, we better store it and than free the memory:
traj.f_store_item('gross_income_of_film')
traj.gross_income_of_film.f_empty()


# Now lets reload the trajectory
开发者ID:ilonajulczuk,项目名称:pypet,代码行数:33,代码来源:example_02_trajectory_access_and_storage.py


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