Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import numpy as np
  2.  
  3. from sherpa.astro import xspec
  4. from sherpa.models.basic import PowLaw1D
  5.  
  6. _hc = 6.6260693e-27 * 2.99792458e+18 / 1.60217653e-9
  7.  
  8. elo = np.asarray([0.1, 0.2, 0.5, 0.6])
  9. ehi = np.asarray([0.2, 0.3, 0.6, 0.7])
  10.  
  11. wlo = _hc / ehi
  12. whi = _hc / elo
  13.  
  14. mdl1 = xspec.XSpowerlaw()
  15. mdl2 = PowLaw1D()
  16.  
  17. ey1 = mdl1(elo, ehi)
  18. ey2 = mdl2(elo, ehi)
  19.  
  20. wy1 = mdl1(wlo, whi)
  21. wy2 = mdl2(wlo, whi)
  22.  
  23. if (ey1 != ey2).any():
  24. print("Energy difference")
  25.  
  26. if np.abs(ey2 - wy2).max() > 1e-12:
  27. print("Wavelength difference")
  28.  
  29. print("wy1: {}".format(wy1))
  30. print("wy2: {}".format(wy2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement