SkyProjection#
- final class lsst.images.SkyProjection(pixel_to_sky, fits_approximation=None)#
Bases:
GenericA 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 topixel_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.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 thisSkyProjection.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.
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=None)#
Return an
astropy.wcsview of thisSkyProjection.- 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 whichbboxis defined, while the Astropy view will consider the first row and column in that box to be(0, 0).- Return type:
Notes
This returns an object that satisfies the
astropy.wcs.wcsapi.BaseHighLevelWCSandastropy.wcs.wcsapi.BaseLowLevelWCSinterfaces while evaluating the underlyingSkyProjectionitself. 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, 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 whichbboxis 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) – IfTrueand thisSkyProjectionholds a FITS approximation to itself, return that approximation.
- Return type:
- 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
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
- 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) – AnXYorYXcoordinate pair of pixel positions to transform. Mutually exclusive withxandy.x (
float| array-like) –xvalues of the pixel points to transform, as a scalar or any array-like. Results are broadcast againsty. Mutually exclusive withpoint.y (
float| array-like) –yvalues of the pixel points to transform, as a scalar or any array-like. Results are broadcast againstx. Mutually exclusive withpoint.
- Returns:
Transformed sky coordinates, with the broadcast shape of
xandy.- Return type:
- 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) – IfTrue, 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:
Serialized form of the projection.
- Return type:
- show(simplified=False, comments=False)#
Return the AST native representation of the transform.
- 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 assky.- 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.SkyWcsinstance.- Return type:
TypeAliasType