def test_clarsach_rmf(self): arf_c = ARF(self.arffile) rmf_c = RMF(self.rmffile) m_arf_c = arf_c.apply_arf(self.m, self.exposure) m_rmf_c = rmf_c.apply_rmf(m_arf_c) assert np.allclose(self.sherpa_rmf, m_rmf_c)
def test_clarsach_rmf_with_matrix(self): arf_c = ARF(self.arffile) rmf_c = RMF(self.rmffile) m_arf_c = arf_c.specresp * self.m * self.exposure m_rmf_c = numpy.dot(m_arf_c, rmf_c.get_dense_matrix()) assert np.allclose(self.sherpa_rmf, m_rmf_c)
def setup_class(cls): cls.arffile = "data/arfs/aciss_heg1_cy19.garf" cls.sherpa_arf_file = "data/chandra_hetg_m_arf.txt" arf_list = fits.open(cls.arffile) cls.energ_lo = arf_list[1].data.field("ENERG_LO") cls.energ_hi = arf_list[1].data.field("ENERG_HI") cls.exposure = arf_list[1].header["EXPOSURE"] cls.specresp = arf_list[1].data.field("SPECRESP") arf_list.close() cls.pl = Powerlaw(norm=1.0, phoindex=2.0) cls.m = cls.pl.calculate(ener_lo=cls.energ_lo, ener_hi=cls.energ_hi) cls.arf_c = ARF(cls.arffile)
def _read_chandra(self, filename): this_dir = os.path.dirname(os.path.abspath(filename)) ff = fits.open(filename) data = ff[1].data hdr = ff[1].header self.bin_lo = data['BIN_LO'] self.bin_hi = data['BIN_HI'] self.bin_unit = data.columns['BIN_LO'].unit self.counts = data['COUNTS'] self.rmf_file = this_dir + "/" + hdr['RESPFILE'] self.arf_file = this_dir + "/" + hdr['ANCRFILE'] self.rmf = RMF(self.rmf_file) self.arf = ARF(self.arf_file) if "EXPOSURE" in list(hdr.keys()): self.exposure = hdr['EXPOSURE'] # seconds else: self.exposure = 1.0 ff.close() return
def test_clarsach_arf(self): arf_c = ARF(self.arffile) m_arf_c = arf_c.apply_arf(self.m) assert np.allclose(self.sherpa_arf, m_arf_c, rtol=1e-6, atol=1e-6)
def test_clarsach_arf(self): arf_c = ARF(self.arffile) m_arf_c = arf_c.apply_arf(self.m, exposure=self.exposure) assert np.allclose(self.sherpa_arf, m_arf_c)