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

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

    hpx = HpxGeom(64, False, "GAL", region="DISK(110.,75.,2.)", axes=[ax0])
    wcs = hpx.make_wcs()
    assert_allclose(wcs.wcs.wcs.crval, np.array([110.0, 75.0]))
Beispiel #2
0
def test_make_hpx_to_wcs_mapping():
    ax0 = np.linspace(0.0, 1.0, 3)
    hpx = HpxGeom(16, False, "GAL", region="DISK(110.,75.,2.)")
    # FIXME construct explicit WCS projection here
    wcs = hpx.make_wcs()
    hpx2wcs = make_hpx_to_wcs_mapping(hpx, wcs)
    assert_allclose(
        hpx2wcs[0],
        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[1],
        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,
                  "GAL",
                  region="DISK(110.,75.,2.)",
                  axes=[ax0])
    hpx2wcs = make_hpx_to_wcs_mapping(hpx, wcs)
    assert_allclose(
        hpx2wcs[0],
        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,
            ],
        ]),
    )