LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
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