Exemple #1
0
 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.")
Exemple #2
0
 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.")
Exemple #3
0
    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])
Exemple #4
0
    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])