28from .._image._slicing
import supportSlicing
29from .._image._disableArithmetic
import disableImageArithmetic
30from .._image._fitsIoWithOptions
import imageReadFitsWithOptions, exposureWriteFitsWithOptions
31from ._exposure
import ExposureI, ExposureF, ExposureD, ExposureU, ExposureL
32from ..exposure.exposureUtils
import bbox_to_convex_polygon, bbox_contains_sky_coords
37 def _set(self, index, value, origin):
38 """Set the pixel at the given index to a triple (value, mask, variance).
43 Position of the pixel to assign to.
45 A tuple of (value, mask, variance) scalars.
46 origin : `ImageOrigin`
47 Coordinate system of ``index`` (`PARENT` or `LOCAL`).
49 self.maskedImage._set(index, value=value, origin=origin)
51 def _get(self, index, origin):
52 """Return a triple (value, mask, variance) at the given index.
57 Position of the pixel to assign to.
58 origin : `ImageOrigin`
59 Coordinate system of ``index`` (`PARENT` or `LOCAL`).
61 return self.maskedImage.
_get(index, origin=origin)
65 return reduceToFits(self)
71 return ExposureF(self, deep=
True)
74 return ExposureD(self, deep=
True)
77 return self.maskedImage.image
80 self.maskedImage.image = image
82 image = property(getImage, setImage)
85 return self.maskedImage.mask
88 self.maskedImage.mask = mask
90 mask = property(getMask, setMask)
93 return self.maskedImage.variance
96 self.maskedImage.variance = variance
98 variance = property(getVariance, setVariance)
101 """Get the convex polygon associated with the bounding box corners.
103 The returned polygon has additional padding to ensure that the
104 bounding box is entirely contained within it. To ensure a set
105 of coordinates are entirely contained within an exposure, run
106 ``exposure.containsSkyCoords()``. The default padding
107 size was chosen to be sufficient
for the most warped detectors at
108 the edges of the HyperSuprimeCam focal plane.
113 Pixel padding to ensure that bounding box
is entirely contained
114 within the resulting polygon.
119 Returns `
None`
if exposure does
not have a valid WCS.
124 return bbox_to_convex_polygon(self.getBBox(), self.
wcs, padding=padding)
126 convex_polygon = property(getConvexPolygon)
129 """Check if a set of sky positions is in the pixel bounding box.
131 The default padding size was chosen to be sufficient for the
132 most warped detectors at the edges of the HyperSuprimeCam focal plane.
136 ra : `astropy.Quantity`, (N,)
137 Array of Right Ascension, angular units.
138 dec : `astropy.Quantity`, (N,)
139 Array of Declination, angular units.
140 padding : `int`, optional
141 Pixel padding to ensure that bounding box
is entirely contained
146 contained : `np.ndarray`, (N,)
147 Boolean array indicating which points are contained
in the
152 ValueError
if exposure does
not have a valid wcs.
155 raise ValueError(
"Exposure does not have a valid WCS.")
157 return bbox_contains_sky_coords(
164 readFitsWithOptions = classmethod(imageReadFitsWithOptions)
166 writeFitsWithOptions = exposureWriteFitsWithOptions
169Exposure.register(np.int32, ExposureI)
170Exposure.register(np.float32, ExposureF)
171Exposure.register(np.float64, ExposureD)
172Exposure.register(np.uint16, ExposureU)
173Exposure.register(np.uint64, ExposureL)
174Exposure.alias(
"I", ExposureI)
175Exposure.alias(
"F", ExposureF)
176Exposure.alias(
"D", ExposureD)
177Exposure.alias(
"U", ExposureU)
178Exposure.alias(
"L", ExposureL)
180for cls
in set(Exposure.values()):
182 disableImageArithmetic(cls)
_get(self, index, origin)
getConvexPolygon(self, padding=10)
setVariance(self, variance)
__deepcopy__(self, memo=None)
containsSkyCoords(self, ra, dec, padding=10)
_set(self, index, value, origin)
ConvexPolygon is a closed convex polygon on the unit sphere.
daf::base::PropertySet * set