def databases(rtdata_module):
    """Create the necessary databases needed to run pointing code

    The SIAF database needs to be open explicitly and requires `pysiaf`.

    The engineering database is handled as a context.

    Returns
    -------
    siaf_db, metas : `set_telescope_pointing.SiafDb`, dict
        Returns the tuple of the siaf database and all exposures meta information.
    """
    with siafdb.SiafDb() as siaf_db:

        # Get the exposures' meta information
        metas_path = rtdata_module.get_data('pointing/jw00697013_metas.asdf')
        with asdf.open(metas_path) as metas_asdf:
            metas = metas_asdf['metas']

        # Setup the engineering database
        engdb_path = Path('engdb')
        engdb_path.mkdir()
        with pushdir(engdb_path):
            paths = rtdata_module.data_glob('pointing/jw00697013_engdb')
            for path in paths:
                rtdata_module.get_data(path)

        # Pass on the database info.
        with engdb_mock.EngDB_Mocker(db_path=engdb_path):
            yield siaf_db, metas
Esempio n. 2
0
def test_get_wcs(source, expected, use_pysiaf):
    """Test retrieval of wcs information."""
    if use_pysiaf:
        pytest.importorskip('pysiaf')

    with siafdb.SiafDb(source) as siaf_db:
        siaf = siaf_db.get_wcs('FGS1_FULL_OSS')
    assert siaf == expected
Esempio n. 3
0
def test_create(source, expected, use_pysiaf, jail_environ):
    """Test the the right objects are created"""
    if use_pysiaf:
        pytest.importorskip('pysiaf')

    if source == 'XML_DATA':
        os.environ['XML_DATA'] = str(Path(__file__).parent / 'data')
        source = None

    with siafdb.SiafDb(source) as siaf_db:
        assert isinstance(siaf_db._db, expected)
Esempio n. 4
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