當前位置: 首頁>>代碼示例>>Python>>正文


Python PyDSTool.loadObjects方法代碼示例

本文整理匯總了Python中PyDSTool.loadObjects方法的典型用法代碼示例。如果您正苦於以下問題:Python PyDSTool.loadObjects方法的具體用法?Python PyDSTool.loadObjects怎麽用?Python PyDSTool.loadObjects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyDSTool的用法示例。


在下文中一共展示了PyDSTool.loadObjects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import PyDSTool [as 別名]
# 或者: from PyDSTool import loadObjects [as 別名]
    def __init__(self, cwd, model_name, name_base, gen_type, gen_version=0):
        """
        Internal utility to manage versions of Generator objects within single
        session.

        cwd = current working directory (string)

        Option to set known gen version # to reuse:
        Version 0 means not yet created.
        Works across saved and restarted sessions
        """
        self.cwd = cwd
        self.model_name = model_name
        self.name_base = name_base
        self.gen_version = gen_version
        self.gen_type = gen_type
        # keyed by version
        self.used_dsargs = {}
        self.logfile = os.path.join(self.cwd, 'models', 'gen_dsargs_log.sav')
        if os.path.exists(self.logfile):
            # reload previous list of versions
            self.used_dsargs = dst.loadObjects(self.logfile)[0]
        self.classes = {'vode': dst.Generator.Vode_ODEsystem,
                        'dopri': dst.Generator.Dopri_ODEsystem,
                        'radau': dst.Generator.Radau_ODEsystem,
                        'euler': dst.Generator.Euler_ODEsystem}
        self.targetlang = self._targetlangs[gen_type]
開發者ID:Vibhor100,項目名稱:fovea,代碼行數:29,代碼來源:common.py

示例2: make

# 需要導入模塊: import PyDSTool [as 別名]
# 或者: from PyDSTool import loadObjects [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)
開發者ID:Vibhor100,項目名稱:fovea,代碼行數:16,代碼來源:common.py

示例3: load_gen

# 需要導入模塊: import PyDSTool [as 別名]
# 或者: from PyDSTool import loadObjects [as 別名]
 def load_gen(self, name):
     if self.gen_version == 0:
         raise ValueError("No current version known: set gen_version")
     return dst.loadObjects(os.path.join(self.cwd, 'models', name + '_' + \
                                         self.gen_type + \
                                         '_ver%i'%self.gen_version+'.sav'))[0]
開發者ID:Vibhor100,項目名稱:fovea,代碼行數:8,代碼來源:common.py


注:本文中的PyDSTool.loadObjects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。