Conventions and differences
Pixel origin
For every WCS, whatever format it was read from, the center of the first pixel is pixel 0. This matches Python GWCS and astropy's pixel_to_world/world_to_pixel (APE 14). It does not match Julia array indices, the FITS standard, or WCSLIB, which number the first pixel center 1.
- Julia array index
(i, j), withialong the first pixel axis, is GWCS pixel(i - 1, j - 1). A GWCS pixelpfalls in array indexround.(Int, p) .+ 1. - A FITS pixel
p(WCSLIB, DS9, SourceExtractorX_IMAGE) is GWCS pixelp .- 1.parse_fits_wcsapplies this shift itself, soCRPIXneeds no adjustment. - Pixels from Python GWCS, astropy's APE 14 interface, and photutils are already zero-based.
To pass and receive one-based pixels instead, give origin=1 to pixel_to_world, world_to_pixel, numerical_inverse, in_domain, in_image (for initial_guess), or grid_from_bounding_box (for fixed values and the grid). As with the origin argument of astropy.wcs's all_pix2world, it shifts every input axis by one and never shifts world coordinates or fill_value. Do not use it for a WCS with an input that is not an array position, such as a grism spectral order or a selector label.
Coordinates
- Coordinates are in transform order, the order of a transform's inputs and outputs. A frame stores its axes in its own order, and
axes_order[i]is the one-based transform position of its axisi; it labels coordinates and never reorders them. The axis accessors, bounding boxes,pixel_shape, andfix_inputsindices use transform order, while frame fields and constructor keywords use frame order. This is Python GWCS's convention. - Matrices hold one coordinate per column in the evaluation functions.
- A coordinate without a result gives
NaNin every component of a transform's output, andfill_valuefrompixel_to_worldandworld_to_pixel, which throw aDomainErrorinstead withstrict=true. Transforms never throw for such coordinates, except where a zero-dimensional result cannot carryNaN. - Labels are not coordinates. A label mapper returns a label or
nothingfor no match, so0and""remain ordinary labels. - Angles are in degrees. Angle parameters, such as rotation angles, projection parameters and reference points, and the coordinates the projections and celestial rotations take and return, are in degrees. Frames record each axis's unit but evaluation does not convert units; Python GWCS can carry astropy units through evaluation instead.
Deliberate differences from Python GWCS
- Region misses. A
RegionSelectorevaluates toNaNfor a coordinate in no region, so the evaluation functions report it as having no result. Python GWCS returns itsundefined_transform_value; GWCS.jl stores that value only for ASDF round trips. Pass the same number asfill_valueto reproduce Python's output. As in Python GWCS, an inverse selector does not inherit a custom undefined value. - Region-selector numerical inverse. Without an inverse label mapper,
world_to_pixelstarts Newton from the first branch inverse whose result lies in that branch's own region. Python GWCS starts from a fixed point that can fall in no region. - Linear polynomial distortions.
RemapAxes{2}((1, 2, 1, 2)) | (px & py)with polynomials of degree at most one becomes an exact affine with an analytical inverse; Python GWCS inverts it numerically. - Frame-to-frame evaluation.
GWCS.transformapplies no bounding box orfill_value, while Python'sWCS.transformapplies the bounding box by default. - Values, not objects.
pixel_to_worldandworld_to_pixeltake and return numbers, like Python'spixel_to_world_valuesandworld_to_pixel_values; Python'spixel_to_worldreturns astropy coordinate objects. - Immutable WCSs. Editing functions such as
set_transformreturn a new WCS, while Python GWCS changes its WCS in place. - FITS time axes are in seconds from the reference epoch, whatever
TIMEUNITthe header uses.
The Python equivalents page lists the Python counterpart of every name that has one.