コード例 #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.")
コード例 #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.")
コード例 #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])
コード例 #4
0
ファイル: helpers.py プロジェクト: adrn/gary-old
    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])