Ejemplo n.º 1
0
def test_get_flux_point_missing_map(wcs_flux_map, reference_model):
    other_data = wcs_flux_map.copy()
    other_data.pop("norm_errn")
    other_data.pop("norm_errp")
    fluxmap = FluxMaps(other_data, reference_model)

    coord = SkyCoord(0., 0., unit="deg", frame="galactic")
    fp = fluxmap.get_flux_points(coord)

    assert_allclose(fp.table["e_min"], [0.1, 1.0])
    assert_allclose(fp.table["norm"], [1, 1])
    assert_allclose(fp.table["norm_err"], [0.1, 0.1])
    assert_allclose(fp.table["norm_ul"], [2, 2])
    assert "norm_errn" not in fp.table.columns
Ejemplo n.º 2
0
def test_get_flux_point_missing_map(wcs_flux_map, reference_model):
    other_data = wcs_flux_map.copy()
    other_data.pop("norm_errn")
    other_data.pop("norm_errp")
    fluxmap = FluxMaps(other_data, reference_model)

    coord = SkyCoord(0.0, 0.0, unit="deg", frame="galactic")
    table = fluxmap.get_flux_points(coord).to_table()
    assert_allclose(table["e_min"], [0.1, 1.0])
    assert_allclose(table["norm"], [1, 1])
    assert_allclose(table["norm_err"], [0.1, 0.1])
    assert_allclose(table["norm_ul"], [2, 2])
    assert "norm_errn" not in table.columns
    assert table["success"].data.dtype == np.dtype(np.bool)
Ejemplo n.º 3
0
def test_get_flux_point(wcs_flux_map, reference_model):
    fluxmap = FluxMaps(wcs_flux_map, reference_model)

    coord = SkyCoord(0., 0., unit="deg", frame="galactic")
    fp = fluxmap.get_flux_points(coord)

    assert_allclose(fp.table["e_min"], [0.1, 1.0])
    assert_allclose(fp.table["norm"], [1, 1])
    assert_allclose(fp.table["norm_err"], [0.1, 0.1])
    assert_allclose(fp.table["norm_errn"], [0.2, 0.2])
    assert_allclose(fp.table["norm_errp"], [0.2, 0.2])
    assert_allclose(fp.table["norm_ul"], [2, 2])
    assert_allclose(fp.table["sqrt_ts"], [1, 1])
    assert_allclose(fp.table["ts"], [0, 3])

    assert_allclose(fp.table["dnde"], [1e-11, 1e-13])
    assert fp.table["dnde"].unit == "cm-2s-1TeV-1"

    with mpl_plot_check():
        fp.plot()