Skip to content

Commit

Permalink
test: update syntax for removed OGIP configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fjebaker committed May 8, 2024
1 parent 2d61b95 commit 147f5d1
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions test/datasets/test-ogip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ using SpectralFitting

@show testdir

xmm_config = StandardOGIPConfig(rmf_matrix_index = 2, rmf_energy_index = 3)
nustar_config = StandardOGIPConfig(rmf_matrix_index = 3, rmf_energy_index = 2)

xmm_rmf_path = joinpath(testdir, "xmm/pn.rmf")
nustar_rmf_path = joinpath(testdir, "nustar/nu60001047002A01_sr.rmf")

# test we can read in the different response matrices correctly
rmf_xmm = OGIP.read_rmf(xmm_rmf_path, xmm_config)
@inferred OGIP.read_rmf(xmm_rmf_path, xmm_config)
rmf_nustar = OGIP.read_rmf(nustar_rmf_path, nustar_config)
rmf_xmm = OGIP.read_rmf(xmm_rmf_path)
@inferred OGIP.read_rmf(xmm_rmf_path)
rmf_nustar = OGIP.read_rmf(nustar_rmf_path)

# make sure the correct number of values have been written in
@test count(!=(0), rmf_xmm.matrix) == 928061
Expand All @@ -22,9 +20,9 @@ rmf_nustar = OGIP.read_rmf(nustar_rmf_path, nustar_config)
xmm_arf_path = joinpath(testdir, "xmm/pn.arf")
nustar_arf_path = joinpath(testdir, "nustar/nu60001047002A01_sr.arf")

arf_xmm = OGIP.read_ancillary_response(xmm_arf_path, xmm_config)
@inferred OGIP.read_ancillary_response(xmm_arf_path, xmm_config)
arf_nustar = OGIP.read_ancillary_response(nustar_arf_path, nustar_config)
arf_xmm = OGIP.read_ancillary_response(xmm_arf_path)
@inferred OGIP.read_ancillary_response(xmm_arf_path)
arf_nustar = OGIP.read_ancillary_response(nustar_arf_path)

@test arf_xmm.bins_low rmf_xmm.bins_low atol = 1e-7
@test arf_nustar.bins_low rmf_nustar.bins_low atol = 1e-3
Expand All @@ -33,9 +31,9 @@ arf_nustar = OGIP.read_ancillary_response(nustar_arf_path, nustar_config)
xmm_spec_path = joinpath(testdir, "xmm/pn_spec_grp.fits")
nustar_spec_path = joinpath(testdir, "nustar/nu60001047002A01_sr_grp_simple.pha")

spec_xmm = OGIP.read_spectrum(xmm_spec_path, xmm_config)
@inferred OGIP.read_spectrum(xmm_spec_path, xmm_config)
spec_nustar = OGIP.read_spectrum(nustar_spec_path, nustar_config)
spec_xmm = OGIP.read_spectrum(xmm_spec_path)
@inferred OGIP.read_spectrum(xmm_spec_path)
spec_nustar = OGIP.read_spectrum(nustar_spec_path)

@test spec_xmm.telescope_name == "XMM"
@test spec_nustar.telescope_name == "NuSTAR"
Expand All @@ -45,11 +43,11 @@ xmm_backgroud_path = joinpath(testdir, "xmm/pn_bg_spec.fits")
nustar_background_path = joinpath(testdir, "nustar/nu60001047002A01_bk.pha")


bg_xmm = OGIP.read_background(xmm_backgroud_path, xmm_config)
bg_xmm = OGIP.read_background(xmm_backgroud_path)
@test length(bg_xmm.channels) == 4096

bg_nustar = OGIP.read_background(nustar_background_path, nustar_config)
@inferred OGIP.read_background(nustar_background_path, nustar_config)
bg_nustar = OGIP.read_background(nustar_background_path)
@inferred OGIP.read_background(nustar_background_path)
@test length(bg_xmm.channels) == 4096

# test reading the associated paths
Expand Down

0 comments on commit 147f5d1

Please sign in to comment.