BaseField#
- class lsst.images.fields.BaseField#
Bases:
ABCAn abstract base class for parametric or interpolated 2-d functions, generally representing some sort of calculated image.
Notes#
The field hierarchy is closed to the types in this package, so we can enumerate all of the serializations and avoid any kind of extension system. All field types are immutable.
Field types implement the function call operator and both multiplication and division by a constant via operator overloading. See the named
evaluateandmultiply_constantmethods (respectively) for more information about those operations.This interface will probably change in the future to incorporate options for dealing with out-of-bounds positions. At present the behavior for such positions is implementation-specific and should not be relied upon.
Attributes Summary
The region over which this field can be evaluated (
Bounds).The units of the field (
astropy.units.UnitBaseorNone).Methods Summary
__call__()Call self as a function.
evaluate(*, x, y, quantity)Evaluate at non-gridded points.
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.
Attributes Documentation
- unit#
The units of the field (
astropy.units.UnitBaseorNone).
Methods Documentation
- __call__(*, x: ndarray, y: ndarray, quantity: Literal[False] = False) ndarray#
- __call__(*, x: ndarray, y: ndarray, quantity: Literal[True]) Quantity
- __call__(*, x: ndarray, y: ndarray, quantity: bool) ndarray | Quantity
Call self as a function.
- abstract 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 anastropy.units.Quantityinstead of anumpy.ndarray. IfunitisNone, the returned object will be a dimensionlessQuantity.
- abstract multiply_constant(factor: float | Quantity | UnitBase) Self#
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.
- abstract 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.