def setUpClass(self): """Setup---here we essentially create the effective area. >>> file_path = os.path.join(XIMPOL_IRF,'fits','xipe_baseline.arf') >>> self.aeff = xEffectiveArea(file_path) """ file_path = os.path.join(XIMPOL_IRF,'fits','xipe_baseline.arf') self.aeff = xEffectiveArea(file_path) self.interactive = sys.flags.interactive
def get_spectrum(_energy, norm, index, aeff_file_path): """Power law assumed for the energy. Returns the array with the spectrum values in [KeV-1 cm-2 s-1] given an energy array. """ aeff_spline = xEffectiveArea(aeff_file_path) #getting the effective area as a function of E for given off-axis angle aeff_list = [] _aeff = aeff_spline.eval_(_energy,theta=0.) return _aeff*norm*numpy.power(_energy, -index)
def main(): """ """ import os from ximpol import XIMPOL_IRF from ximpol.irf.arf import xEffectiveArea def source_spectrum(E, t): """Function defining a time-dependent energy spectrum. """ return 10.0*(1.0 + numpy.cos(t))*numpy.power(E, (-2.0 + 0.01*t)) file_path = os.path.join(XIMPOL_IRF,'fits','xipe_baseline.arf') aeff = xEffectiveArea(file_path) t = numpy.linspace(0, 25, 100) c = xCountSpectrum(source_spectrum, aeff, t) c.light_curve.plot() c.plot()
def load_arf(irf_name, folder_path=None): """Facility to load the effective area for a given IRF set. """ file_path = irf_file_path(irf_name, 'arf', folder_path, check_file=True) return xEffectiveArea(file_path)