def save(self, save_path=None): ''' Saves a model to either the model's file name, or specified path. ''' if save_path and not save_path == self.props.file_name: self.props.file_name = save_path path = self.props.file_name if not self.__handler: self.__handler = io.get_handler(path) if not self.__handler: raise TypeError, "unable to save file, unknown type: '%s'" % path self.__handler.write_model(self, path)
def load(self, model_path=None): ''' Load a model from the specified path, or the file_name property. ''' if model_path: self.props.file_name = model_path path = self.props.file_name self.__handler = io.get_handler(path) if not self.__handler: raise TypeError, "unable to load file, unknown type: '%s'" % path # get rid of any existing variables and structure self.__clean_model() self._disable_incremental() self.__handler.read_model(self, path) if not 'time' in self.__vars.keys(): self.new_var('time') self._enable_incremental()