예제 #1
0
 def test_io_with_pickle(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write('lc.pickle', format_='pickle')
     lc.read('lc.pickle',format_='pickle')
     assert np.all(lc.time == self.times)
     assert np.all(lc.counts == self.counts)
     os.remove('lc.pickle')
예제 #2
0
 def test_io_with_pickle(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write('lc.pickle', format_='pickle')
     lc.read('lc.pickle', format_='pickle')
     assert np.all(lc.time == self.times)
     assert np.all(lc.counts == self.counts)
     assert np.all(lc.gti == self.gti)
     os.remove('lc.pickle')
예제 #3
0
 def test_io_with_pickle(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write("lc.pickle", format_="pickle")
     lc.read("lc.pickle", format_="pickle")
     assert np.all(lc.time == self.times)
     assert np.all(lc.counts == self.counts)
     assert np.all(lc.gti == self.gti)
     os.remove("lc.pickle")
예제 #4
0
    def test_io_with_hdf5(self):
        lc = Lightcurve(self.times, self.counts)
        lc.write('lc.hdf5', format_='hdf5')
        
        if _H5PY_INSTALLED:
            data = lc.read('lc.hdf5',format_='hdf5')
            assert np.all(data['time'] == self.times)
            assert np.all(data['counts'] == self.counts)
            os.remove('lc.hdf5')

        else:
            lc.read('lc.pickle',format_='pickle')
            assert np.all(lc.time == self.times)
            assert np.all(lc.counts == self.counts)
            os.remove('lc.pickle')
예제 #5
0
 def test_io_with_ascii(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write('ascii_lc.ecsv', format_='ascii')
     lc = lc.read('ascii_lc.ecsv', format_='ascii')
     assert np.allclose(lc.time, self.times)
     assert np.allclose(lc.counts, self.counts)
     os.remove('ascii_lc.ecsv')
예제 #6
0
    def test_io_with_hdf5(self):
        lc = Lightcurve(self.times, self.counts)
        lc.write('lc.hdf5', format_='hdf5')

        if _H5PY_INSTALLED:
            data = lc.read('lc.hdf5', format_='hdf5')
            assert np.all(data['time'] == self.times)
            assert np.all(data['counts'] == self.counts)
            assert np.all(data['gti'] == self.gti)
            os.remove('lc.hdf5')

        else:
            lc.read('lc.pickle', format_='pickle')
            assert np.all(lc.time == self.times)
            assert np.all(lc.counts == self.counts)
            assert np.all(lc.gti == self.gti)
            os.remove('lc.pickle')
예제 #7
0
    def test_io_with_hdf5(self):
        lc = Lightcurve(self.times, self.counts)
        lc.write("lc.hdf5", format_="hdf5")

        if _H5PY_INSTALLED:
            data = lc.read("lc.hdf5", format_="hdf5")
            assert np.all(data["time"] == self.times)
            assert np.all(data["counts"] == self.counts)
            assert np.all(data["gti"] == self.gti)
            os.remove("lc.hdf5")

        else:
            lc.read("lc.pickle", format_="pickle")
            assert np.all(lc.time == self.times)
            assert np.all(lc.counts == self.counts)
            assert np.all(lc.gti == self.gti)
            os.remove("lc.pickle")
예제 #8
0
 def test_read_from_lcurve_1(self):
     fname = 'lcurveA.fits'
     with pytest.warns(UserWarning):
         lc = Lightcurve.read(os.path.join(datadir, fname),
                              format_='hea',
                              skip_checks=True)
     ctrate = 1
     assert np.isclose(lc.countrate[0], ctrate)
예제 #9
0
    def test_io_with_hdf5(self):
        lc = Lightcurve(self.times, self.counts)
        lc.write('lc.hdf5', format_='hdf5')

        data = lc.read('lc.hdf5', format_='hdf5')
        assert np.allclose(data.time, self.times)
        assert np.allclose(data.counts, self.counts)
        assert np.allclose(data.gti, self.gti)
        os.remove('lc.hdf5')
예제 #10
0
    def test_read_from_lcurve_2(self):
        fname = 'lcurve_new.fits'
        with pytest.warns(UserWarning):
            lc = Lightcurve.read(os.path.join(datadir, fname),
                                 format_='hea',
                                 skip_checks=True)
        ctrate = 0.91

        assert np.isclose(lc.countrate[0], ctrate)
        assert np.isclose(lc.mjdref, 55197.00076601852)
예제 #11
0
 def test_io_with_ascii(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write('ascii_lc.txt', format_='ascii')
     lc.read('ascii_lc.txt', format_='ascii')
     os.remove('ascii_lc.txt')
예제 #12
0
 def test_io_with_ascii(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write('ascii_lc.txt', format_='ascii')
     lc.read('ascii_lc.txt', format_='ascii')
     os.remove('ascii_lc.txt')
예제 #13
0
 def test_io_with_ascii(self):
     lc = Lightcurve(self.times, self.counts)
     lc.write("ascii_lc.txt", format_="ascii")
     lc.read("ascii_lc.txt", format_="ascii")
     os.remove("ascii_lc.txt")