def test_profile_content(): mapdataset_onoff = get_simple_dataset_on_off() wcs = mapdataset_onoff.counts.geom.wcs boxes = make_horizontal_boxes(wcs) prof_maker = ExcessProfileEstimator(boxes) imp_prof = prof_maker.run(mapdataset_onoff) # assert_allclose(imp_prof.table[7]['x_min'], -0.0562, atol=1e-4) # assert_allclose(imp_prof.table[7]['x_ref'], -0.0674, atol=1e-4) # assert_allclose(imp_prof.table[7]['counts'], [100., 100.], atol=1e-2) # assert_allclose(imp_prof.table[7]['excess'], [80., 80.], atol=1e-2) # assert_allclose(imp_prof.table[7]['sqrt_ts'], [7.6302447, 7.6302447], atol=1e-5) # assert_allclose(imp_prof.table[7]['errn'], [-10.747017, -10.747017], atol=1e-5) # assert_allclose(imp_prof.table[0]['ul'], [115.171871, 115.171871], atol=1e-5) # assert_allclose(imp_prof.table[0]['flux'], [7.99999987e-06, 8.00000010e-06], atol=1e-3) # assert_allclose(imp_prof.table[0]['solid_angle'], [6.853891e-07, 6.853891e-07], atol=1e-5) assert_allclose(imp_prof[7]['x_min'], 0.1462, atol=1e-4) assert_allclose(imp_prof[7]['x_ref'], 0.1575, atol=1e-4) assert_allclose(imp_prof[7]['counts'], [100., 100.], atol=1e-2) assert_allclose(imp_prof[7]['excess'], [80., 80.], atol=1e-2) assert_allclose(imp_prof[7]['sqrt_ts'], [7.6302447, 7.6302447], atol=1e-5) assert_allclose(imp_prof[7]['errn'], [-10.747017, -10.747017], atol=1e-5) assert_allclose(imp_prof[0]['ul'], [115.171871, 115.171871], atol=1e-5) assert_allclose(imp_prof[0]['flux'], [7.99999987e-06, 8.00000010e-06], atol=1e-3) assert_allclose(imp_prof[0]['solid_angle'], [6.853891e-07, 6.853891e-07], atol=1e-5)
def test_profile_content(): mapdataset_onoff = get_simple_dataset_on_off() wcs = mapdataset_onoff.counts.geom.wcs boxes = make_horizontal_boxes(wcs) prof_maker = ExcessProfileEstimator(boxes) imp_prof = prof_maker.run(mapdataset_onoff) assert_allclose(imp_prof[7]["x_min"], 0.1462, atol=1e-4) assert_allclose(imp_prof[7]["x_ref"], 0.1575, atol=1e-4) assert_allclose(imp_prof[7]["counts"], [100.0, 100.0], atol=1e-2) assert_allclose(imp_prof[7]["excess"], [80.0, 80.0], atol=1e-2) assert_allclose(imp_prof[7]["sqrt_ts"], [7.6302447, 7.6302447], atol=1e-5) assert_allclose(imp_prof[7]["errn"], [-10.747017, -10.747017], atol=1e-5) assert_allclose(imp_prof[0]["ul"], [115.171871, 115.171871], atol=1e-5) assert_allclose(imp_prof[0]["flux"], [7.99999987e-06, 8.00000010e-06], atol=1e-3) assert_allclose(imp_prof[0]["solid_angle"], [6.853891e-07, 6.853891e-07], atol=1e-5)
def test_radial_profile_one_interval(): dataset = get_simple_dataset_on_off() geom = dataset.counts.geom regions = make_concentric_annulus_sky_regions( center=geom.center_skydir, radius_max=0.2 * u.deg, ) prof_maker = ExcessProfileEstimator(regions, selection_optional="all") imp_prof = prof_maker.run(dataset) assert_allclose(imp_prof[7]["counts"], [1960], atol=1e-5) assert_allclose(imp_prof[7]["excess"], [1568.0], atol=1e-5) assert_allclose(imp_prof[7]["sqrt_ts"], [33.780533], atol=1e-5) assert_allclose(imp_prof[7]["errn"], [-48.278367], atol=1e-5) assert_allclose(imp_prof[0]["ul"], [134.285969], atol=1e-5) assert_allclose(imp_prof[0]["flux"], [16e-06], atol=1e-3) assert_allclose(imp_prof[0]["solid_angle"], [6.853891e-07], atol=1e-5)
def test_radial_profile(): dataset = get_simple_dataset_on_off() geom = dataset.counts.geom regions = make_concentric_annulus_sky_regions( center=geom.center_skydir, radius_max=0.2 * u.deg, ) prof_maker = ExcessProfileEstimator(regions) imp_prof = prof_maker.run(dataset) assert_allclose(imp_prof[7]["x_min"], 0.14, atol=1e-4) assert_allclose(imp_prof[7]["x_ref"], 0.15, atol=1e-4) assert_allclose(imp_prof[7]["counts"], [980.0, 980.0], atol=1e-2) assert_allclose(imp_prof[7]["excess"], [784.0, 784.0], atol=1e-2) assert_allclose(imp_prof[7]["sqrt_ts"], [23.886444, 23.886444], atol=1e-5) assert_allclose(imp_prof[7]["errn"], [-34.075141, -34.075141], atol=1e-5) assert_allclose(imp_prof[0]["ul"], [75.834983, 75.834983], atol=1e-5) assert_allclose(imp_prof[0]["flux"], [7.99999987e-06, 8.00000010e-06], atol=1e-3) assert_allclose(imp_prof[0]["solid_angle"], [6.853891e-07, 6.853891e-07], atol=1e-5)