LSST Applications 24.1.5,g02d81e74bb+fa3a7a026e,g180d380827+a53a32eff8,g2079a07aa2+86d27d4dc4,g2305ad1205+c0501b3732,g295015adf3+7d3e92f0ec,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g33d1c0ed96+0e5473021a,g3a166c0a6a+0e5473021a,g3ddfee87b4+5dd1654d75,g48712c4677+3bf1020dcb,g487adcacf7+065c13d9cf,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+d7ac436cfb,g5a732f18d5+53520f316c,g64a986408d+fa3a7a026e,g858d7b2824+fa3a7a026e,g8a8a8dda67+585e252eca,g99cad8db69+a5a909b84f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+4cf350ccb2,gb0e22166c9+60f28cb32d,gba4ed39666+c2a2e4ac27,gbb8dafda3b+f991a0b59f,gc120e1dc64+9ccbfdb8be,gc28159a63d+0e5473021a,gcf0d15dbbd+5dd1654d75,gd96a1ce819+42fd0ee607,gdaeeff99f8+f9a426f77a,ge6526c86ff+0d71447b4b,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gff1a9f87cc+fa3a7a026e
LSST Data Management Base Package
Loading...
Searching...
No Matches
Classes | Functions
lsst.afw.image._image._multiband Namespace Reference

Classes

class  MultibandImage
 
class  MultibandImageBase
 
class  MultibandMask
 
class  MultibandMaskedImage
 
class  MultibandPixel
 
class  MultibandTripleBase
 

Functions

 makeImageFromSingles (cls, filters, singles)
 
 makeImageFromKwargs (cls, filters, filterKwargs, singleType=ImageF, **kwargs)
 
 tripleFromSingles (cls, filters, singles, **kwargs)
 
 tripleFromArrays (cls, filters, image, mask, variance, bbox=None)
 
 makeTripleFromKwargs (cls, filters, filterKwargs, singleType, **kwargs)
 

Function Documentation

◆ makeImageFromKwargs()

lsst.afw.image._image._multiband.makeImageFromKwargs ( cls,
filters,
filterKwargs,
singleType = ImageF,
** kwargs )
Build a MultibandImage from a set of keyword arguments

Parameters
----------
filters : `list`
   List of filter names.
singleType : class
   Class of the single band objects.
   This is ignored unless `singles` and `array`
   are both `None`, in which case it is required.
filterKwargs : `dict`
   Keyword arguments to initialize a new instance of an inherited class
   that are different for each filter.
   The keys are the names of the arguments and the values
   should also be dictionaries, with filter names as keys
   and the value of the argument for a given filter as values.
kwargs : `dict`
   Keyword arguments to initialize a new instance of an
   inherited class that are the same in all bands.

Definition at line 297 of file _multiband.py.

297def makeImageFromKwargs(cls, filters, filterKwargs, singleType=ImageF, **kwargs):
298 """Build a MultibandImage from a set of keyword arguments
299
300 Parameters
301 ----------
302 filters : `list`
303 List of filter names.
304 singleType : class
305 Class of the single band objects.
306 This is ignored unless `singles` and `array`
307 are both `None`, in which case it is required.
308 filterKwargs : `dict`
309 Keyword arguments to initialize a new instance of an inherited class
310 that are different for each filter.
311 The keys are the names of the arguments and the values
312 should also be dictionaries, with filter names as keys
313 and the value of the argument for a given filter as values.
314 kwargs : `dict`
315 Keyword arguments to initialize a new instance of an
316 inherited class that are the same in all bands.
317 """
318 # Attempt to load a set of images
319 singles = []
320 for f in filters:
321 if filterKwargs is not None:
322 for key, value in filterKwargs:
323 kwargs[key] = value[f]
324 singles.append(singleType(**kwargs))
325 return cls.makeImageFromSingles(filters, singles)
326
327

◆ makeImageFromSingles()

lsst.afw.image._image._multiband.makeImageFromSingles ( cls,
filters,
singles )
Construct a MultibandImage from a collection of single band images

Parameters
----------
filters : `list`
   List of filter names.
singles : `list`
   A list of single band objects.
   If `array` is not `None`, then `singles` is ignored

Definition at line 279 of file _multiband.py.

279def makeImageFromSingles(cls, filters, singles):
280 """Construct a MultibandImage from a collection of single band images
281
282 Parameters
283 ----------
284 filters : `list`
285 List of filter names.
286 singles : `list`
287 A list of single band objects.
288 If `array` is not `None`, then `singles` is ignored
289 """
290 array = np.array([image.array for image in singles], dtype=singles[0].array.dtype)
291 if not np.all([image.getBBox() == singles[0].getBBox() for image in singles[1:]]):
292 raise ValueError("Single band images did not all have the same bounding box")
293 bbox = singles[0].getBBox()
294 return cls(filters, array, bbox)
295
296

◆ makeTripleFromKwargs()

lsst.afw.image._image._multiband.makeTripleFromKwargs ( cls,
filters,
filterKwargs,
singleType,
** kwargs )
Build a MultibandImage from a set of keyword arguments

Parameters
----------
filters : `list`
   List of filter names.
singleType : `class`
   Class of the single band objects.
   This is ignored unless `singles` and `array`
   are both `None`, in which case it is required.
filterKwargs : `dict`
   Keyword arguments to initialize a new instance of an inherited class
   that are different for each filter.
   The keys are the names of the arguments and the values
   should also be dictionaries, with filter names as keys
   and the value of the argument for a given filter as values.
kwargs : `dict`
   Keyword arguments to initialize a new instance of an inherited
   class that are the same in all bands.

Definition at line 770 of file _multiband.py.

770def makeTripleFromKwargs(cls, filters, filterKwargs, singleType, **kwargs):
771 """Build a MultibandImage from a set of keyword arguments
772
773 Parameters
774 ----------
775 filters : `list`
776 List of filter names.
777 singleType : `class`
778 Class of the single band objects.
779 This is ignored unless `singles` and `array`
780 are both `None`, in which case it is required.
781 filterKwargs : `dict`
782 Keyword arguments to initialize a new instance of an inherited class
783 that are different for each filter.
784 The keys are the names of the arguments and the values
785 should also be dictionaries, with filter names as keys
786 and the value of the argument for a given filter as values.
787 kwargs : `dict`
788 Keyword arguments to initialize a new instance of an inherited
789 class that are the same in all bands.
790 """
791 # Attempt to load a set of images
792 singles = []
793 for f in filters:
794 if filterKwargs is not None:
795 for key, value in filterKwargs:
796 kwargs[key] = value[f]
797 singles.append(singleType(**kwargs))
798 return tripleFromSingles(cls, filters, singles)
799
800

◆ tripleFromArrays()

lsst.afw.image._image._multiband.tripleFromArrays ( cls,
filters,
image,
mask,
variance,
bbox = None )
Construct a MultibandTriple from a set of arrays

Parameters
----------
filters : `list`
   List of filter names.
image : array
   Array of image values
mask : array
   Array of mask values
variance : array
   Array of variance values
bbox : `Box2I`
   Location of the array in a larger single band image.
   This argument is ignored if `singles` is not `None`.

Definition at line 739 of file _multiband.py.

739def tripleFromArrays(cls, filters, image, mask, variance, bbox=None):
740 """Construct a MultibandTriple from a set of arrays
741
742 Parameters
743 ----------
744 filters : `list`
745 List of filter names.
746 image : array
747 Array of image values
748 mask : array
749 Array of mask values
750 variance : array
751 Array of variance values
752 bbox : `Box2I`
753 Location of the array in a larger single band image.
754 This argument is ignored if `singles` is not `None`.
755 """
756 if bbox is None:
757 bbox = Box2I(Point2I(0, 0), Extent2I(image.shape[1], image.shape[0]))
758 mImage = MultibandImage(filters, image, bbox)
759 if mask is not None:
760 mMask = MultibandMask(filters, mask, bbox)
761 else:
762 mMask = None
763 if variance is not None:
764 mVariance = MultibandImage(filters, variance, bbox)
765 else:
766 mVariance = None
767 return cls(filters, mImage, mMask, mVariance)
768
769

◆ tripleFromSingles()

lsst.afw.image._image._multiband.tripleFromSingles ( cls,
filters,
singles,
** kwargs )
Construct a MultibandTriple from a collection of single band objects

Parameters
----------
filters : `list`
   List of filter names.
singles : `list`
   A list of single band objects.
   If `array` is not `None`, then `singles` is ignored

Definition at line 720 of file _multiband.py.

720def tripleFromSingles(cls, filters, singles, **kwargs):
721 """Construct a MultibandTriple from a collection of single band objects
722
723 Parameters
724 ----------
725 filters : `list`
726 List of filter names.
727 singles : `list`
728 A list of single band objects.
729 If `array` is not `None`, then `singles` is ignored
730 """
731 if not np.all([single.getBBox() == singles[0].getBBox() for single in singles[1:]]):
732 raise ValueError("Single band images did not all have the same bounding box")
733 image = MultibandImage.fromImages(filters, [s.image for s in singles])
734 mask = MultibandMask.fromMasks(filters, [s.mask for s in singles])
735 variance = MultibandImage.fromImages(filters, [s.variance for s in singles])
736 return cls(filters, image, mask, variance, **kwargs)
737
738