Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from sherpa.astro import xspec
- from sherpa.models.basic import PowLaw1D
- _hc = 6.6260693e-27 * 2.99792458e+18 / 1.60217653e-9
- elo = np.asarray([0.1, 0.2, 0.5, 0.6])
- ehi = np.asarray([0.2, 0.3, 0.6, 0.7])
- wlo = _hc / ehi
- whi = _hc / elo
- mdl1 = xspec.XSpowerlaw()
- mdl2 = PowLaw1D()
- ey1 = mdl1(elo, ehi)
- ey2 = mdl2(elo, ehi)
- wy1 = mdl1(wlo, whi)
- wy2 = mdl2(wlo, whi)
- if (ey1 != ey2).any():
- print("Energy difference")
- if np.abs(ey2 - wy2).max() > 1e-12:
- print("Wavelength difference")
- print("wy1: {}".format(wy1))
- print("wy2: {}".format(wy2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement