def pickle(self, filename=None): """Write the TOAs to a .pickle file with optional filename.""" if filename is not None: pickle.dump(self, open(filename, "wb")) elif self.filename is not None: pickle.dump(self, gzip.open(self.filename + ".pickle.gz", "wb")) else: log.warn("TOA pickle method needs a filename.")
def pickle(self, filename=None): """Write the TOAs to a .pickle file with optional filename.""" if filename is not None: pickle.dump(self, open(filename, "wb")) elif self.filename is not None: pickle.dump(self, gzip.open(self.filename+".pickle.gz", "wb")) else: log.warn("TOA pickle method needs a filename.")
def test_pickle(self, tmpdir): fn = str(tmpdir.join("{}.pickle".format(self.name))) with open(fn, "wb") as f: pickle.dump(self.potential, f) with open(fn, "rb") as f: p = pickle.load(f) p.energy(self.w0[:self.w0.size // 2])
def test_pickle(self, tmpdir): fn = str(tmpdir.join("{}.pickle".format(self.name))) with open(fn, "wb") as f: pickle.dump(self.potential, f) with open(fn, "rb") as f: p = pickle.load(f) p.value(self.w0[:self.w0.size//2])