コード例 #1
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])
コード例 #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])
コード例 #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
コード例 #4
0
ファイル: toa.py プロジェクト: 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