tpwcs¶
This module provides support for manipulating tangentplane corrections
of WCS
.
Authors:  Mihai Cara 

License:  LICENSE 

class
tweakwcs.tpwcs.
TPWCS
(wcs, meta=None)[source]¶ A class that provides common interface for manipulating WCS information and for managing tangentplane corrections.
Parameters:  wcs: ``WCS object``
A
WCS
object supported by a child class. meta: dict, None, optional
Dictionary that will be merged to the object’s
meta
fields.

bounding_box
¶ Get the bounding box (if any) of the underlying image for which the original WCS is defined.

det_to_world
(self, x, y)[source]¶ Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.

meta
¶

original_wcs
¶ Get original WCS object.

set_correction
(self, matrix=[[1, 0], [0, 1]], shift=[0, 0], ref_tpwcs=None, meta=None, **kwargs)[source]¶ Sets a tangentplane correction of the WCS object according to the provided liniar parameters. In addition, this function updates the
meta
attribute of theTPWCS
derived object with the values of keyword arguments except for the argumentmeta
which is merged with the attributemeta
.Parameters:  matrix: list, numpy.ndarray, optional
A
2x2
array or list of lists coefficients representing scale, rotation, and/or skew transformations. shift: list, numpy.ndarray, optional
A list of two coordinate shifts to be applied to coordinates after
matrix
transformations are applied. ref_tpwcs: TPWCS, None, optional
A reference WCS of the type
TPWCS
that provides the tangent plane in which corrections (matrix
andshift
) were defined. When not provided (i.e., set toNone
), it is assumed that the transformations are being applied directly to this image WCS’ tangent plane. meta: dict, None, optional
Dictionary that will be merged to the object’s
meta
fields. **kwargs: optional parameters
Optional parameters for the WCS corrector.

tanp_center_pixel_scale
¶ Estimate pixel scale in the tangent plane near a location in the detector’s coordinate system corresponding to the origin of the tangent plane.
Returns:  pscale: float
Pixel scale [in units used in the tangent plane coordinate system] in the tangent plane near a location in the detector’s plane corresponding to the origin of the tangent plane.

tanp_pixel_scale
(self, x, y)[source]¶ Estimate pixel scale in the tangent plane near a location in the detector’s coordinate system given by parameters
x
andy
.Parameters:  x: int, float
Xcoordinate of the pixel in the detector’s coordinate system near which pixel scale in the tangent plane needs to be estimated.
 y: int, float
Ycoordinate of the pixel in the detector’s coordinate system near which pixel scale in the tangent plane needs to be estimated.
Returns:  pscale: float
Pixel scale [in units used in the tangent plane coordinate system] in the tangent plane near a location specified by detector coordinates
x
andy
.

wcs
¶ Get current WCS object.

class
tweakwcs.tpwcs.
JWSTgWCS
(wcs, wcsinfo, meta=None)[source]¶ A class for holding
JWST
gWCS
information and for managing tangentplane corrections.Parameters:  wcs: GWCS
A
GWCS
object. wcsinfo: dict
A dictionary containing reference angles of
JWST
instrument provided in thewcsinfo
property ofJWST
meta data.This dictionary must contain the following keys and values:
 ‘v2_ref’: float
V2 position of the reference point in arc seconds.
 ‘v3_ref’: float
V3 position of the reference point in arc seconds.
 ‘roll_ref’: float
Roll angle in degrees.
 meta: dict, None, optional
Dictionary that will be merged to the object’s
meta
fields.

bounding_box
¶ Get the bounding box (if any) of the underlying image for which the original WCS is defined.

det_to_world
(self, x, y)[source]¶ Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.

ref_angles
¶ Return a
wcsinfo
like dictionary of main WCS parameters.

set_correction
(self, matrix=[[1, 0], [0, 1]], shift=[0, 0], ref_tpwcs=None, meta=None, **kwargs)[source]¶ Sets a tangentplane correction of the GWCS object according to the provided liniar parameters. In addition, this function updates the
meta
attribute of theJWSTgWCS
object with the values of keyword arguments except for the argumentmeta
which is merged with the attributemeta
.Parameters:  matrix: list, numpy.ndarray
A
2x2
array or list of lists coefficients representing scale, rotation, and/or skew transformations. shift: list, numpy.ndarray
A list of two coordinate shifts to be applied to coordinates after
matrix
transformations are applied. ref_tpwcs: TPWCS, None, optional
A reference WCS of the type
TPWCS
that provides the tangent plane in which corrections (matrix
andshift
) were defined. When not provided (i.e., set toNone
), it is assumed that the transformations are being applied directly to this image WCS’ tangent plane. meta: dict, None, optional
Dictionary that will be merged to the object’s
meta
fields. **kwargs: optional parameters
Optional parameters for the WCS corrector.
JWSTgWCS
ignores these arguments (except for storing them in themeta
attribute).

class
tweakwcs.tpwcs.
FITSWCS
(wcs, meta=None)[source]¶ A class for holding
FITS
WCS
information and for managing tangentplane corrections.Note
Currently only WCS objects that have
CPDIS
,DET2IM
, andSIP
distortions before the application of theCD
orPC
matrix are supported.Parameters:  wcs: astropy.wcs.WCS
An
astropy.wcs.WCS
object.

bounding_box
¶ Get the bounding box (if any) of the underlying image for which the original WCS is defined.

det_to_world
(self, x, y)[source]¶ Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.

set_correction
(self, matrix=[[1, 0], [0, 1]], shift=[0, 0], ref_tpwcs=None, meta=None, **kwargs)[source]¶ Computes a corrected (aligned) wcs based on the provided linear transformation. In addition, this function updates the
meta
attribute of theFITSWCS
object with the the values of keyword arguments except for the argumentmeta
which is merged with the attributemeta
.Parameters:  matrix: list, numpy.ndarray
A
2x2
array or list of lists coefficients representing scale, rotation, and/or skew transformations. shift: list, numpy.ndarray
A list of two coordinate shifts to be applied to coordinates after
matrix
transformations are applied. ref_tpwcs: TPWCS, None, optional
A reference WCS of the type
TPWCS
that provides the tangent plane in which corrections (matrix
andshift
) were defined. When not provided (i.e., set toNone
), it is assumed that the transformations are being applied directly to this image WCS’ tangent plane. meta: dict, None, optional
Dictionary that will be merged to the object’s
meta
fields. **kwargs: optional parameters
Optional parameters for the WCS corrector.
FITSWCS
ignores these arguments (except for storing them in themeta
attribute).