LSST Applications g0265f82a02+d6b5cd48b5,g02d81e74bb+7bcba2e4e8,g2079a07aa2+14824f138e,g212a7c68fe+4b38ad7149,g2305ad1205+906def1e41,g295015adf3+564da5d084,g2bbee38e9b+d6b5cd48b5,g337abbeb29+d6b5cd48b5,g3ddfee87b4+cff7e20090,g487adcacf7+50712f9db4,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+d19d1a10d7,g5a732f18d5+66d966b544,g64a986408d+7bcba2e4e8,g858d7b2824+7bcba2e4e8,g8a8a8dda67+a6fc98d2e7,g99cad8db69+808e2eeadf,g9ddcbc5298+d4bad12328,ga1e77700b3+246acaaf9c,ga8c6da7877+9e3c062e8e,gb0e22166c9+3863383f4c,gb6a65358fc+d6b5cd48b5,gb983acf43b+60bb7664b7,gba4ed39666+9664299f35,gbb8dafda3b+6623599aa9,gc07e1c2157+f6e5778202,gc120e1dc64+6e28925a4e,gc28159a63d+d6b5cd48b5,gcf0d15dbbd+cff7e20090,gdaeeff99f8+a38ce5ea23,ge6526c86ff+bcc88f9437,ge79ae78c31+d6b5cd48b5,gee10cc3b42+a6fc98d2e7,gf1cff7945b+7bcba2e4e8,v24.1.5.rc1
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
lsst.afw.image._exposure._multiband.MultibandExposure Class Reference
Inheritance diagram for lsst.afw.image._exposure._multiband.MultibandExposure:
lsst.afw.image._image._multiband.MultibandTripleBase lsst.afw.multiband.MultibandBase

Public Member Functions

 __init__ (self, filters, image, mask, variance, psfs=None)
 
 computePsfKernelImage (self, position)
 
 computePsfImage (self, position=None)
 
 getPsfs (self)
 

Static Public Member Functions

 fromExposures (filters, singles)
 
 fromArrays (filters, image, mask, variance, bbox=None)
 
 fromKwargs (filters, filterKwargs, singleType=ExposureF, **kwargs)
 
 fromButler (butler, bands, *args, **kwargs)
 

Public Attributes

 singles
 

Protected Member Functions

 _buildSingles (self, image=None, mask=None, variance=None)
 
 _slice (self, filters, filterIndex, indices)
 

Detailed Description

MultibandExposure class

This class acts as a container for multiple `afw.Exposure` objects.
All exposures must have the same bounding box, and the associated
images must all have the same data type.

See `MultibandTripleBase` for parameter definitions.

Definition at line 119 of file _multiband.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.image._exposure._multiband.MultibandExposure.__init__ ( self,
filters,
image,
mask,
variance,
psfs = None )

Reimplemented from lsst.afw.image._image._multiband.MultibandTripleBase.

Definition at line 128 of file _multiband.py.

128 def __init__(self, filters, image, mask, variance, psfs=None):
129 super().__init__(filters, image, mask, variance)
130 if psfs is not None:
131 for psf, exposure in zip(psfs, self.singles):
132 exposure.setPsf(psf)
133

Member Function Documentation

◆ _buildSingles()

lsst.afw.image._exposure._multiband.MultibandExposure._buildSingles ( self,
image = None,
mask = None,
variance = None )
protected
Make a new list of single band objects

Parameters
----------
image: `list`
    List of `Image` objects that represent the image in each band.
mask: `list`
    List of `Mask` objects that represent the mask in each band.
variance: `list`
    List of `Image` objects that represent the variance in each band.

Returns
-------
singles: tuple
    Tuple of `MaskedImage` objects for each band,
    where the `image`, `mask`, and `variance` of each `single`
    point to the multiband objects.

Definition at line 159 of file _multiband.py.

159 def _buildSingles(self, image=None, mask=None, variance=None):
160 """Make a new list of single band objects
161
162 Parameters
163 ----------
164 image: `list`
165 List of `Image` objects that represent the image in each band.
166 mask: `list`
167 List of `Mask` objects that represent the mask in each band.
168 variance: `list`
169 List of `Image` objects that represent the variance in each band.
170
171 Returns
172 -------
173 singles: tuple
174 Tuple of `MaskedImage` objects for each band,
175 where the `image`, `mask`, and `variance` of each `single`
176 point to the multiband objects.
177 """
178 singles = []
179 if image is None:
180 image = self.image
181 if mask is None:
182 mask = self.mask
183 if variance is None:
184 variance = self.variance
185
186 dtype = image.array.dtype
187 for f in self.filters:
188 maskedImage = MaskedImage(image=image[f], mask=mask[f], variance=variance[f], dtype=dtype)
189 single = Exposure(maskedImage, dtype=dtype)
190 singles.append(single)
191 return tuple(singles)
192

◆ _slice()

lsst.afw.image._exposure._multiband.MultibandExposure._slice ( self,
filters,
filterIndex,
indices )
protected
Slice the current object and return the result

See `Multiband._slice` for a list of the parameters.
This overwrites the base method to attach the PSF to
each individual exposure.

Reimplemented from lsst.afw.image._image._multiband.MultibandTripleBase.

Definition at line 289 of file _multiband.py.

289 def _slice(self, filters, filterIndex, indices):
290 """Slice the current object and return the result
291
292 See `Multiband._slice` for a list of the parameters.
293 This overwrites the base method to attach the PSF to
294 each individual exposure.
295 """
296 image = self.image._slice(filters, filterIndex, indices)
297 if self.mask is not None:
298 mask = self._mask._slice(filters, filterIndex, indices)
299 else:
300 mask = None
301 if self.variance is not None:
302 variance = self._variance._slice(filters, filterIndex, indices)
303 else:
304 variance = None
305
306 # If only a single pixel is selected, return the tuple of MultibandPixels
307 if isinstance(image, MultibandPixel):
308 if mask is not None:
309 assert isinstance(mask, MultibandPixel)
310 if variance is not None:
311 assert isinstance(variance, MultibandPixel)
312 return (image, mask, variance)
313
314 _psfs = self.getPsfs()
315 psfs = [_psfs[band] for band in filters]
316
317 result = MultibandExposure(
318 filters=filters,
319 image=image,
320 mask=mask,
321 variance=variance,
322 psfs=psfs,
323 )
324
325 assert all([r.getBBox() == result._bbox for r in [result._mask, result._variance]])
326 return result

◆ computePsfImage()

lsst.afw.image._exposure._multiband.MultibandExposure.computePsfImage ( self,
position = None )
Get a multiband PSF image

The PSF Kernel Image is computed for each band
and combined into a (filter, y, x) array and stored
as `self._psfImage`.
The result is not cached, so if the same PSF is expected
to be used multiple times it is a good idea to store the
result in another variable.

Parameters
----------
position: `Point2D` or `tuple`
    Coordinates to evaluate the PSF. If `position` is `None`
    then `Psf.getAveragePosition()` is used.

Returns
-------
self._psfImage: array
    The multiband PSF image.

Definition at line 252 of file _multiband.py.

252 def computePsfImage(self, position=None):
253 """Get a multiband PSF image
254
255 The PSF Kernel Image is computed for each band
256 and combined into a (filter, y, x) array and stored
257 as `self._psfImage`.
258 The result is not cached, so if the same PSF is expected
259 to be used multiple times it is a good idea to store the
260 result in another variable.
261
262 Parameters
263 ----------
264 position: `Point2D` or `tuple`
265 Coordinates to evaluate the PSF. If `position` is `None`
266 then `Psf.getAveragePosition()` is used.
267
268 Returns
269 -------
270 self._psfImage: array
271 The multiband PSF image.
272 """
273 return computePsfImage(
274 psfModels=self.getPsfs(),
275 position=position,
276 useKernelImage=True,
277 )
278

◆ computePsfKernelImage()

lsst.afw.image._exposure._multiband.MultibandExposure.computePsfKernelImage ( self,
position )
Get a multiband PSF image

The PSF Kernel Image is computed for each band
and combined into a (filter, y, x) array and stored
as `self._psfImage`.
The result is not cached, so if the same PSF is expected
to be used multiple times it is a good idea to store the
result in another variable.

Parameters
----------
position: `Point2D` or `tuple`
    Coordinates to evaluate the PSF.

Returns
-------
self._psfImage: array
    The multiband PSF image.

Definition at line 226 of file _multiband.py.

226 def computePsfKernelImage(self, position):
227 """Get a multiband PSF image
228
229 The PSF Kernel Image is computed for each band
230 and combined into a (filter, y, x) array and stored
231 as `self._psfImage`.
232 The result is not cached, so if the same PSF is expected
233 to be used multiple times it is a good idea to store the
234 result in another variable.
235
236 Parameters
237 ----------
238 position: `Point2D` or `tuple`
239 Coordinates to evaluate the PSF.
240
241 Returns
242 -------
243 self._psfImage: array
244 The multiband PSF image.
245 """
246 return computePsfImage(
247 psfModels=self.getPsfs(),
248 position=position,
249 useKernelImage=True,
250 )
251

◆ fromArrays()

lsst.afw.image._exposure._multiband.MultibandExposure.fromArrays ( filters,
image,
mask,
variance,
bbox = None )
static
Construct a MultibandExposure from a collection of arrays

see `tripleFromArrays` for a description of parameters

Definition at line 144 of file _multiband.py.

144 def fromArrays(filters, image, mask, variance, bbox=None):
145 """Construct a MultibandExposure from a collection of arrays
146
147 see `tripleFromArrays` for a description of parameters
148 """
149 return tripleFromArrays(MultibandExposure, filters, image, mask, variance, bbox)
150

◆ fromButler()

lsst.afw.image._exposure._multiband.MultibandExposure.fromButler ( butler,
bands,
* args,
** kwargs )
static
Load a multiband exposure from a butler

Because each band is stored in a separate exposure file,
this method can be used to load all of the exposures for
a given set of bands

Parameters
----------
butler: `lsst.daf.butler.Butler`
    Butler connection to use to load the single band
    calibrated images
bands: `list` or `str`
    List of names for each band
args: `list`
    Arguments to the Butler.
kwargs: `dict`
    Keyword arguments to pass to the Butler
    that are the same in all bands.

Returns
-------
result: `MultibandExposure`
    The new `MultibandExposure` created by combining all of the
    single band exposures.

Definition at line 194 of file _multiband.py.

194 def fromButler(butler, bands, *args, **kwargs):
195 """Load a multiband exposure from a butler
196
197 Because each band is stored in a separate exposure file,
198 this method can be used to load all of the exposures for
199 a given set of bands
200
201 Parameters
202 ----------
203 butler: `lsst.daf.butler.Butler`
204 Butler connection to use to load the single band
205 calibrated images
206 bands: `list` or `str`
207 List of names for each band
208 args: `list`
209 Arguments to the Butler.
210 kwargs: `dict`
211 Keyword arguments to pass to the Butler
212 that are the same in all bands.
213
214 Returns
215 -------
216 result: `MultibandExposure`
217 The new `MultibandExposure` created by combining all of the
218 single band exposures.
219 """
220 # Load the Exposure in each band
221 exposures = []
222 for band in bands:
223 exposures.append(butler.get(*args, band=band, **kwargs))
224 return MultibandExposure.fromExposures(bands, exposures)
225

◆ fromExposures()

lsst.afw.image._exposure._multiband.MultibandExposure.fromExposures ( filters,
singles )
static
Construct a MultibandImage from a collection of single band images

see `tripleFromExposures` for a description of parameters

Definition at line 135 of file _multiband.py.

135 def fromExposures(filters, singles):
136 """Construct a MultibandImage from a collection of single band images
137
138 see `tripleFromExposures` for a description of parameters
139 """
140 psfs = [s.getPsf() for s in singles]
141 return tripleFromSingles(MultibandExposure, filters, singles, psfs=psfs)
142

◆ fromKwargs()

lsst.afw.image._exposure._multiband.MultibandExposure.fromKwargs ( filters,
filterKwargs,
singleType = ExposureF,
** kwargs )
static
Build a MultibandImage from a set of keyword arguments

see `makeTripleFromKwargs` for a description of parameters

Definition at line 152 of file _multiband.py.

152 def fromKwargs(filters, filterKwargs, singleType=ExposureF, **kwargs):
153 """Build a MultibandImage from a set of keyword arguments
154
155 see `makeTripleFromKwargs` for a description of parameters
156 """
157 return makeTripleFromKwargs(MultibandExposure, filters, filterKwargs, singleType, **kwargs)
158

◆ getPsfs()

lsst.afw.image._exposure._multiband.MultibandExposure.getPsfs ( self)
Extract the PSF model in each band

Returns
-------
psfs : `dict` of `lsst.afw.detection.Psf`
    The PSF in each band

Definition at line 279 of file _multiband.py.

279 def getPsfs(self):
280 """Extract the PSF model in each band
281
282 Returns
283 -------
284 psfs : `dict` of `lsst.afw.detection.Psf`
285 The PSF in each band
286 """
287 return {band: self[band].getPsf() for band in self.filters}
288

Member Data Documentation

◆ singles

lsst.afw.image._exposure._multiband.MultibandExposure.singles

Definition at line 131 of file _multiband.py.


The documentation for this class was generated from the following file: