Esempio n. 1
0
def make_t_pars(detector='any', fgsid_telem=1, fgsid_user=None):
    """Setup initial Transforms Parameters

    This set was derived from the first valid group of engineering parameters for exposure
    jw00624028002_02101_00001_nrca1 retrieved from the SDP regression tests for Build 7.7.1.

    Parameters
    ==========
    fgsid_telem : [1, 2]
        The FGS reference guider to report from telemetry.

    fgsid_user : [None, 1, 2]
        The user-specified FGS to use as the reference guider.
    """
    t_pars = stp.TransformParameters()

    t_pars.detector = detector
    t_pars.fgsid = fgsid_user

    t_pars.guide_star_wcs = stp.WCSRef(ra=241.24294932221,
                                       dec=70.66165389073196,
                                       pa=None)
    t_pars.pointing = stp.Pointing(
        q=np.array([-0.20954692, -0.6177655, -0.44653177, 0.61242575]),
        j2fgs_matrix=np.array([
            -9.77300013e-04, 3.38988895e-03, 9.99993777e-01, 9.99999522e-01,
            8.37175385e-09, 9.77305600e-04, 3.30458575e-06, 9.99994254e-01,
            -3.38988734e-03
        ]),
        fsmcorr=np.array([0.00584114, -0.00432878]),
        obstime=Time(1611628160.325, format='unix'),
        gs_commanded=np.array([-22.40031242, -8.17869377]),
        gs_position=np.array([-22.4002638, -8.1786461]),
        fgsid=fgsid_telem,
    )
    t_pars.siaf = siafdb.SIAF(v2_ref=120.525464,
                              v3_ref=-527.543132,
                              v3yangle=-0.5627898,
                              vparity=-1,
                              crpix1=1024.5,
                              crpix2=1024.5,
                              cdelt1=0.03113928,
                              cdelt2=0.03132232,
                              vertices_idl=(-32.1682, 32.0906, 31.6586,
                                            -31.7234, -32.1683, -32.1904,
                                            32.0823, 31.9456))
    t_pars.siaf_db = siafdb.SiafDb(siaf_path)

    return t_pars
Esempio n. 2
0
def row_to_pointing(r, siaf=None):
    """Convert a row of the spreadsheet to a Pointing

    Parameters
    ----------
    r: dict
        A row of pointing information

    siaf: SIAF
        SIAF info to use. If None, a non-transformative
        SIAF will be used.

    Returns
    -------
    Pointing, vinfo_expected
        A `Pointing` instance filled out.
        A `WCS` instance with the expected V1 information.
    """
    if siaf is None:
        siaf = stp.SIAF(v2_ref=0., v3_ref=0., v3yangle=0., vparity=1.)

    q = np.asarray([
        r['SA_ZATTEST1'],
        r['SA_ZATTEST2'],
        r['SA_ZATTEST3'],
        r['SA_ZATTEST4'],
    ])

    j2fgs_matrix = np.asarray([
        r['SA_ZRFGS2J11'], r['SA_ZRFGS2J21'], r['SA_ZRFGS2J31'],
        r['SA_ZRFGS2J12'], r['SA_ZRFGS2J22'], r['SA_ZRFGS2J32'],
        r['SA_ZRFGS2J13'], r['SA_ZRFGS2J23'], r['SA_ZRFGS2J33'],
    ])

    fsmcorr = np.asarray([
        r['SA_ZADUCMDX'], r['SA_ZADUCMDY']
    ])

    p = stp.Pointing(q=q, j2fgs_matrix=j2fgs_matrix, fsmcorr=fsmcorr)

    v = stp.WCSRef(ra=r['Vra'], dec=r['Vdec'], pa=r['V3PAatV1'])

    return p, v
Esempio n. 3
0
def test_override_calc_wcs():
    """Test matrix override in the full calculation"""
    t_pars = make_t_pars()
    t_pars.method = stp.Methods.OPS_TR_202111
    wcsinfo, vinfo, _ = stp.calc_wcs(t_pars)

    override = stp.Transforms(
        m_eci2j=np.array([[0.80583682, 0.51339893, 0.29503999],
                          [-0.56953229, 0.8083677, 0.14891175],
                          [-0.16204967, -0.28803339, 0.94380971]]))
    t_pars.override_transforms = override
    wcsinfo_new, vinfo_new, transforms_new = stp.calc_wcs(t_pars)

    assert vinfo_new != vinfo
    assert all(
        np.isclose(
            vinfo_new,
            stp.WCSRef(ra=32.50407337171124,
                       dec=17.161233048951043,
                       pa=352.28553015159287)))