CellField#

final class lsst.images.cells.CellField(bounds: CellGridBounds, array: ndarray, unit: UnitBase | None = None)#

Bases: BaseField

A piecewise 2-d function on a cell-coadd grid.

Parameters#

array

A 2-d array of cell values with shape bounds.subgrid_size.as_tuple().

bounds

Description of the cell grid and any missing cells. Array entries for missing cells should be NaN.

Notes#

CellField is not directly serializable and is not included in the Field union type alias as a result. A Mapping of CellField is instead serializable via CellApertureCorrectionMapSerializationModel.

Attributes Summary

bounds

The region over which this field can be evaluated (Bounds).

is_constant

Whether the field is spatially constant (bool).

unit

The units of the field (astropy.units.UnitBase or None).

Methods Summary

__call__(*, x, y[, quantity])

Call self as a function.

evaluate(*, x, y, quantity)

Evaluate at non-gridded points.

from_legacy_aperture_correction(legacy, bounds)

Convert from a legacy lsst.cell_coadds.StitchedApertureCorrection.

make_legacy_photo_calib(image_unit)

Make a legacy lsst.afw.image.PhotoCalib for an image with the given units, if that is possible without a photometric scaling field.

multiply_constant(factor)

Multiply by a constant, returning a new field of the same type.

quantity_in_cell(key)

Return the quantity (value with units) of the field in the cell with the given index.

render([bbox, dtype])

Create an image realization of the field.

to_legacy()

Convert to a legacy lsst.afw.math.BoundedField.

to_legacy_aperture_correction()

Convert to a legacy lsst.cell_coadds.StitchedApertureCorrection.

to_legacy_photo_calib(image_unit)

Convert to a legacy lsst.afw.image.PhotoCalib.

value_in_cell(key)

Return the value of the field in the cell with the given index.

Attributes Documentation

bounds#
is_constant#
unit#

Methods Documentation

__call__(*, x: ndarray, y: ndarray, quantity: bool = False) ndarray | Quantity#

Call self as a function.

evaluate(*, x: ndarray, y: ndarray, quantity: bool) ndarray | Quantity#

Evaluate at non-gridded points.

Parameters#

x

X coordinates to evaluate at.

y

Y coordinates to evaluate at; must be broadcast-compatible with x.

quantity

If True, return an astropy.units.Quantity instead of a numpy.ndarray. If unit is None, the returned object will be a dimensionless Quantity.

static from_legacy_aperture_correction(legacy: LegacyStichedApertureCorrection, bounds: CellGridBounds) CellField#

Convert from a legacy lsst.cell_coadds.StitchedApertureCorrection.

Parameters#

legacy

Legacy field to convert.

bounds

The grid and bounds of the returned field.

static make_legacy_photo_calib(image_unit: astropy.units.UnitBase) LegacyPhotoCalib | None#

Make a legacy lsst.afw.image.PhotoCalib for an image with the given units, if that is possible without a photometric scaling field.

multiply_constant(factor: float | Quantity | UnitBase) CellField#

Multiply by a constant, returning a new field of the same type.

Parameters#

factor

Factor to multiply by. When this has units, those should multiply self.unit or set the units of the returned field if self.unit is None.

quantity_in_cell(key: CellIJ) Quantity#

Return the quantity (value with units) of the field in the cell with the given index.

render(bbox: Box | None = None, *, dtype: type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None = None) Image#

Create an image realization of the field.

Parameters#

bbox

Bounding box of the image. If not provided, self.bounds.bbox will be used.

dtype

Pixel data type for the returned image.

to_legacy() LegacyBoundedField#

Convert to a legacy lsst.afw.math.BoundedField.

to_legacy_aperture_correction() LegacyStichedApertureCorrection#

Convert to a legacy lsst.cell_coadds.StitchedApertureCorrection.

to_legacy_photo_calib(image_unit: astropy.units.UnitBase) LegacyPhotoCalib#

Convert to a legacy lsst.afw.image.PhotoCalib.

Parameters#

image_unit

The units of the pixels the returned PhotoCalib will be associated with.

value_in_cell(key: CellIJ) float#

Return the value of the field in the cell with the given index.