@@ -88,16 +88,16 @@ class MultibandFootprint(MultibandBase):
88
88
89
89
Parameters
90
90
----------
91
- filters : `list`
92
- List of filter names.
91
+ bands : `list`
92
+ List of band names.
93
93
singles : `list`
94
94
A list of single band `HeavyFootprint` objects.
95
95
Each `HeavyFootprint` should have the same `PeakCatalog`
96
96
and the same `SpanSet`, however to save CPU cycles there
97
97
is no internal check for consistency of the peak catalog.
98
98
"""
99
- def __init__ (self , filters , singles ):
100
- super ().__init__ (filters , singles )
99
+ def __init__ (self , bands , singles ):
100
+ super ().__init__ (bands , singles )
101
101
# Ensure that all HeavyFootprints have the same SpanSet
102
102
spans = singles [0 ].getSpans ()
103
103
if not all ([heavy .getSpans () == spans for heavy in singles ]):
@@ -109,13 +109,13 @@ def __init__(self, filters, singles):
109
109
self ._footprint = footprint
110
110
111
111
@staticmethod
112
- def fromArrays (filters , image , mask = None , variance = None , footprint = None , xy0 = None , thresh = 0 , peaks = None ):
112
+ def fromArrays (bands , image , mask = None , variance = None , footprint = None , xy0 = None , thresh = 0 , peaks = None ):
113
113
"""Create a `MultibandFootprint` from an `image`, `mask`, `variance`
114
114
115
115
Parameters
116
116
----------
117
- filters : `list`
118
- List of filter names.
117
+ bands : `list`
118
+ List of band names.
119
119
image: array
120
120
An array to convert into `lsst.afw.detection.HeavyFootprint` objects.
121
121
Only pixels above the `thresh` value for at least one band
@@ -155,18 +155,18 @@ def fromArrays(filters, image, mask=None, variance=None, footprint=None, xy0=Non
155
155
156
156
if peaks is not None :
157
157
footprint .setPeakCatalog (peaks )
158
- mMaskedImage = MultibandMaskedImage .fromArrays (filters , image , mask , variance , imageBBox )
158
+ mMaskedImage = MultibandMaskedImage .fromArrays (bands , image , mask , variance , imageBBox )
159
159
singles = [makeHeavyFootprint (footprint , maskedImage ) for maskedImage in mMaskedImage ]
160
- return MultibandFootprint (filters , singles )
160
+ return MultibandFootprint (bands , singles )
161
161
162
162
@staticmethod
163
- def fromImages (filters , image , mask = None , variance = None , footprint = None , thresh = 0 , peaks = None ):
163
+ def fromImages (bands , image , mask = None , variance = None , footprint = None , thresh = 0 , peaks = None ):
164
164
"""Create a `MultibandFootprint` from an `image`, `mask`, `variance`
165
165
166
166
Parameters
167
167
----------
168
- filters : `list`
169
- List of filter names.
168
+ bands : `list`
169
+ List of band names.
170
170
image : `lsst.afw.image.MultibandImage`, or list of `lsst.afw.image.Image`
171
171
A `lsst.afw.image.MultibandImage` (or collection of images in each band)
172
172
to convert into `HeavyFootprint` objects.
@@ -196,12 +196,12 @@ def fromImages(filters, image, mask=None, variance=None, footprint=None, thresh=
196
196
197
197
if peaks is not None :
198
198
footprint .setPeakCatalog (peaks )
199
- mMaskedImage = MultibandMaskedImage (filters , image , mask , variance )
199
+ mMaskedImage = MultibandMaskedImage (bands , image , mask , variance )
200
200
singles = [makeHeavyFootprint (footprint , maskedImage ) for maskedImage in mMaskedImage ]
201
- return MultibandFootprint (filters , singles )
201
+ return MultibandFootprint (bands , singles )
202
202
203
203
@staticmethod
204
- def fromMaskedImages (filters , maskedImages , footprint = None , thresh = 0 , peaks = None ):
204
+ def fromMaskedImages (bands , maskedImages , footprint = None , thresh = 0 , peaks = None ):
205
205
"""Create a `MultibandFootprint` from a list of `MaskedImage`
206
206
207
207
See `fromImages` for a description of the parameters not listed below
@@ -222,7 +222,7 @@ def fromMaskedImages(filters, maskedImages, footprint=None, thresh=0, peaks=None
222
222
image = [maskedImage .image for maskedImage in maskedImages ]
223
223
mask = [maskedImage .mask for maskedImage in maskedImages ]
224
224
variance = [maskedImage .variance for maskedImage in maskedImages ]
225
- return MultibandFootprint .fromImages (filters , image , mask , variance , footprint , thresh , peaks )
225
+ return MultibandFootprint .fromImages (bands , image , mask , variance , footprint , thresh , peaks )
226
226
227
227
def getSpans (self ):
228
228
"""Get the full `SpanSet`"""
@@ -252,7 +252,7 @@ def peaks(self):
252
252
"""`PeakCatalog` of the `MultibandFootprint`"""
253
253
return self ._footprint .getPeaks ()
254
254
255
- def _slice (self , filters , filterIndex , indices ):
255
+ def _slice (self , bands , bandIndex , indices ):
256
256
"""Slice the current object and return the result
257
257
258
258
`MultibandFootprint` objects cannot be sliced along the image
@@ -261,14 +261,14 @@ def _slice(self, filters, filterIndex, indices):
261
261
See `Multiband._slice` for a list of the parameters.
262
262
"""
263
263
if len (indices ) > 0 :
264
- raise IndexError ("MultibandFootprints can only be sliced in the filter dimension" )
264
+ raise IndexError ("MultibandFootprints can only be sliced in the band dimension" )
265
265
266
- if isinstance (filterIndex , slice ):
267
- singles = self .singles [filterIndex ]
266
+ if isinstance (bandIndex , slice ):
267
+ singles = self .singles [bandIndex ]
268
268
else :
269
- singles = [self .singles [idx ] for idx in filterIndex ]
269
+ singles = [self .singles [idx ] for idx in bandIndex ]
270
270
271
- return MultibandFootprint (filters , singles )
271
+ return MultibandFootprint (bands , singles )
272
272
273
273
def getImage (self , bbox = None , fill = np .nan , imageType = MultibandMaskedImage ):
274
274
"""Convert a `MultibandFootprint` to a `MultibandImage`
@@ -306,7 +306,7 @@ def getImage(self, bbox=None, fill=np.nan, imageType=MultibandMaskedImage):
306
306
else :
307
307
raise TypeError ("Expected imageType to be either MultibandImage or MultibandMaskedImage" )
308
308
maskedImages = [heavy .extractImage (fill , bbox , singleType ) for heavy in self .singles ]
309
- mMaskedImage = imageType .fromImages (self .filters , maskedImages )
309
+ mMaskedImage = imageType .fromImages (self .bands , maskedImages )
310
310
return mMaskedImage
311
311
312
312
def clone (self , deep = True ):
@@ -327,8 +327,8 @@ def clone(self, deep=True):
327
327
for peak in self .footprint .getPeaks ():
328
328
footprint .addPeak (peak .getX (), peak .getY (), peak .getValue ())
329
329
mMaskedImage = self .getImage ()
330
- filters = tuple ([f for f in self .filters ])
331
- result = MultibandFootprint .fromMaskedImages (filters , mMaskedImage , footprint )
330
+ bands = tuple ([f for f in self .bands ])
331
+ result = MultibandFootprint .fromMaskedImages (bands , mMaskedImage , footprint )
332
332
else :
333
- result = MultibandFootprint (self .filters , self .singles )
333
+ result = MultibandFootprint (self .bands , self .singles )
334
334
return result
0 commit comments