Exemplo n.º 1
0
    def test_table_roundtrip_ctrate(self):
        """Test that io methods raise Key Error when
        wrong format is provided.
        """
        N = len(self.times)
        dt = 0.5
        mean_counts = 2.0
        times = np.arange(0 + dt / 2, 5 - dt / 2, dt)
        countrate = np.zeros_like(times) + mean_counts
        err = np.zeros_like(times) + mean_counts / 2

        lc = Lightcurve(times,
                        countrate,
                        err=err,
                        mission="BUBU",
                        instr="BABA",
                        mjdref=53467.,
                        input_counts=False)

        ts = lc.to_astropy_table()
        new_lc = Lightcurve.from_astropy_table(ts)
        for attr in ['time', 'gti', 'countrate']:
            assert np.allclose(getattr(lc, attr), getattr(new_lc, attr))
        assert np.allclose(new_lc.counts, lc.countrate * lc.dt)
        for attr in ['mission', 'instr', 'mjdref']:
            assert getattr(lc, attr) == getattr(new_lc, attr)
Exemplo n.º 2
0
    def test_table_roundtrip(self):
        """Test that io methods raise Key Error when
        wrong format is provided.
        """
        N = len(self.times)
        lc = Lightcurve(self.times,
                        self.counts,
                        err=self.counts_err,
                        mission="BUBU",
                        instr="BABA",
                        mjdref=53467.)

        ts = lc.to_astropy_table()
        new_lc = lc.from_astropy_table(ts)
        for attr in ['time', 'gti', 'counts']:
            assert np.allclose(getattr(lc, attr), getattr(new_lc, attr))
        for attr in ['mission', 'instr', 'mjdref']:
            assert getattr(lc, attr) == getattr(new_lc, attr)