def test_to_from_ogip_files_no_edisp(self, tmpdir): dataset = SpectrumDatasetOnOff( counts=self.on_counts, aeff=self.aeff, livetime=self.livetime, mask_safe=np.ones(self.on_counts.energy.nbin, dtype=bool), acceptance=1, obs_id="test", ) dataset.to_ogip_files(outdir=tmpdir, overwrite=True) filename = tmpdir / "pha_obstest.fits" newdataset = SpectrumDatasetOnOff.from_ogip_files(filename) assert_allclose(self.on_counts.data, newdataset.counts.data) assert newdataset.counts_off is None assert newdataset.edisp is None
def test_to_from_ogip_files_no_edisp(self, tmp_path): dataset = SpectrumDatasetOnOff( counts=self.on_counts, aeff=self.aeff, livetime=self.livetime, mask_safe=np.ones(self.on_counts.energy.nbin, dtype=bool), acceptance=1, name="test", ) dataset.to_ogip_files(outdir=tmp_path) newdataset = SpectrumDatasetOnOff.from_ogip_files(tmp_path / "pha_obstest.fits") assert_allclose(self.on_counts.data, newdataset.counts.data) assert newdataset.counts_off is None assert newdataset.edisp is None assert newdataset.gti is None
def test_to_from_ogip_files(self, tmp_path): dataset = SpectrumDatasetOnOff( counts=self.on_counts, counts_off=self.off_counts, aeff=self.aeff, edisp=self.edisp, livetime=self.livetime, mask_safe=np.ones(self.on_counts.energy.nbin, dtype=bool), acceptance=1, acceptance_off=10, name="test", gti=self.gti, ) dataset.to_ogip_files(outdir=tmp_path) newdataset = SpectrumDatasetOnOff.from_ogip_files(tmp_path / "pha_obstest.fits") assert_allclose(self.on_counts.data, newdataset.counts.data) assert_allclose(self.off_counts.data, newdataset.counts_off.data) assert_allclose(self.edisp.pdf_matrix, newdataset.edisp.pdf_matrix) assert_time_allclose(newdataset.gti.time_start, dataset.gti.time_start)