本文整理汇总了Python中PyDSTool.filteredDict方法的典型用法代码示例。如果您正苦于以下问题:Python PyDSTool.filteredDict方法的具体用法?Python PyDSTool.filteredDict怎么用?Python PyDSTool.filteredDict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyDSTool
的用法示例。
在下文中一共展示了PyDSTool.filteredDict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make
# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import filteredDict [as 别名]
def make(self, dsargs):
# use cache if available
for gen_ver, prev_dsargs in self.used_dsargs.items():
if dst.filteredDict(dsargs, 'name', True) == dst.filteredDict(prev_dsargs,
'name', True):
# compare everything but the name, but check all up to final '_ver<X>'
parts1 = dsargs.name.split('_')
parts2 = prev_dsargs.name.split('_') # will have one more part
if parts1 == parts2[:-2]:
print("Reusing identical build")
return dst.loadObjects(os.path.join(self.cwd, 'models',
prev_dsargs.name+'.sav'))[0]
# no matches
return self.build(dsargs)
示例2: map_workspace
# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import filteredDict [as 别名]
def map_workspace(con, pts, *args):
"""
Returns a list of dictionaries, each representing the state of the
calc_context workspace for each of the points given. Optional
positional arguments will be passed first to the calc_context when
calling it.
This assumes the calc_context local_init accepts `pt` as an argument.
"""
wseq = []
for pt in pts:
con(*args, pt=pt)
wseq.append(dst.filteredDict(con.workspace.__dict__, ['_name'], neg=True))
return wseq
示例3: clip_to_pt
# 需要导入模块: import PyDSTool [as 别名]
# 或者: from PyDSTool import filteredDict [as 别名]
def clip_to_pt():
"""Extract clipboard point from gui to a dictionary"""
pt = dst.filteredDict(gui.capturedPts['Master'], ['V', 'm', 'n'])
return {'V': pt['V'], 'Na.m': pt['m'], 'K.n': pt['n']}