Skip to content

Commit

Permalink
add test to read Poissonian uncertainties
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrigno committed Sep 5, 2024
1 parent 31d6566 commit ce397af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,14 @@ def model_gen(p):
# TODO: check that it all looks the same

plt.savefig("unf_png.png")

def test_read_poisson():
import ogip.spec
pha = ogip.spec.PHAI.from_file_name("tests/data/MOS1source_spectrum_150_rbn.pi")
from astropy.io import fits as pf
import numpy as np
ff = pf.open("tests/data/MOS1source_spectrum_150_rbn.pi")
counts = ff[1].data['COUNTS']

assert(np.abs(np.sum(counts - (pha._rate)*pha._exposure)) < 1e-12)
assert(np.sum(pha._rate*pha._exposure - (pha._stat_err*pha._exposure)**2))

0 comments on commit ce397af

Please sign in to comment.