LSST Applications  21.0.0+04719a4bac,21.0.0-1-ga51b5d4+4b710797af,21.0.0-1-gfc31b0f+3b24369756,21.0.0-10-g2408eff+50e97f2f47,21.0.0-10-g560fb7b+0803ad37c5,21.0.0-10-g5daeb2b+f9b8dc6d5a,21.0.0-10-g8d1d15d+77a6b82ebf,21.0.0-10-gcf60f90+c961be884d,21.0.0-11-g25eff31+7692554667,21.0.0-17-g6590b197+a14a01c114,21.0.0-2-g103fe59+b79afc2051,21.0.0-2-g1367e85+1003a3501c,21.0.0-2-g45278ab+04719a4bac,21.0.0-2-g5242d73+1003a3501c,21.0.0-2-g7f82c8f+c2a1919b98,21.0.0-2-g8f08a60+fd0b970de5,21.0.0-2-ga326454+c2a1919b98,21.0.0-2-gde069b7+ca45a81b40,21.0.0-2-gecfae73+afcaaec585,21.0.0-2-gfc62afb+1003a3501c,21.0.0-21-g5d80ea29e+5e3c9a3766,21.0.0-3-g357aad2+c67f36f878,21.0.0-3-g4be5c26+1003a3501c,21.0.0-3-g65f322c+02b1f88459,21.0.0-3-g7d9da8d+3b24369756,21.0.0-3-ge02ed75+a423c2ae7a,21.0.0-4-g591bb35+a423c2ae7a,21.0.0-4-g65b4814+0803ad37c5,21.0.0-4-g88306b8+199c7497e5,21.0.0-4-gccdca77+a631590478,21.0.0-4-ge8a399c+b923ff878e,21.0.0-5-gd00fb1e+d8b1e95daa,21.0.0-53-ge728e5d5+3cb64fea8e,21.0.0-6-g2d4f3f3+04719a4bac,21.0.0-7-g04766d7+8d320c19d5,21.0.0-7-g98eecf7+205433fbda,21.0.0-9-g39e06b5+a423c2ae7a,master-gac4afde19b+a423c2ae7a,w.2021.11
LSST Data Management Base Package
Classes | Functions
lsst.afw.image.image.multiband Namespace Reference

Classes

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

Functions

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

Function Documentation

◆ makeImageFromKwargs()

def 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.

297 def 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 
def makeImageFromKwargs(cls, filters, filterKwargs, singleType=ImageF, **kwargs)
Definition: multiband.py:297

◆ makeImageFromSingles()

def 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.

279 def 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 
def makeImageFromSingles(cls, filters, singles)
Definition: multiband.py:279

◆ makeTripleFromKwargs()

def 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.

770 def 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 
def makeTripleFromKwargs(cls, filters, filterKwargs, singleType, **kwargs)
Definition: multiband.py:770
def tripleFromSingles(cls, filters, singles, **kwargs)
Definition: multiband.py:720

◆ tripleFromArrays()

def 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.

739 def 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 
def tripleFromArrays(cls, filters, image, mask, variance, bbox=None)
Definition: multiband.py:739
Extent< int, 2 > Extent2I
Definition: Extent.h:397
Point< int, 2 > Point2I
Definition: Point.h:321

◆ tripleFromSingles()

def 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.

720 def 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