Projection#
- final class lsst.images.Projection(pixel_to_sky: Transform[F, SkyFrame], fits_approximation: Transform[F, SkyFrame] | None = None)#
Bases:
GenericA transform from pixel coordinates to sky coordinates.
Parameters#
- pixel_to_sky
A low-level transform that maps pixel coordinates to sky coordinates.
- fits_approximation
An approximation to
pixel_to_skythat is guaranteed to have aas_fits_wcsmethod that does not returnNone. This should not be provided ifpixel_to_skyis itself representable as a FITS WCS.
Notes#
Transformis 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
An approximation to this projection that is guaranteed to have an
as_fits_wcsmethod that does not returnNone.The region that bounds valid pixel points (
Bounds|None).Coordinate frame for the pixel grid.
Low-level transform from pixel to sky coordinates (
Transform).Coordinate frame for the sky.
Low-level transform from sky to pixel coordinates (
Transform).Methods Summary
as_astropy([bbox])Return an
astropy.wcsview of thisProjection.as_fits_wcs(bbox[, allow_approximation])Return a FITS WCS representation of this projection, if possible.
deserialize(model, archive)Deserialize a projection from an archive.
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(*, 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
Convert to a legacy
lsst.afw.geom.SkyWcsinstance.Attributes Documentation
- fits_approximation#
An approximation to this projection that is guaranteed to have an
as_fits_wcsmethod that does not returnNone.
- pixel_frame#
Coordinate frame for the pixel grid.
- sky_frame#
Coordinate frame for the sky.
Methods Documentation
- as_astropy(bbox: Box | None = None) ProjectionAstropyView#
Return an
astropy.wcsview of thisProjection.Parameters#
- bbox
Bounding box of the array the view will describe. This projection object is assumed to work on the same coordinate system in which
bboxis defined, while the Astropy view will consider the first row and column in that box to be(0, 0).
Notes#
This returns an object that satisfies the
astropy.wcs.wcsapi.BaseHighLevelWCSandastropy.wcs.wcsapi.BaseLowLevelWCSinterfaces while evaluating the underlyingProjectionitself. It is not anastropy.wcs.WCSinstance, which is a type that also satisfies those interfaces but only supports FITS WCS representations (seeas_fits_wcs).
- as_fits_wcs(bbox: Box, allow_approximation: bool = False) WCS | None#
Return a FITS WCS representation of this projection, if possible.
Parameters#
- bbox
Bounding box of the array the FITS WCS will describe. This transform object is assumed to work on the same coordinate system in which
bboxis 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
If
Trueand thisProjectionholds a FITS approximation to itself, return that approximation.
- static deserialize(model: ProjectionSerializationModel[TypeVar], archive: InputArchive) Projection[Any]#
Deserialize a projection from an archive.
Parameters#
- model
Seralized form of the projection.
- archive
Archive to read from.
- static from_fits_wcs(fits_wcs: WCS, pixel_frame: F, pixel_bounds: Bounds | None = None, x0: int = 0, y0: int = 0) Projection[F]#
Construct a transform from a FITS WCS.
Parameters#
- fits_wcs
FITS WCS to convert.
- pixel_frame
Coordinate frame for the pixel grid.
- pixel_bounds
The region that bounds valid pixels for this transform.
- x0
Logical coordinate of the first column in the array this WCS relates to world coordinates.
- y0
Logical coordinate of the first column in the array this WCS relates to world coordinates.
Notes#
The
x0andy0parameters 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). Thetypesin this package (e.g.Image,Mask) allow them to be any pair of integers.See Also#
Transform.from_fits_wcs
- static from_legacy(sky_wcs: LegacySkyWcs, pixel_frame: F, pixel_bounds: Bounds | None = None) Projection[F]#
Construct a transform from a legacy
lsst.afw.geom.SkyWcs.Parameters#
- sky_wcs
lsst.afw.geom.SkyWcs Legacy WCS object.
- pixel_frame
Coordinate frame for the pixel grid.
- pixel_bounds
The region that bounds valid pixels for this transform.
- sky_wcs
- pixel_to_sky(*, x: T, y: T) SkyCoord#
Transform one or more pixel points to sky coordinates.
Parameters#
- x
numpy.ndarray|float xvalues of the pixel points to transform.- y
numpy.ndarray|float yvalues of the pixel points to transform.
Returns#
- astropy.coordinates.SkyCoord
Transformed sky coordinates.
- x
- serialize(archive: OutputArchive, *, use_frame_sets: bool = False) ProjectionSerializationModel[TypeVar]#
Serialize a projection to an archive.
Parameters#
- archive
Archive to serialize to.
- use_frame_sets
If
True, decompose the underlying transform and try to reference component mappings that were already serialized into aFrameSetin the archive. The FITS approximation transform is never decomposed.
Returns#
ProjectionSerializationModelSerialized form of the projection.
- show(simplified: bool = False, comments: bool = False) str#
Return the AST native representation of the transform.
Parameters#
- simplified
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
showresult.- comments
Whether to include descriptive comments.
- sky_to_pixel(sky: SkyCoord) XY[ndarray | float]#
Transform one or more sky coordinates to pixels
Parameters#
- sky
Sky coordinates to transform.
Returns#
XY[numpy.ndarray|float]Transformed pixel coordinates.
- to_legacy() LegacySkyWcs#
Convert to a legacy
lsst.afw.geom.SkyWcsinstance.