27from lsst.utils.deprecated
import deprecate_pybind11
29from ..image._slicing
import supportSlicing
30from ..image._disableArithmetic
import disableImageArithmetic
31from ..image._fitsIoWithOptions
import imageReadFitsWithOptions, exposureWriteFitsWithOptions
32from ._exposure
import ExposureI, ExposureF, ExposureD, ExposureU, ExposureL
33from .exposureUtils
import bbox_to_convex_polygon, bbox_contains_sky_coords
38 def _set(self, index, value, origin):
39 """Set the pixel at the given index to a triple (value, mask, variance).
44 Position of the pixel to assign to.
46 A tuple of (value, mask, variance) scalars.
47 origin : `ImageOrigin`
48 Coordinate system of ``index`` (`PARENT` or `LOCAL`).
50 self.maskedImage._set(index, value=value, origin=origin)
52 def _get(self, index, origin):
53 """Return a triple (value, mask, variance) at the given index.
58 Position of the pixel to assign to.
59 origin : `ImageOrigin`
60 Coordinate system of ``index`` (`PARENT` or `LOCAL`).
62 return self.maskedImage._get(index, origin=origin)
72 return ExposureD(self, deep=
True)
75 return self.maskedImage.image
78 self.maskedImage.image = image
80 image = property(getImage, setImage)
83 return self.maskedImage.mask
86 self.maskedImage.mask = mask
88 mask = property(getMask, setMask)
91 return self.maskedImage.variance
94 self.maskedImage.variance = variance
96 variance = property(getVariance, setVariance)
99 """Get the convex polygon associated with the bounding box corners.
101 The returned polygon has additional padding to ensure that the
102 bounding box is entirely contained within it. To ensure a set
103 of coordinates are entirely contained within an exposure, run
104 ``exposure.containsSkyCoords()``. The default padding
105 size was chosen to be sufficient
for the most warped detectors at
106 the edges of the HyperSuprimeCam focal plane.
111 Pixel padding to ensure that bounding box
is entirely contained
112 within the resulting polygon.
117 Returns `
None`
if exposure does
not have a valid WCS.
124 convex_polygon = property(getConvexPolygon)
127 """Check if a set of sky positions is in the pixel bounding box.
129 The default padding size was chosen to be sufficient for the
130 most warped detectors at the edges of the HyperSuprimeCam focal plane.
134 ra : `astropy.Quantity`, (N,)
135 Array of Right Ascension, angular units.
136 dec : `astropy.Quantity`, (N,)
137 Array of Declination, angular units.
138 padding : `int`, optional
139 Pixel padding to ensure that bounding box
is entirely contained
144 contained : `np.ndarray`, (N,)
145 Boolean array indicating which points are contained
in the
150 ValueError
if exposure does
not have a valid wcs.
153 raise ValueError(
"Exposure does not have a valid WCS.")
162 readFitsWithOptions = classmethod(imageReadFitsWithOptions)
164 writeFitsWithOptions = exposureWriteFitsWithOptions
167Exposure.register(np.int32, ExposureI)
168Exposure.register(np.float32, ExposureF)
169Exposure.register(np.float64, ExposureD)
170Exposure.register(np.uint16, ExposureU)
171Exposure.register(np.uint64, ExposureL)
172Exposure.alias(
"I", ExposureI)
173Exposure.alias(
"F", ExposureF)
174Exposure.alias(
"D", ExposureD)
175Exposure.alias(
"U", ExposureU)
176Exposure.alias(
"L", ExposureL)
178for cls
in set(Exposure.values()):
181 cls.getFilterLabel = deprecate_pybind11(
183 reason=
"Replaced by getFilter. Will be removed after v24.",
185 cls.setFilterLabel = deprecate_pybind11(
187 reason=
"Replaced by setFilter. Will be removed after v24.",
def setImage(self, image)
def getConvexPolygon(self, padding=10)
def containsSkyCoords(self, ra, dec, padding=10)
def setVariance(self, variance)
ConvexPolygon is a closed convex polygon on the unit sphere.
daf::base::PropertySet * set
def bbox_contains_sky_coords(bbox, wcs, ra, dec, padding=10)
def bbox_to_convex_polygon(bbox, wcs, padding=10)
def disableImageArithmetic(cls)
afw::image::Exposure< float > ExposureF