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


Python Trajectory.im_new方法代码示例

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


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

示例1: print

# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import im_new [as 别名]
# because this is interpreted as a new parameter addition, so this fails:
try:
    traj.parameters.u = 2
    print('I won`t be reached')
except AttributeError as exc:
    print('Told you: `%s`' % repr(exc))
# See:
print('u=' + str(traj.par.u))

# But disabling the new adding method makes this work again
traj.v_lazy_adding = False
traj.f_get('u').f_unlock()
traj.parameters.u = 3
# now we simply change `u` to be 3

# There's also a lazy version to add new group nodes:
from pypet import new_group
traj.v_lazy_adding=True
traj.im_new = new_group
# And `im_new` is a new group node:
print(traj.im_new)


# Finally, there's one more thing. Using this notation we can also add links.
# Simply use the `=` assignment with objects that already exist in your trajectory:
traj.mylink = traj.f_get('x')
# now `mylink` links to parameter `x`, also fast access works:
print('Linking to x gives: ' + str(traj.mylink))


开发者ID:henribunting,项目名称:pypet,代码行数:30,代码来源:example_15_more_ways_to_add_data.py


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