Exemple #1
0
def test_hpxgeom_make_wcs():
    ax0 = np.linspace(0.0, 3.0, 4)

    hpx = HpxGeom(64, False, "galactic", region="DISK(110.,75.,2.)")
    wcs = hpx.to_wcs_geom()
    assert_allclose(wcs.wcs.wcs.crval, np.array([110.0, 75.0]))

    hpx = HpxGeom(64,
                  False,
                  "galactic",
                  region="DISK(110.,75.,2.)",
                  axes=[ax0])
    wcs = hpx.to_wcs_geom()
    assert_allclose(wcs.wcs.wcs.crval, np.array([110.0, 75.0]))
Exemple #2
0
def test_make_hpx_to_wcs_mapping():
    ax0 = np.linspace(0.0, 1.0, 3)
    hpx = HpxGeom(16, False, "galactic", region="DISK(110.,75.,2.)")
    # FIXME construct explicit WCS projection here
    wcs = hpx.to_wcs_geom()
    hpx2wcs = HpxToWcsMapping.create(hpx, wcs)
    assert_allclose(
        hpx2wcs.ipix,
        np.array([
            67,
            46,
            46,
            46,
            46,
            29,
            67,
            67,
            46,
            46,
            46,
            46,
            67,
            67,
            67,
            46,
            46,
            46,
            67,
            67,
            67,
            28,
            28,
            28,
            45,
            45,
            45,
            45,
            28,
            28,
            66,
            45,
            45,
            45,
            45,
            28,
        ]),
    )
    assert_allclose(
        hpx2wcs.mult_val,
        np.array([
            0.11111111,
            0.09090909,
            0.09090909,
            0.09090909,
            0.09090909,
            1.0,
            0.11111111,
            0.11111111,
            0.09090909,
            0.09090909,
            0.09090909,
            0.09090909,
            0.11111111,
            0.11111111,
            0.11111111,
            0.09090909,
            0.09090909,
            0.09090909,
            0.11111111,
            0.11111111,
            0.11111111,
            0.16666667,
            0.16666667,
            0.16666667,
            0.125,
            0.125,
            0.125,
            0.125,
            0.16666667,
            0.16666667,
            1.0,
            0.125,
            0.125,
            0.125,
            0.125,
            0.16666667,
        ]),
    )

    hpx = HpxGeom([8, 16],
                  False,
                  "galactic",
                  region="DISK(110.,75.,2.)",
                  axes=[ax0])
    hpx2wcs = HpxToWcsMapping.create(hpx, wcs)
    assert_allclose(
        hpx2wcs.ipix,
        np.array([
            [
                15,
                6,
                6,
                6,
                6,
                6,
                15,
                15,
                6,
                6,
                6,
                6,
                15,
                15,
                15,
                6,
                6,
                6,
                15,
                15,
                15,
                6,
                6,
                6,
                15,
                15,
                15,
                15,
                6,
                6,
                15,
                15,
                15,
                15,
                15,
                6,
            ],
            [
                67,
                46,
                46,
                46,
                46,
                29,
                67,
                67,
                46,
                46,
                46,
                46,
                67,
                67,
                67,
                46,
                46,
                46,
                67,
                67,
                67,
                28,
                28,
                28,
                45,
                45,
                45,
                45,
                28,
                28,
                66,
                45,
                45,
                45,
                45,
                28,
            ],
        ]),
    )