def test_retrieve_ev_data(self): with pytest.warns(UserWarning): ev = retrieveData(data_type="EventList", dir_path=self.ev_path) gti = np.asarray([[self.ev.time[0], self.ev.time[-1]]]) assert np.allclose(ev.time, self.ev.time) assert np.allclose(ev.pi, self.ev.pi) assert np.allclose(ev.gti, gti, atol=0.001)
def test_retrieve_lc_offset_data(self): lc = retrieveData( data_type="Lightcurve", dir_path=self.lc_path, chunk_data=True, chunk_size=10**5, offset=10**2, raw=False, ) trunc_lc = self.lc.truncate(start=10**2, stop=10**5) assert trunc_lc.__eq__(lc) is True
def test_retrieve_ev_chunk_data(self): maxidx = 10**5 ev = retrieveData( data_type="EventList", dir_path=self.ev_path, chunk_data=True, chunk_size=maxidx, offset=0, raw=False, ) gti = np.asarray([[self.ev.time[0], self.ev.time[-1]]]) assert np.allclose(ev.time, self.ev.time[:maxidx]) assert np.allclose(ev.pi, self.ev.pi[:maxidx]) assert np.allclose(ev.gti, gti, atol=0.0001)
def test_retrieve_data_bad_offset(self): with pytest.raises(ValueError): _ = retrieveData(data_type="EventList", dir_path=self.ev_path, chunk_data=True, offset=101010101010)
def test_retrieve_lc_data(self): lc = retrieveData(data_type="Lightcurve", dir_path=self.lc_path) assert self.lc.__eq__(lc) is True
def test_retrieve_wrong_data(self): with pytest.raises(ValueError) as excinfo: retrieveData("A string", self.lc_path) assert "Invalid data: A string (str)" in str(excinfo.value)