Exemplo n.º 1
0
    def test_split_with_three_segments(self):
        test_time = np.array([1, 2, 3, 6, 7, 8, 10, 11, 12])
        test_counts = np.random.rand(len(test_time))
        lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert len(slc) == 3
Exemplo n.º 2
0
    def test_split_with_three_segments(self):
        test_time = np.array([1, 2, 3, 6, 7, 8, 10, 11, 12])
        test_counts = np.random.rand(len(test_time))
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=UserWarning)
            lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert len(slc) == 3
Exemplo n.º 3
0
    def test_consecutive_gaps(self):
        test_time = np.array([1, 2, 3, 6, 9, 10, 11])
        test_counts = np.random.rand(len(test_time))
        lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert np.all((slc[0].time == [1, 2, 3]))
        assert np.all((slc[1].time == [9, 10, 11]))
        assert np.all((slc[0].counts == test_counts[:3]))
        assert np.all((slc[1].counts == test_counts[4:]))
Exemplo n.º 4
0
    def test_split_has_correct_data_points(self):
        test_time = np.array([1, 2, 3, 6, 7, 8])
        test_counts = np.random.rand(len(test_time))
        lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert np.all((slc[0].time == [1, 2, 3]))
        assert np.all((slc[1].time == [6, 7, 8]))
        assert np.all((slc[0].counts == test_counts[:3]))
        assert np.all((slc[1].counts == test_counts[3:]))
Exemplo n.º 5
0
    def test_split_with_gtis(self):
        test_time = np.array([1, 2, 3, 6, 7, 8, 10, 11, 12])
        test_counts = np.random.rand(len(test_time))
        gti = [[0, 4], [9, 13]]
        lc_test = Lightcurve(test_time, test_counts, gti=gti)
        slc = lc_test.split(1.5)

        assert np.all((slc[0].time == [1, 2, 3]))
        assert np.all((slc[1].time == [10, 11, 12]))
        assert np.all((slc[0].counts == test_counts[:3]))
        assert np.all((slc[1].counts == test_counts[6:]))
Exemplo n.º 6
0
    def test_consecutive_gaps(self):
        test_time = np.array([1, 2, 3, 6, 9, 10, 11])
        test_counts = np.random.rand(len(test_time))
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=UserWarning)
            lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert np.allclose(slc[0].time, [1, 2, 3])
        assert np.allclose(slc[1].time, [9, 10, 11])
        assert np.allclose(slc[0].counts, test_counts[:3])
        assert np.allclose(slc[1].counts, test_counts[4:])
Exemplo n.º 7
0
    def test_split_has_correct_data_points(self):
        test_time = np.array([1, 2, 3, 6, 7, 8])
        test_counts = np.random.rand(len(test_time))
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", category=UserWarning)
            lc_test = Lightcurve(test_time, test_counts)
        slc = lc_test.split(1.5)

        assert np.allclose(slc[0].time, [1, 2, 3])
        assert np.allclose(slc[1].time, [6, 7, 8])
        assert np.allclose(slc[0].counts, test_counts[:3])
        assert np.allclose(slc[1].counts, test_counts[3:])