def writeMod2PSC(self, mod, filename=None, directory=None, iValues=True, getstrbuf=False): """ Writes a PySCeS model object to a PSC file. - *filename*: writes <filename>.psc or <model_name>.psc if None - *directory*: (optional) an output directory - *iValues*: if True then the models initial values are used (or the current values if False). - *getstrbuf*: if True a StringIO buffer is returned instead of writing to disk """ self.core = NewCore(mod, iValues=iValues) assert self.core != None, "\nPlease set a PySCeS model or Core2 object" self.core2psc = CoreToPsc(self.core) if not iValues: self.core2psc.SPECIES_CURRENT_VALUE = True self.core2psc.FIXED_SPECIES_CURRENT_VALUE = True self.core2psc.PARAMETER_CURRENT_VALUE = True self.__buildPscComponents__() if filename == None: filename = self.core.name if filename[-4:] != '.psc': filename += '.psc' if not getstrbuf: self.core2psc.write(filename, directory, getstrbuf) else: return self.core2psc.write(filename, directory, getstrbuf)
def writeCore2PSC(self, filename=None, directory=None, getstrbuf=False): """ Writes a Core2 object to a PSC file. - *filename*: writes <filename>.xml or <model_name>.xml if None - *directory*: (optional) an output directory - *getstrbuf*: if True a StringIO buffer is returned instead of writing to disk """ assert self.core != None, "\nPlease set a PySCeS model or Core2 object" ## print 'Using existing self.core' self.core2psc = CoreToPsc(self.core) self.__buildPscComponents__() if filename == None: filename = self.core.name if filename[-4:] != '.psc': filename += '.psc' if not getstrbuf: self.core2psc.write(filename, directory, getstrbuf) else: return self.core2psc.write(filename, directory, getstrbuf)