Esempio n. 1
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])
Esempio n. 2
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])
Esempio n. 3
0
    def read_pickle_file(self, filename):
        """Read the TOAs from the pickle file specified in filename.  Note
        the filename should include any pickle-specific extensions (ie
        ".pickle.gz" or similar), these will not be added automatically."""

        log.info("Reading pickled TOAs from '%s'..." % filename)
        if os.path.splitext(filename)[1] == '.gz':
            infile = gzip.open(filename, 'rb')
        else:
            infile = open(filename, 'rb')
        tmp = pickle.load(infile)
        self.filename = tmp.filename
        if hasattr(tmp, 'toas'):
            self.toas = tmp.toas
        if hasattr(tmp, 'table'):
            self.table = tmp.table.group_by("obs")
        self.commands = tmp.commands
Esempio n. 4
0
File: toa.py Progetto: nanograv/PINT
    def read_pickle_file(self, filename):
        """Read the TOAs from the pickle file specified in filename.  Note
        the filename should include any pickle-specific extensions (ie
        ".pickle.gz" or similar), these will not be added automatically."""

        log.info("Reading pickled TOAs from '%s'..." % filename)
        if os.path.splitext(filename)[1] == '.gz':
            infile = gzip.open(filename,'rb')
        else:
            infile = open(filename,'rb')
        tmp = pickle.load(infile)
        self.filename = tmp.filename
        if hasattr(tmp, 'toas'):
            self.toas = tmp.toas
        if hasattr(tmp, 'table'):
            self.table = tmp.table.group_by("obs")
        self.commands = tmp.commands