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
FITSWCSinformation 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, andSIPdistortions before the application of theCDorPCmatrix are supported.- Parameters:
- wcs: astropy.wcs.WCS
An
astropy.wcs.WCSobject.
- 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
metaattribute of theFITSWCSCorrectorobject with the the values of keyword arguments except for the argumentmetawhich is merged with the attributemeta.- Parameters:
- matrix: list, numpy.ndarray
A
2x2array 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
matrixtransformations are applied.- ref_tpwcs: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrectorthat provides the tangent plane in which corrections (matrixandshift) 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
metafields.- **kwargs: optional parameters
Optional parameters for the WCS corrector.
FITSWCSCorrectorignores these arguments (except for storing them in themetaattribute).
- units = 'pixel'¶
- class tweakwcs.correctors.JWSTWCSCorrector(wcs, wcsinfo, meta=None)[source]¶
A class for holding
JWSTgWCSinformation and for managing tangent-plane corrections. The units of the tangent plane of this corrector arearcsecand the axes are not along parallel to the axes of the detector’s coordinate system.- Parameters:
- wcs: GWCS
A
GWCSobject.- wcsinfo: dict
A dictionary containing reference angles of
JWSTinstrument provided in thewcsinfoproperty ofJWSTmeta 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
metafields.
- 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
metaattribute of theJWSTWCSCorrectorobject with the values of keyword arguments except for the argumentmetawhich is merged with the attributemeta.- Parameters:
- matrix: list, numpy.ndarray
A
2x2array 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
matrixtransformations are applied.- ref_tpwcs: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrectorthat provides the tangent plane in which corrections (matrixandshift) 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
metafields.- **kwargs: optional parameters
Optional parameters for the WCS corrector.
JWSTWCSCorrectorignores these arguments (except for storing them in themetaattribute).
- 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
WCSobject supported by a child class.- meta: dict, None, optional
Dictionary that will be merged to the object’s
metafields.
- 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
metaattribute of theWCSCorrector-derived object with the values of keyword arguments except for the argumentmetawhich is merged with the attributemeta.- Parameters:
- matrix: list, numpy.ndarray, optional
A
2x2array 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
matrixtransformations are applied.- ref_tpwcs: WCSCorrector, None, optional
A reference WCS of the type
WCSCorrectorthat provides the tangent plane in which corrections (matrixandshift) 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
metafields.- **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
xandy.- 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
xandy.
- abstract tanp_to_det(x, y)[source]¶
Convert tangent plane coordinates to detector (pixel) coordinates.
- units = None¶
- property wcs¶
Get current WCS object.