ColorImage#

class lsst.images.ColorImage(array: ndarray[tuple[int, int, Literal[3]], dtype[Any]], /, *, bbox: Box | None = None, start: Sequence[int] | None = None, projection: Projection[Any] | None = None, metadata: dict[str, MetadataValue] | None = None)#

Bases: GeneralizedImage

An RGB image with an optional Projection.

Parameters#

array

Array or fill value for the image. Must have three dimensions with the shape of the third dimension equal to three.

bbox

Bounding box for the image.

start

Logical coordinates of the first pixel in the array, ordered y, x (unless an XY instance is passed). Ignored if bbox is provided. Defaults to zeros.

projection

Projection that maps the pixel grid to the sky.

metadata

Arbitrary flexible metadata to associate with the image.

Attributes Summary

absolute

A proxy object for slicing a generalized image using absolute pixel coordinates.

array

The 3-d array (numpy.ndarray).

astropy_wcs

An Astropy WCS for this image's pixel array.

bbox

The 2-d bounding box of the image (Box).

blue

A 2-d view of the blue channel (Image).

butler_dataset

The butler dataset reference for this image (lsst.daf.butler.SerializedDatasetRef | None).

butler_provenance

The butler inputs and ID of the task quantum that produced this dataset (lsst.daf.butler.DatasetProvenance | None)

fits_wcs

An Astropy FITS WCS for this image's pixel array.

green

A 2-d view of the green channel (Image).

local

A proxy object for slicing a generalized image using "local" or "array" pixel coordinates.

metadata

Arbitrary flexible metadata associated with the image (dict).

projection

The projection that maps the pixel grid to the sky (Projection | None).

red

A 2-d view of the red channel (Image).

Methods Summary

copy()

Deep-copy the image.

deserialize(model, archive, *[, bbox])

Deserialize a image from an input archive.

from_channels(r, g, b, *[, projection, metadata])

Construct from separate RGB images.

serialize(archive)

Serialize the masked image to an output archive.

Attributes Documentation

absolute#

A proxy object for slicing a generalized image using absolute pixel coordinates.

Notes#

In this convention, the first row and column of the pixel grid is bbox.start. A subimage and its parent image share the same absolute pixel coordinate system, and most lsst.images types (e.g. Box, Projection, PointSpreadFunction) operate exclusively in this system.

Note that astropy.wcs and numpy.ndarray are not aware of the bbox.start offset that defines tihs coordinates system; use local slicing for indices obtained from those.

See Also#

lsst.images.BoxSliceFactory lsst.images.IntervalSliceFactory

array#

The 3-d array (numpy.ndarray).

astropy_wcs#

An Astropy WCS for this image’s pixel array.

Notes#

As expected for Astropy WCS objects, this defines pixel coordinates such that the first row and column in any associated arrays are (0, 0), not bbox.start, as is the case for projection.

This object satisfies the astropy.wcs.wcsapi.BaseHighLevelWCS and astropy.wcs.wcsapi.BaseLowLevelWCS interfaces, but it is not an astropy.wcs.WCS (use fits_wcs for that).

bbox#

The 2-d bounding box of the image (Box).

blue#

A 2-d view of the blue channel (Image).

butler_dataset#

The butler dataset reference for this image (lsst.daf.butler.SerializedDatasetRef | None).

butler_provenance#

The butler inputs and ID of the task quantum that produced this dataset (lsst.daf.butler.DatasetProvenance | None)

fits_wcs#

An Astropy FITS WCS for this image’s pixel array.

Notes#

As expected for Astropy WCS objects, this defines pixel coordinates such that the first row and column in any associated arrays are (0, 0), not bbox.start, as is the case for projection.

This may be an approximation or absent if projection is not naturally representable as a FITS WCS.

green#

A 2-d view of the green channel (Image).

local#

A proxy object for slicing a generalized image using “local” or “array” pixel coordinates.

Notes#

In this convention, the first row and column of the pixel grid is always at (0, 0). This is also the convention used by astropy.wcs objects. When a subimage is created from a parent image, its “local” coordinate system is offset from the coordinate systems of the parent image.

Note that most lsst.images types (e.g. Box, Projection, PointSpreadFunction) operate instead in “absolute” coordinates, which is shared by subimage and their parents.

See Also#

lsst.images.BoxSliceFactory lsst.images.IntervalSliceFactory

metadata#

Arbitrary flexible metadata associated with the image (dict).

Notes#

Metadata is shared with subimages and other views. It can be disconnected by reassigning to a copy explicitly:

image.metadata = image.metadata.copy()

projection#

The projection that maps the pixel grid to the sky (Projection | None).

red#

A 2-d view of the red channel (Image).

Methods Documentation

copy() ColorImage#

Deep-copy the image.

static deserialize(model: ColorImageSerializationModel[Any], archive: InputArchive[Any], *, bbox: Box | None = None) ColorImage#

Deserialize a image from an input archive.

Parameters#

model

A Pydantic model representation of the image, holding references to data stored in the archive.

archive

Archive to read from.

bbox

Bounding box of a subimage to read instead.

static from_channels(r: Image, g: Image, b: Image, *, projection: Projection[Any] | None = None, metadata: dict[str, MetadataValue] | None = None) ColorImage#

Construct from separate RGB images.

All channels are assumed to have the same bounding box, projection, and pixel type.

serialize(archive: OutputArchive[Any]) ColorImageSerializationModel#

Serialize the masked image to an output archive.

Parameters#

archive

Archive to write to.