CellCoadd#

class lsst.images.cells.CellCoadd(image: Image, *, mask: Mask | None = None, variance: Image | None = None, mask_fractions: Mapping[str, Image] | None = None, noise_realizations: Sequence[Image] = (), mask_schema: MaskSchema | None = None, projection: Projection[TractFrame] | None = None, band: str | None = None, psf: CellPointSpreadFunction, patch: PatchDefinition | None = None, provenance: CoaddProvenance | None = None)#

Bases: MaskedImage

A coadd comprised of cells on a regular grid.

Parameters#

image

The main image plane. If this has a Projection, it will be used for all planes unless a projection is passed separately.

mask

A bitmask image that annotates the main image plane. Must have the same bounding box as image if provided. Any attached projection is replaced (possibly by None).

variance

The per-pixel uncertainty of the main image as an image of variance values. Must have the same bounding box as image if provided, and its units must be the square of image.unit or None. Values default to 1.0. Any attached projection is replaced (possibly by None).

mask_fractions

A mapping from an input-image mask plane name to an image of the weights sums of that plane.

noise_realizations

A sequence of images with Monte Carlo realizations of the noise in the coadd.

mask_schema

Schema for the mask plane. Must be provided if and only if mask is not provided.

projection

Projection that maps the pixel grid to the sky. Can only be None if a projection is already attached to image.

band

Name of the band.

psf

Effective point-spread function for the coadd. The missing cells reported by psf.bounds are assumed to apply to all image data for that cell as well (i.e. there is a PSF for a cell if and only if there is image data for that cell).

patch

Identifiers and geometry of the full patch, if the image is confined to a single patch. When present, the cell grid of the PSF and provenance (if provideD) must be the full patch grid, even if its bounds select a subset of that area.

provenance

Information about the images that went into the coadd.

Attributes Summary

absolute

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

astropy_wcs

An Astropy WCS for this image's pixel array.

band

Name of the band (str or None).

bbox

The bounding box shared by all three image planes (Box).

bounds

The grid of cells that overlap this coadd and a set of missing cells (CellGridBounds).

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.

grid

The grid of cells that overlap this coadd (CellGrid).

image

The main image plane (Image).

local

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

mask

The mask plane (Mask).

mask_fractions

A mapping from an input-image mask plane name to an image of the weights sums of that plane (Mapping [str, Image]).

metadata

Arbitrary flexible metadata associated with the image (dict).

noise_realizations

A sequence of images with Monte Carlo realizations of the noise in the coadd (Sequence [Image]).

obs_info

General information about the associated observation in standard form.

patch

Identifiers and geometry of the full patch, if the image is confined to a single patch (PatchDefinition).

projection

The projection that maps the pixel grid to the sky (Projection [TractFrame]).

provenance

Information about the images that went into the coadd (CoaddProvenance or None).

psf

Effective point-spread function for the coadd (CellPointSpreadFunction).

skymap

Name of the skymap (str).

tract

ID of the tract (int).

unit

The units of the image plane (astropy.units.Unit).

variance

The variance plane (Image).

Methods Summary

copy()

Deep-copy the coadd.

from_legacy(legacy, *[, plane_map])

Convert from an lsst.cell_coadds.MultipleCellCoadd instance.

read_fits(url, *[, bbox])

Read an image from a FITS file.

read_legacy(uri, *[, preserve_quantization, ...])

Read a FITS file written by lsst.afw.image.MaskedImage.writeFits.

serialize(archive)

Serialize the image to an output archive.

to_legacy(*[, copy, plane_map])

Convert to an lsst.afw.image.MaskedImage instance.

write_fits(filename, *[, image_compression, ...])

Write the image to a FITS file.

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

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).

band#

Name of the band (str or None).

bbox#

The bounding box shared by all three image planes (Box).

bounds#

The grid of cells that overlap this coadd and a set of missing cells (CellGridBounds).

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.

grid#

The grid of cells that overlap this coadd (CellGrid).

image#

The main image plane (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

mask#

The mask plane (Mask).

mask_fractions#

A mapping from an input-image mask plane name to an image of the weights sums of that plane (Mapping [str, Image]).

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()

noise_realizations#

A sequence of images with Monte Carlo realizations of the noise in the coadd (Sequence [Image]).

obs_info#

General information about the associated observation in standard form. (ObservationInfo | None).

patch#

Identifiers and geometry of the full patch, if the image is confined to a single patch (PatchDefinition).

projection#

The projection that maps the pixel grid to the sky (Projection [TractFrame]).

provenance#

Information about the images that went into the coadd (CoaddProvenance or None).

psf#

Effective point-spread function for the coadd (CellPointSpreadFunction).

skymap#

Name of the skymap (str).

tract#

ID of the tract (int).

unit#

The units of the image plane (astropy.units.Unit).

variance#

The variance plane (Image).

Methods Documentation

copy() CellCoadd#

Deep-copy the coadd.

static from_legacy(legacy: MultipleCellCoadd, *, plane_map: Mapping[str, MaskPlane] | None = None, tract_info: TractInfo) CellCoadd#

Convert from an lsst.cell_coadds.MultipleCellCoadd instance.

Parameters#

legacy

A lsst.cell_coadds.MultipleCellCoadd instance to convert.

plane_map

A mapping from legacy mask plane name to the new plane name and description.

tract_info

Information about the full tract.

classmethod read_fits(url: str | ParseResult | ResourcePath | Path, *, bbox: Box | None = None) MaskedImage#

Read an image from a FITS file.

Parameters#

url

URL of the file to read; may be any type supported by lsst.resources.ResourcePath.

bbox

Bounding box of a subimage to read instead.

static read_legacy(uri: str | ParseResult | ResourcePath | Path, *, preserve_quantization: bool = False, plane_map: Mapping[str, MaskPlane] | None = None, component: Literal['image', 'mask', 'variance'] | None = None, fits_wcs_frame: Frame | None = None) Any#

Read a FITS file written by lsst.afw.image.MaskedImage.writeFits.

Parameters#

uri

URI or file name.

preserve_quantization

If True, ensure that writing the masked image back out again will exactly preserve quantization-compressed pixel values. This causes the image and variance plane arrays to be marked as read-only and stores the original binary table data for those planes in memory. If the MaskedImage is copied, the precompressed pixel values are not transferred to the copy.

plane_map

A mapping from legacy mask plane name to the new plane name and description.

component

A component to read instead of the full image.

fits_wcs_frame

If not None and the HDU containing the image plane has a FITS WCS, attach a Projection to the returned masked image by converting that WCS. When component is one of "image", "mask", or "variance", a FITS WCS from the component HDU is used instead (all three should have the same WCS).

serialize(archive: OutputArchive[Any]) CellCoaddSerializationModel#

Serialize the image to an output archive.

Parameters#

archive

Archive to write to.

to_legacy(*, copy: bool | None = None, plane_map: Mapping[str, MaskPlane] | None = None) Any#

Convert to an lsst.afw.image.MaskedImage instance.

Parameters#

copy

If True, always copy the image and variance pixel data. If False, return a view, and raise TypeError if the pixel data is read-only (this is not supported by afw). If None, onyl if the pixel data is read-only. Mask pixel data is always copied.

plane_map

A mapping from legacy mask plane name to the new plane name and description.

write_fits(filename: str, *, image_compression: ~lsst.images.fits._common.FitsCompressionOptions | None = FitsCompressionOptions(algorithm=<FitsCompressionAlgorithm.GZIP_2: 'GZIP_2'>, tile_shape=None, quantization=None), mask_compression: ~lsst.images.fits._common.FitsCompressionOptions | None = FitsCompressionOptions(algorithm=<FitsCompressionAlgorithm.GZIP_2: 'GZIP_2'>, tile_shape=None, quantization=None), variance_compression: ~lsst.images.fits._common.FitsCompressionOptions | None = FitsCompressionOptions(algorithm=<FitsCompressionAlgorithm.GZIP_2: 'GZIP_2'>, tile_shape=None, quantization=None), compression_seed: int | None = None) None#

Write the image to a FITS file.

Parameters#

filename

Name of the file to write to. Must be a local file.

image_compression

Compression options for the image plane.

mask_compression

Compression options for the mask plane.

variance_compression

Compression options for the variance plane.

compression_seed

A FITS tile compression seed to use whenever the configured compression seed is None or (for backwards compatibility) 0. This value is then incremented every time it is used.