本文整理汇总了Python中pypet.Trajectory.i_am_new方法的典型用法代码示例。如果您正苦于以下问题:Python Trajectory.i_am_new方法的具体用法?Python Trajectory.i_am_new怎么用?Python Trajectory.i_am_new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypet.Trajectory
的用法示例。
在下文中一共展示了Trajectory.i_am_new方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pypet import Trajectory [as 别名]
# 或者: from pypet.Trajectory import i_am_new [as 别名]
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.i_am_new = new_group
# And `im_new` is a new group node:
print(traj.i_am_new)
# Moreover, if lazy adding is turned on, you can create missing groups on the fly
# with the square bracket notation:
traj['i_am_also.new.param'] = 42
print(traj.i_am_also.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))