コード例 #1
0
 def testapply_gtis(self):
     time = np.arange(150)
     count = np.zeros_like(time) + 3
     lc = Lightcurve(time, count, gti=[[-0.5, 150.5]])
     lc.gti = [[-0.5, 2.5], [12.5, 14.5]]
     lc.apply_gtis()
     assert lc.n == 5
     assert np.all(lc.time == np.array([0, 1, 2, 13, 14]))
     lc.gti = [[-0.5, 10.5]]
     lc.apply_gtis()
     assert np.all(lc.time == np.array([0, 1, 2]))
コード例 #2
0
    def test_rebin_with_gtis(self):
        times = np.arange(0, 100, 0.1)

        counts = np.random.normal(100, 0.1, size=times.shape[0])
        gti = [[0, 40], [60, 100]]

        good = create_gti_mask(times, gti)

        counts[np.logical_not(good)] = 0
        lc = Lightcurve(times, counts, gti=gti, skip_checks=True, dt=0.1)
        lc.apply_gtis()

        lc_rebin = lc.rebin(1.0)

        assert (lc_rebin.time[39] - lc_rebin.time[38]) > 1.0