WCS Correctors¶
This module provides support for manipulating tangent-plane corrections
of WCS
.
- Authors:
Mihai Cara
- License:
- class tweakwcs.correctors.FITSWCSCorrector(wcs, meta=None)[source]¶
A class for holding
FITS
WCS
information and for managing tangent-plane corrections. The units of the tangent plane of this corrector are same as detector coordinates.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.
- property bounding_box¶
Get the bounding box (if any) of the underlying image for which the original WCS is defined.
- det_to_world(x, y)[source]¶
Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.
- set_correction(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 theFITSWCSCorrector
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: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrector
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.
FITSWCSCorrector
ignores these arguments (except for storing them in themeta
attribute).
- units = 'pixel'¶
- class tweakwcs.correctors.JWSTWCSCorrector(wcs, wcsinfo, meta=None)[source]¶
A class for holding
JWST
gWCS
information and for managing tangent-plane corrections. The units of the tangent plane of this corrector arearcsec
and the axes are not along parallel to the axes of the detector’s coordinate system.- 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.
- property bounding_box¶
Get the bounding box (if any) of the underlying image for which the original WCS is defined.
- det_to_world(x, y)[source]¶
Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.
- property ref_angles¶
Return a
wcsinfo
-like dictionary of main WCS parameters.
- set_correction(matrix=[[1, 0], [0, 1]], shift=[0, 0], ref_tpwcs=None, meta=None, **kwargs)[source]¶
Sets a tangent-plane correction of the GWCS object according to the provided liniar parameters. In addition, this function updates the
meta
attribute of theJWSTWCSCorrector
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: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrector
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.
JWSTWCSCorrector
ignores these arguments (except for storing them in themeta
attribute).
- units = 'arcsec'¶
- class tweakwcs.correctors.WCSCorrector(wcs, meta=None)[source]¶
A class that provides common interface for manipulating WCS information and for managing tangent-plane 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.
- property bounding_box¶
Get the bounding box (if any) of the underlying image for which the original WCS is defined.
- abstract det_to_tanp(x, y)[source]¶
Convert detector (pixel) coordinates to tangent plane coordinates.
- abstract det_to_world(x, y)[source]¶
Convert pixel coordinates to sky coordinates using full (i.e., including distortions) transformations.
- property meta¶
- property original_wcs¶
Get original WCS object.
- abstract set_correction(matrix=[[1, 0], [0, 1]], shift=[0, 0], ref_tpwcs=None, meta=None, **kwargs)[source]¶
Sets a tangent-plane correction of the WCS object according to the provided liniar parameters. In addition, this function updates the
meta
attribute of theWCSCorrector
-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: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrector
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.
- property 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(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
X-coordinate of the pixel in the detector’s coordinate system near which pixel scale in the tangent plane needs to be estimated.
- y: int, float
Y-coordinate 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
.
- abstract tanp_to_det(x, y)[source]¶
Convert tangent plane coordinates to detector (pixel) coordinates.
- units = None¶
- property wcs¶
Get current WCS object.