get_wcs_orientation

:mod:`giant.utilities.wcs

giant.utilities.wcs.get_wcs_orientation(input, boresight_pixel)[source]

This function converts an astropy WCS object into a GIANT Rotation object.

The conversion happens using astropy’s pixel_to_world method of the wcs object to define a 2 vector frame to account for various projections and coordinate systems used in astronomical imaging.

If you have a working wcs defined in a fits file you could do something like:

>>> from giant.utilities.wcs import get_wcs_orientation
>>> from astropy.io import fits
>>> from astropy.wcs
>>> with fits.open("my_file.fits") as fits_file:
...        wcs_l = WCS(fits_file[0])
>>> rotation = get_wcs_orientation(wcs_l)
>>> print(rotation)
Rotation([...])
Parameters:
  • input (WCS) – The astropy WCS object to be converted

  • boresight_pixel (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])

Returns:

A Rotation object representing the rotation from the inertial to the camera frame defined by the WCS

Return type:

Rotation