LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+f5613e8b4f,g1470d8bcf6+190ad2ba91,g14a832a312+311607e4ab,g2079a07aa2+86d27d4dc4,g2305ad1205+a8e3196225,g295015adf3+b67ee847e5,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+a761f810f3,g487adcacf7+17c8fdbcbd,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+65b5bd823e,g5a732f18d5+53520f316c,g64a986408d+f5613e8b4f,g6c1bc301e9+51106c2951,g858d7b2824+f5613e8b4f,g8a8a8dda67+585e252eca,g99cad8db69+6729933424,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e9bba80f27,gc120e1dc64+eee469a5e5,gc28159a63d+0e5473021a,gcf0d15dbbd+a761f810f3,gdaeeff99f8+f9a426f77a,ge6526c86ff+d4c1d4bfef,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf1cff7945b+f5613e8b4f,w.2024.16
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lsst.afw.detection.multiband.MultibandFootprint Class Reference
Inheritance diagram for lsst.afw.detection.multiband.MultibandFootprint:
lsst.afw.multiband.MultibandBase

Public Member Functions

 __init__ (self, filters, singles)
 
 getSpans (self)
 
 footprint (self)
 
 mMaskedImage (self)
 
 spans (self)
 
 getPeaks (self)
 
 peaks (self)
 
 getImage (self, bbox=None, fill=np.nan, imageType=MultibandMaskedImage)
 
 clone (self, deep=True)
 

Static Public Member Functions

 fromArrays (filters, image, mask=None, variance=None, footprint=None, xy0=None, thresh=0, peaks=None)
 
 fromImages (filters, image, mask=None, variance=None, footprint=None, thresh=0, peaks=None)
 
 fromMaskedImages (filters, maskedImages, footprint=None, thresh=0, peaks=None)
 

Protected Member Functions

 _slice (self, filters, filterIndex, indices)
 

Protected Attributes

 _footprint
 

Detailed Description

Multiband Footprint class

A `MultibandFootprint` is a collection of HeavyFootprints that have
the same `SpanSet` and `peakCatalog` but different flux in each band.

Parameters
----------
filters : `list`
    List of filter names.
singles : `list`
    A list of single band `HeavyFootprint` objects.
    Each `HeavyFootprint` should have the same `PeakCatalog`
    and the same `SpanSet`, however to save CPU cycles there
    is no internal check for consistency of the peak catalog.

Definition at line 83 of file multiband.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.detection.multiband.MultibandFootprint.__init__ ( self,
filters,
singles )

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 99 of file multiband.py.

99 def __init__(self, filters, singles):
100 super().__init__(filters, singles)
101 # Ensure that all HeavyFootprints have the same SpanSet
102 spans = singles[0].getSpans()
103 if not all([heavy.getSpans() == spans for heavy in singles]):
104 raise ValueError("All HeavyFootprints in singles are expected to have the same SpanSet")
105
106 # Assume that all footprints have the same SpanSet and PeakCatalog
107 footprint = Footprint(spans)
108 footprint.setPeakCatalog(singles[0].getPeaks())
109 self._footprint = footprint
110

Member Function Documentation

◆ _slice()

lsst.afw.detection.multiband.MultibandFootprint._slice ( self,
filters,
filterIndex,
indices )
protected
Slice the current object and return the result

`MultibandFootprint` objects cannot be sliced along the image
dimension, so an error is thrown if `indices` has any elements.

See `Multiband._slice` for a list of the parameters.

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 255 of file multiband.py.

255 def _slice(self, filters, filterIndex, indices):
256 """Slice the current object and return the result
257
258 `MultibandFootprint` objects cannot be sliced along the image
259 dimension, so an error is thrown if `indices` has any elements.
260
261 See `Multiband._slice` for a list of the parameters.
262 """
263 if len(indices) > 0:
264 raise IndexError("MultibandFootprints can only be sliced in the filter dimension")
265
266 if isinstance(filterIndex, slice):
267 singles = self.singles[filterIndex]
268 else:
269 singles = [self.singles[idx] for idx in filterIndex]
270
271 return MultibandFootprint(filters, singles)
272

◆ clone()

lsst.afw.detection.multiband.MultibandFootprint.clone ( self,
deep = True )
Copy the current object

Parameters
----------
deep : `bool`
    Whether or not to make a deep copy

Returns
-------
result : `MultibandFootprint`
    The cloned footprint.

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 312 of file multiband.py.

312 def clone(self, deep=True):
313 """Copy the current object
314
315 Parameters
316 ----------
317 deep : `bool`
318 Whether or not to make a deep copy
319
320 Returns
321 -------
322 result : `MultibandFootprint`
323 The cloned footprint.
324 """
325 if deep:
326 footprint = Footprint(self.footprint.getSpans())
327 for peak in self.footprint.getPeaks():
328 footprint.addPeak(peak.getX(), peak.getY(), peak.getValue())
329 mMaskedImage = self.getImage()
330 filters = tuple([f for f in self.filters])
331 result = MultibandFootprint.fromMaskedImages(filters, mMaskedImage, footprint)
332 else:
333 result = MultibandFootprint(self.filters, self.singles)
334 return result

◆ footprint()

lsst.afw.detection.multiband.MultibandFootprint.footprint ( self)
Common SpanSet and peak catalog for the single band footprints

Definition at line 232 of file multiband.py.

232 def footprint(self):
233 """Common SpanSet and peak catalog for the single band footprints"""
234 return self._footprint
235

◆ fromArrays()

lsst.afw.detection.multiband.MultibandFootprint.fromArrays ( filters,
image,
mask = None,
variance = None,
footprint = None,
xy0 = None,
thresh = 0,
peaks = None )
static
Create a `MultibandFootprint` from an `image`, `mask`, `variance`

Parameters
----------
filters : `list`
    List of filter names.
image: array
    An array to convert into `lsst.afw.detection.HeavyFootprint` objects.
    Only pixels above the `thresh` value for at least one band
    will be included in the `SpanSet` and resulting footprints.
mask : array
    Mask for the `image` array.
variance : array
    Variance of the `image` array.
footprint : `Footprint`
    `Footprint` that contains the `SpanSet` and `PeakCatalog`
    to use for the `HeavyFootprint` in each band.
    If `footprint` is `None` then the `thresh` is used to create a
    `Footprint` based on the pixels above the `thresh` value.
xy0 : `Point2I`
    If `image` is an array and `footprint` is `None` then specifying
    `xy0` gives the location of the minimum `x` and `y` value of the
    `images`.
thresh : `float` or list of floats
    Threshold in each band (or the same threshold to be used in all bands)
    to include a pixel in the `SpanSet` of the `MultibandFootprint`.
    If `Footprint` is not `None` then `thresh` is ignored.
peaks : `PeakCatalog`
    Catalog containing information about the peaks located in the
    footprints.

Returns
-------
result : `MultibandFootprint`
    MultibandFootprint created from the arrays

Definition at line 112 of file multiband.py.

112 def fromArrays(filters, image, mask=None, variance=None, footprint=None, xy0=None, thresh=0, peaks=None):
113 """Create a `MultibandFootprint` from an `image`, `mask`, `variance`
114
115 Parameters
116 ----------
117 filters : `list`
118 List of filter names.
119 image: array
120 An array to convert into `lsst.afw.detection.HeavyFootprint` objects.
121 Only pixels above the `thresh` value for at least one band
122 will be included in the `SpanSet` and resulting footprints.
123 mask : array
124 Mask for the `image` array.
125 variance : array
126 Variance of the `image` array.
127 footprint : `Footprint`
128 `Footprint` that contains the `SpanSet` and `PeakCatalog`
129 to use for the `HeavyFootprint` in each band.
130 If `footprint` is `None` then the `thresh` is used to create a
131 `Footprint` based on the pixels above the `thresh` value.
132 xy0 : `Point2I`
133 If `image` is an array and `footprint` is `None` then specifying
134 `xy0` gives the location of the minimum `x` and `y` value of the
135 `images`.
136 thresh : `float` or list of floats
137 Threshold in each band (or the same threshold to be used in all bands)
138 to include a pixel in the `SpanSet` of the `MultibandFootprint`.
139 If `Footprint` is not `None` then `thresh` is ignored.
140 peaks : `PeakCatalog`
141 Catalog containing information about the peaks located in the
142 footprints.
143
144 Returns
145 -------
146 result : `MultibandFootprint`
147 MultibandFootprint created from the arrays
148 """
149 # Generate a new Footprint if one has not been specified
150 if footprint is None:
151 spans, imageBBox = getSpanSetFromImages(image, thresh, xy0)
152 footprint = Footprint(spans)
153 else:
154 imageBBox = footprint.getBBox()
155
156 if peaks is not None:
157 footprint.setPeakCatalog(peaks)
158 mMaskedImage = MultibandMaskedImage.fromArrays(filters, image, mask, variance, imageBBox)
159 singles = [makeHeavyFootprint(footprint, maskedImage) for maskedImage in mMaskedImage]
160 return MultibandFootprint(filters, singles)
161

◆ fromImages()

lsst.afw.detection.multiband.MultibandFootprint.fromImages ( filters,
image,
mask = None,
variance = None,
footprint = None,
thresh = 0,
peaks = None )
static
Create a `MultibandFootprint` from an `image`, `mask`, `variance`

Parameters
----------
filters : `list`
    List of filter names.
image : `lsst.afw.image.MultibandImage`, or list of `lsst.afw.image.Image`
    A `lsst.afw.image.MultibandImage` (or collection of images in each band)
    to convert into `HeavyFootprint` objects.
    Only pixels above the `thresh` value for at least one band
    will be included in the `SpanSet` and resulting footprints.
mask : `MultibandMask` or list of `Mask`
    Mask for the `image`.
variance : `lsst.afw.image.MultibandImage`, or list of `lsst.afw.image.Image`
    Variance of the `image`.
thresh : `float` or `list` of floats
    Threshold in each band (or the same threshold to be used in all bands)
    to include a pixel in the `SpanSet` of the `MultibandFootprint`.
    If `Footprint` is not `None` then `thresh` is ignored.
peaks : `PeakCatalog`
    Catalog containing information about the peaks located in the
    footprints.

Returns
-------
result : `MultibandFootprint`
    MultibandFootprint created from the image, mask, and variance

Definition at line 163 of file multiband.py.

163 def fromImages(filters, image, mask=None, variance=None, footprint=None, thresh=0, peaks=None):
164 """Create a `MultibandFootprint` from an `image`, `mask`, `variance`
165
166 Parameters
167 ----------
168 filters : `list`
169 List of filter names.
170 image : `lsst.afw.image.MultibandImage`, or list of `lsst.afw.image.Image`
171 A `lsst.afw.image.MultibandImage` (or collection of images in each band)
172 to convert into `HeavyFootprint` objects.
173 Only pixels above the `thresh` value for at least one band
174 will be included in the `SpanSet` and resulting footprints.
175 mask : `MultibandMask` or list of `Mask`
176 Mask for the `image`.
177 variance : `lsst.afw.image.MultibandImage`, or list of `lsst.afw.image.Image`
178 Variance of the `image`.
179 thresh : `float` or `list` of floats
180 Threshold in each band (or the same threshold to be used in all bands)
181 to include a pixel in the `SpanSet` of the `MultibandFootprint`.
182 If `Footprint` is not `None` then `thresh` is ignored.
183 peaks : `PeakCatalog`
184 Catalog containing information about the peaks located in the
185 footprints.
186
187 Returns
188 -------
189 result : `MultibandFootprint`
190 MultibandFootprint created from the image, mask, and variance
191 """
192 # Generate a new Footprint if one has not been specified
193 if footprint is None:
194 spans, imageBBox = getSpanSetFromImages(image, thresh)
195 footprint = Footprint(spans)
196
197 if peaks is not None:
198 footprint.setPeakCatalog(peaks)
199 mMaskedImage = MultibandMaskedImage(filters, image, mask, variance)
200 singles = [makeHeavyFootprint(footprint, maskedImage) for maskedImage in mMaskedImage]
201 return MultibandFootprint(filters, singles)
202

◆ fromMaskedImages()

lsst.afw.detection.multiband.MultibandFootprint.fromMaskedImages ( filters,
maskedImages,
footprint = None,
thresh = 0,
peaks = None )
static
Create a `MultibandFootprint` from a list of `MaskedImage`

See `fromImages` for a description of the parameters not listed below

Parameters
----------
maskedImages : `list` of `lsst.afw.image.MaskedImage`
    MaskedImages to extract the single band heavy footprints from.
    Like `fromImages`, if a `footprint` is not specified then all
    pixels above `thresh` will be used, and `peaks` will be added
    to the `PeakCatalog`.

Returns
-------
result : `MultibandFootprint`
    MultibandFootprint created from the image, mask, and variance

Definition at line 204 of file multiband.py.

204 def fromMaskedImages(filters, maskedImages, footprint=None, thresh=0, peaks=None):
205 """Create a `MultibandFootprint` from a list of `MaskedImage`
206
207 See `fromImages` for a description of the parameters not listed below
208
209 Parameters
210 ----------
211 maskedImages : `list` of `lsst.afw.image.MaskedImage`
212 MaskedImages to extract the single band heavy footprints from.
213 Like `fromImages`, if a `footprint` is not specified then all
214 pixels above `thresh` will be used, and `peaks` will be added
215 to the `PeakCatalog`.
216
217 Returns
218 -------
219 result : `MultibandFootprint`
220 MultibandFootprint created from the image, mask, and variance
221 """
222 image = [maskedImage.image for maskedImage in maskedImages]
223 mask = [maskedImage.mask for maskedImage in maskedImages]
224 variance = [maskedImage.variance for maskedImage in maskedImages]
225 return MultibandFootprint.fromImages(filters, image, mask, variance, footprint, thresh, peaks)
226

◆ getImage()

lsst.afw.detection.multiband.MultibandFootprint.getImage ( self,
bbox = None,
fill = np.nan,
imageType = MultibandMaskedImage )
Convert a `MultibandFootprint` to a `MultibandImage`

This returns the heavy footprints converted into an `MultibandImage` or
`MultibandMaskedImage` (depending on `imageType`).
This might be different than the internal `mMaskedImage` property
of the `MultibandFootprint`, as the `mMaskedImage` might contain
some non-zero pixels not contained in the footprint but present in
the images.

Parameters
----------
bbox : `Box2I`
    Bounding box of the resulting image.
    If no bounding box is specified, then the bounding box
    of the footprint is used.
fill : `float`
    Value to use for any pixel in the resulting image
    outside of the `SpanSet`.
imageType : `type`
    This should be either a `MultibandMaskedImage`
    or `MultibandImage` and describes the type of the output image.

Returns
-------
result : `MultibandBase`
    The resulting `MultibandImage` or `MultibandMaskedImage` created
    from the `MultibandHeavyFootprint`.

Definition at line 273 of file multiband.py.

273 def getImage(self, bbox=None, fill=np.nan, imageType=MultibandMaskedImage):
274 """Convert a `MultibandFootprint` to a `MultibandImage`
275
276 This returns the heavy footprints converted into an `MultibandImage` or
277 `MultibandMaskedImage` (depending on `imageType`).
278 This might be different than the internal `mMaskedImage` property
279 of the `MultibandFootprint`, as the `mMaskedImage` might contain
280 some non-zero pixels not contained in the footprint but present in
281 the images.
282
283 Parameters
284 ----------
285 bbox : `Box2I`
286 Bounding box of the resulting image.
287 If no bounding box is specified, then the bounding box
288 of the footprint is used.
289 fill : `float`
290 Value to use for any pixel in the resulting image
291 outside of the `SpanSet`.
292 imageType : `type`
293 This should be either a `MultibandMaskedImage`
294 or `MultibandImage` and describes the type of the output image.
295
296 Returns
297 -------
298 result : `MultibandBase`
299 The resulting `MultibandImage` or `MultibandMaskedImage` created
300 from the `MultibandHeavyFootprint`.
301 """
302 if imageType == MultibandMaskedImage:
303 singleType = MaskedImage
304 elif imageType == MultibandImage:
305 singleType = Image
306 else:
307 raise TypeError("Expected imageType to be either MultibandImage or MultibandMaskedImage")
308 maskedImages = [heavy.extractImage(fill, bbox, singleType) for heavy in self.singles]
309 mMaskedImage = imageType.fromImages(self.filters, maskedImages)
310 return mMaskedImage
311

◆ getPeaks()

lsst.afw.detection.multiband.MultibandFootprint.getPeaks ( self)
Get the `PeakCatalog`

Definition at line 246 of file multiband.py.

246 def getPeaks(self):
247 """Get the `PeakCatalog`"""
248 return self._footprint.getPeaks()
249

◆ getSpans()

lsst.afw.detection.multiband.MultibandFootprint.getSpans ( self)
Get the full `SpanSet`

Definition at line 227 of file multiband.py.

227 def getSpans(self):
228 """Get the full `SpanSet`"""
229 return self._footprint.getSpans()
230

◆ mMaskedImage()

lsst.afw.detection.multiband.MultibandFootprint.mMaskedImage ( self)
MultibandMaskedImage that the footprints present a view into

Definition at line 237 of file multiband.py.

237 def mMaskedImage(self):
238 """MultibandMaskedImage that the footprints present a view into"""
239 return self._mMaskedImage
240

◆ peaks()

lsst.afw.detection.multiband.MultibandFootprint.peaks ( self)
`PeakCatalog` of the `MultibandFootprint`

Definition at line 251 of file multiband.py.

251 def peaks(self):
252 """`PeakCatalog` of the `MultibandFootprint`"""
253 return self._footprint.getPeaks()
254

◆ spans()

lsst.afw.detection.multiband.MultibandFootprint.spans ( self)
`SpanSet` of the `MultibandFootprint`

Definition at line 242 of file multiband.py.

242 def spans(self):
243 """`SpanSet` of the `MultibandFootprint`"""
244 return self._footprint.getSpans()
245

Member Data Documentation

◆ _footprint

lsst.afw.detection.multiband.MultibandFootprint._footprint
protected

Definition at line 109 of file multiband.py.


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