def make_test_rmf(): from gammapy.irf import gauss_energy_dispersion_matrix from gammapy.irf import np_to_rmf pdf_matrix = gauss_energy_dispersion_matrix(EBOUNDS) rmf = np_to_rmf(pdf_matrix, EBOUNDS, EBOUNDS, minprob=1e-6) filename = 'xspec_test_rmf.fits' logging.info('Writing {0}'.format(filename)) rmf.writeto(filename, clobber=True)
"""Plot energy dispersion example.""" import numpy as np import matplotlib.pyplot as plt from gammapy import irf ebounds = np.logspace(-1, 2, 100) pdf_matrix = irf.gauss_energy_dispersion_matrix(ebounds, sigma=0.2) energy_dispersion = irf.EnergyDispersion(pdf_matrix, ebounds) energy_dispersion.plot(type='matrix') plt.show()