add_wcs

jwst.lib.set_telescope_pointing.add_wcs(filename, allow_any_file=False, force_level1bmodel=False, default_pa_v3=0.0, siaf_path=None, prd=None, engdb_url=None, fgsid=None, tolerance=60, allow_default=False, reduce_func=None, dry_run=False, save_transforms=None, **transform_kwargs)[source]

Add WCS information to a JWST DataModel.

Telescope orientation is attempted to be obtained from the engineering database. Failing that, a default pointing is used based on proposal target.

The file is updated in-place.

Parameters:
filenamestr

The path to a data file.

allow_any_filebool

Attempt to add the WCS information to any type of file. The default, False, only allows modifications of files that contain known datamodels of Level1bmodel, ImageModel, or CubeModel.

force_level1bmodelbool

If not allow_any_file, and the input file model is unknown, open the input file as a Level1bModel regardless.

default_pa_v3float

The V3 position angle to use if the pointing information is not found.

siaf_pathstr or file-like object or None

The path to the SIAF database. See SiafDb for more information.

prdstr

The PRD version from the pysiaf to use. siaf_path overrides this value.

engdb_urlstr or None

URL of the engineering telemetry database REST interface.

fgsidint or None

When in COARSE mode, the FGS to use as the guider reference. If None, use what is provided in telemetry.

toleranceint

If no telemetry can be found during the observation, the time, in seconds, beyond the observation time to search for telemetry.

allow_defaultbool

If telemetry cannot be determine, use existing information in the observation’s header.

reduce_funcfunc or None

Reduction function to use on values.

dry_runbool

Do not write out the modified file.

save_transformsPath-like or None

File to save the calculated transforms to.

**transform_kwargsdict

Keyword arguments used by matrix calculation routines.

Notes

This function adds absolute pointing information to the JWST datamodels provided. By default, only Stage 1 and Stage 2a exposures are allowed to be updated. These have the suffixes of “uncal”, “rate”, and “rateints” representing datamodels Level1bModel, ImageModel, and CubeModel. Any higher level product, from Stage 2b and beyond, that has had the assign_wcs step applied, have improved WCS information. Running this task on such files will potentially corrupt the WCS.

It starts by populating the headers with values from the SIAF database. It adds the following keywords to all files:

  • V2_REF (arcseconds)

  • V3_REF (arcseconds)

  • VPARITY (+1 or -1)

  • V3I_YANG (decimal degrees)

The keywords computed and added to all files are:

  • RA_V1

  • DEC_V1

  • PA_V3

  • RA_REF

  • DEC_REF

  • ROLL_REF

  • S_REGION

In addition the following keywords are computed and added to IMAGING_MODES only:

  • CRVAL1

  • CRVAL2

  • PC1_1

  • PC1_2

  • PC2_1

  • PC2_2

It does not currently place the new keywords in any particular location in the header other than what is required by the standard.