SplineField#
- final class lsst.images.fields.SplineField(bounds: Bounds, data: ndarray, *, y: ndarray, x: ndarray, unit: UnitBase | None = None)#
Bases:
BaseFieldA 2-d Akima spline interpolation of data on a regular grid.
Parameters#
- bounds
The region where this field can be evaluated.
- data
The data points to be interpolated. Missing values (indicated by NaN) are allowed. Will be set to read-only in place.
- y
Coordinates for the first dimension of
data. Will be set to read-only in place.- x
Coordinates for the second dimension of
data. Will be set to read-only in place.- unit
Units of the field.
Notes#
This field is much faster to evaluate on a grid via
renderthan at arbitrary points via the function-call operator.Attributes Summary
The region over which this field can be evaluated (
Bounds).The data points to be interpolated (
numpy.ndarray).The units of the field (
astropy.units.UnitBaseorNone).Coordinates for the second dimension of
data(numpy.ndarray).Coordinates for the first dimension of
data(numpy.ndarray).Methods Summary
__call__(*, x, y[, quantity])Call self as a function.
deserialize(model, archive)Deserialize the spline field from an input archive.
evaluate(*, x, y[, quantity])Evaluate at non-gridded points.
from_legacy_background(legacy_background[, unit])Convert from a legacy
lsst.afw.math.BackgroundMIinstance.multiply_constant(factor)Multiply by a constant, returning a new field of the same type.
render([bbox, dtype])Create an image realization of the field.
serialize(archive)Serialize the spline field to an output archive.
Attributes Documentation
- bounds#
- data#
The data points to be interpolated (
numpy.ndarray).May have missing values indicated by NaNs.
- unit#
Methods Documentation
- __call__(*, x: ndarray, y: ndarray, quantity: bool = False) ndarray | Quantity#
Call self as a function.
- static deserialize(model: SplineFieldSerializationModel, archive: InputArchive[Any]) SplineField#
Deserialize the spline field from an input archive.
- evaluate(*, x: ndarray, y: ndarray, quantity: bool = False) 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 anastropy.units.Quantityinstead of anumpy.ndarray. IfunitisNone, the returned object will be a dimensionlessQuantity.
- static from_legacy_background(legacy_background: LegacyBackground, unit: astropy.units.UnitBase | None = None) SplineField#
Convert from a legacy
lsst.afw.math.BackgroundMIinstance.Notes#
SplineField.renderand thelsst.afwbackground interpolator both use Akima splines, but with slightly different boundary conditions. They should produce equivalent to single-precision round-off error when evaluated within the region enclosed by bin centers (i.e. where no extrapolation is necessary) and when there are five or more points to be interpolated in each row and column.
- multiply_constant(factor: float | Quantity | UnitBase) SplineField#
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.unitor set the units of the returned field ifself.unit is None.
- 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.bboxwill be used.- dtype
Pixel data type for the returned image.
- serialize(archive: OutputArchive[Any]) SplineFieldSerializationModel#
Serialize the spline field to an output archive.