SkyProjection#

final class lsst.images.SkyProjection(pixel_to_sky, fits_approximation=None)#

Bases: Generic

A transform from pixel coordinates to sky coordinates.

Parameters:
  • pixel_to_sky (Transform[TypeVar(F, bound= Frame), SkyFrame]) – A low-level transform that maps pixel coordinates to sky coordinates.

  • fits_approximation (Optional[Transform[TypeVar(F, bound= Frame), SkyFrame]], default: None) – An approximation to pixel_to_sky that is guaranteed to have a as_fits_wcs method that does not return None. This should not be provided if pixel_to_sky is itself representable as a FITS WCS.

Notes

Transform is conceptually immutable (the internal AST Mapping should never be modified in-place after construction), and hence does not need to be copied when any object that holds it is copied.

Attributes Summary

fits_approximation

An approximation to this projection that is guaranteed to have an as_fits_wcs method that does not return None.

pixel_bounds

The region that bounds valid pixel points (Bounds | None).

pixel_frame

Coordinate frame for the pixel grid.

pixel_to_sky_transform

Low-level transform from pixel to sky coordinates (Transform).

sky_frame

Coordinate frame for the sky.

sky_to_pixel_transform

Low-level transform from sky to pixel coordinates (Transform).

Methods Summary

as_astropy([bbox])

Return an astropy.wcs view of this SkyProjection.

as_fits_wcs(bbox[, allow_approximation])

Return a FITS WCS representation of this projection, if possible.

from_ast_frame_set(ast_frame_set, pixel_frame)

Construct a sky projection from an AST FrameSet.

from_fits_wcs(fits_wcs, pixel_frame[, ...])

Construct a transform from a FITS WCS.

from_legacy(sky_wcs, pixel_frame[, pixel_bounds])

Construct a transform from a legacy lsst.afw.geom.SkyWcs.

pixel_to_sky([point, x, y])

Transform one or more pixel points to sky coordinates.

serialize(archive, *[, use_frame_sets])

Serialize a projection to an archive.

show([simplified, comments])

Return the AST native representation of the transform.

sky_to_pixel(sky)

Transform one or more sky coordinates to pixels.

to_legacy()

Convert to a legacy lsst.afw.geom.SkyWcs instance.

Attributes Documentation

fits_approximation#

An approximation to this projection that is guaranteed to have an as_fits_wcs method that does not return None.

pixel_bounds#

The region that bounds valid pixel points (Bounds | None).

pixel_frame#

Coordinate frame for the pixel grid.

pixel_to_sky_transform#

Low-level transform from pixel to sky coordinates (Transform).

sky_frame#

Coordinate frame for the sky.

sky_to_pixel_transform#

Low-level transform from sky to pixel coordinates (Transform).

Methods Documentation

as_astropy(bbox=None)#

Return an astropy.wcs view of this SkyProjection.

Parameters:

bbox (Box | None, default: None) – Bounding box of the array the view will describe. This projection object is assumed to work on the same coordinate system in which bbox is defined, while the Astropy view will consider the first row and column in that box to be (0, 0).

Return type:

SkyProjectionAstropyView

Notes

This returns an object that satisfies the astropy.wcs.wcsapi.BaseHighLevelWCS and astropy.wcs.wcsapi.BaseLowLevelWCS interfaces while evaluating the underlying SkyProjection itself. It is not an astropy.wcs.WCS instance, which is a type that also satisfies those interfaces but only supports FITS WCS representations (see as_fits_wcs).

as_fits_wcs(bbox, allow_approximation=False)#

Return a FITS WCS representation of this projection, if possible.

Parameters:
  • bbox (Box) – Bounding box of the array the FITS WCS will describe. This transform object is assumed to work on the same coordinate system in which bbox is defined, while the FITS WCS will consider the first row and column in that box to be (0, 0) (in Astropy interfaces) or (1, 1) (in the FITS representation itself).

  • allow_approximation (bool, default: False) – If True and this SkyProjection holds a FITS approximation to itself, return that approximation.

Return type:

WCS | None

static from_ast_frame_set(ast_frame_set, pixel_frame, pixel_bounds=None)#

Construct a sky projection from an AST FrameSet.

The current frame of the FrameSet must be an AST SkyFrame. Its coordinate system is forced to ICRS (AST adjusts the mapping automatically) so the resulting Projection is always in ICRS regardless of the original sky system.

Parameters:
  • ast_frame_set (FrameSet) – An AST FrameSet whose base frame is pixel coordinates and whose current frame is a SkyFrame (in any supported sky coordinate system).

  • pixel_frame (TypeVar(F, bound= Frame)) – Coordinate frame for the pixel grid.

  • pixel_bounds (Bounds | None, default: None) – The region that bounds valid pixels for this transform.

Raises:

ValueError – If the current frame of the FrameSet is not a SkyFrame.

Return type:

SkyProjection[TypeVar(F, bound= Frame)]

static from_fits_wcs(fits_wcs, pixel_frame, pixel_bounds=None, x0=0, y0=0)#

Construct a transform from a FITS WCS.

Parameters:
  • fits_wcs (WCS) – FITS WCS to convert.

  • pixel_frame (TypeVar(F, bound= Frame)) – Coordinate frame for the pixel grid.

  • pixel_bounds (Bounds | None, default: None) – The region that bounds valid pixels for this transform.

  • x0 (int, default: 0) – Logical coordinate of the first column in the array this WCS relates to world coordinates.

  • y0 (int, default: 0) – Logical coordinate of the first column in the array this WCS relates to world coordinates.

Return type:

SkyProjection[TypeVar(F, bound= Frame)]

Notes

The x0 and y0 parameters reflect the fact that for FITS, the first row and column are always labeled (1, 1), while in Astropy and most other Python libraries, they are (0, 0). The types in this package (e.g. Image, Mask) allow them to be any pair of integers.

static from_legacy(sky_wcs, pixel_frame, pixel_bounds=None)#

Construct a transform from a legacy lsst.afw.geom.SkyWcs.

Parameters:
  • sky_wcs (lsst.afw.geom.SkyWcs) – Legacy WCS object.

  • pixel_frame (TypeVar(F, bound= Frame)) – Coordinate frame for the pixel grid.

  • pixel_bounds (Bounds | None, default: None) – The region that bounds valid pixels for this transform.

Return type:

SkyProjection[TypeVar(F, bound= Frame)]

pixel_to_sky(point=None, /, *, x=None, y=None)#

Transform one or more pixel points to sky coordinates.

Parameters:
  • point (Union[XY[Any], YX[Any], None], default: None) – An XY or YX coordinate pair of pixel positions to transform. Mutually exclusive with x and y.

  • x (float | array-like) – x values of the pixel points to transform, as a scalar or any array-like. Results are broadcast against y. Mutually exclusive with point.

  • y (float | array-like) – y values of the pixel points to transform, as a scalar or any array-like. Results are broadcast against x. Mutually exclusive with point.

Returns:

Transformed sky coordinates, with the broadcast shape of x and y.

Return type:

astropy.coordinates.SkyCoord

serialize(archive, *, use_frame_sets=False)#

Serialize a projection to an archive.

Parameters:
  • archive (OutputArchive[TypeVar(P, bound= BaseModel)]) – Archive to serialize to.

  • use_frame_sets (bool, default: False) – If True, decompose the underlying transform and try to reference component mappings that were already serialized into a FrameSet in the archive. The FITS approximation transform is never decomposed.

Returns:

Serialized form of the projection.

Return type:

SkyProjectionSerializationModel

show(simplified=False, comments=False)#

Return the AST native representation of the transform.

Parameters:
  • simplified (bool, default: False) – Whether to ask AST to simplify the mapping before showing it. This will make it much more likely that two equivalent transforms have the same show result.

  • comments (bool, default: False) – Whether to include descriptive comments.

Return type:

str

sky_to_pixel(sky)#

Transform one or more sky coordinates to pixels.

Parameters:

sky (SkyCoord) – Sky coordinates to transform. Any shape is supported; the result has the same shape as sky.

Returns:

Transformed pixel coordinates with the same shape as sky.

Return type:

XY [numpy.ndarray | float]

to_legacy()#

Convert to a legacy lsst.afw.geom.SkyWcs instance.

Return type:

TypeAliasType

This page was last modified on .