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 | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
lsst.afw.image._image._multiband.MultibandTripleBase Class Reference
Inheritance diagram for lsst.afw.image._image._multiband.MultibandTripleBase:
lsst.afw.multiband.MultibandBase lsst.afw.image._exposure._multiband.MultibandExposure lsst.afw.image._image._multiband.MultibandMaskedImage

Public Member Functions

 __init__ (self, filters, image, mask, variance)
 
 setXY0 (self, xy0)
 
 shiftedTo (self, xy0)
 
 clone (self, deep=True)
 
 image (self)
 
 mask (self)
 
 variance (self)
 
 getBBox (self, origin=PARENT)
 

Public Attributes

 filters
 

Protected Member Functions

 _slice (self, filters, filterIndex, indices)
 
 _verifyUpdate (self, image=None, mask=None, variance=None)
 

Protected Attributes

 _filters
 
 _image
 
 _mask
 
 _variance
 
 _singles
 
 _bbox
 

Detailed Description

MultibandTripleBase class

This is a base class inherited by multiband classes
with `image`, `mask`, and `variance` objects,
such as `MultibandMaskedImage` and `MultibandExposure`.

Parameters
----------
filters : `list`
   List of filter names. If `singles` is an `OrderedDict`
   then this argument is ignored, otherwise it is required.
image : `list` or `MultibandImage`
   List of `Image` objects that represent the image in each band or
   a `MultibandImage`.
   Ignored if `singles` is not `None`.
mask : `list` or `MultibandMask`
   List of `Mask` objects that represent the mask in each bandor
   a `MultibandMask`.
   Ignored if `singles` is not `None`.
variance : `list` or `MultibandImage`
   List of `Image` objects that represent the variance in each bandor
   a `MultibandImage`.
   Ignored if `singles` is not `None`.

Definition at line 554 of file _multiband.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.afw.image._image._multiband.MultibandTripleBase.__init__ ( self,
filters,
image,
mask,
variance )

Reimplemented from lsst.afw.multiband.MultibandBase.

Reimplemented in lsst.afw.image._exposure._multiband.MultibandExposure, and lsst.afw.image._image._multiband.MultibandMaskedImage.

Definition at line 579 of file _multiband.py.

579 def __init__(self, filters, image, mask, variance):
580 self._filters = tuple(filters)
581 # Convert single band images into multiband images
582 if not isinstance(image, MultibandBase):
583 image = MultibandImage.fromImages(filters, image)
584 if mask is not None:
585 mask = MultibandMask.fromMasks(filters, mask)
586 if variance is not None:
587 variance = MultibandImage.fromImages(filters, variance)
588 self._image = image
589 self._mask = mask
590 self._variance = variance
591
592 self._singles = self._buildSingles(self._image, self._mask, self._variance)
593 self._bbox = self.singles[0].getBBox()
594

Member Function Documentation

◆ _slice()

lsst.afw.image._image._multiband.MultibandTripleBase._slice ( self,
filters,
filterIndex,
indices )
protected
Slice the current object and return the result

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

Reimplemented from lsst.afw.multiband.MultibandBase.

Reimplemented in lsst.afw.image._exposure._multiband.MultibandExposure.

Definition at line 653 of file _multiband.py.

653 def _slice(self, filters, filterIndex, indices):
654 """Slice the current object and return the result
655
656 See `Multiband._slice` for a list of the parameters.
657 """
658 image = self.image._slice(filters, filterIndex, indices)
659 if self.mask is not None:
660 mask = self._mask._slice(filters, filterIndex, indices)
661 else:
662 mask = None
663 if self.variance is not None:
664 variance = self._variance._slice(filters, filterIndex, indices)
665 else:
666 variance = None
667
668 # If only a single pixel is selected, return the tuple of MultibandPixels
669 if isinstance(image, MultibandPixel):
670 if mask is not None:
671 assert isinstance(mask, MultibandPixel)
672 if variance is not None:
673 assert isinstance(variance, MultibandPixel)
674 return (image, mask, variance)
675
676 result = type(self)(filters=filters, image=image, mask=mask, variance=variance)
677 assert all([r.getBBox() == result._bbox for r in [result._mask, result._variance]])
678 return result
679

◆ _verifyUpdate()

lsst.afw.image._image._multiband.MultibandTripleBase._verifyUpdate ( self,
image = None,
mask = None,
variance = None )
protected
Check that the new image, mask, or variance is valid

This basically means checking that the update to the
property matches the current bounding box and inherits
from the `MultibandBase` class.

Definition at line 680 of file _multiband.py.

680 def _verifyUpdate(self, image=None, mask=None, variance=None):
681 """Check that the new image, mask, or variance is valid
682
683 This basically means checking that the update to the
684 property matches the current bounding box and inherits
685 from the `MultibandBase` class.
686 """
687 for prop in [image, mask, variance]:
688 if prop is not None:
689 if prop.getBBox() != self.getBBox():
690 raise ValueError("Bounding box does not match the current class")
691 if not isinstance(prop, MultibandBase):
692 err = "image, mask, and variance should all inherit from the MultibandBase class"
693 raise ValueError(err)
694

◆ clone()

lsst.afw.image._image._multiband.MultibandTripleBase.clone ( self,
deep = True )
Make a copy of the current instance

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 639 of file _multiband.py.

639 def clone(self, deep=True):
640 """Make a copy of the current instance
641 """
642 image = self.image.clone(deep)
643 if self.mask is not None:
644 mask = self.mask.clone(deep)
645 else:
646 mask = None
647 if self.variance is not None:
648 variance = self.variance.clone(deep)
649 else:
650 variance = None
651 return type(self)(self.filters, image, mask, variance)
652

◆ getBBox()

lsst.afw.image._image._multiband.MultibandTripleBase.getBBox ( self,
origin = PARENT )
Bounding box

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 710 of file _multiband.py.

710 def getBBox(self, origin=PARENT):
711 """Bounding box
712 """
713 if origin == PARENT:
714 return self._bbox
715 elif origin == LOCAL:
716 return Box2I(Point2I(0, 0), self._bbox.getDimensions())
717 raise ValueError("Unrecognized origin, expected either PARENT or LOCAL")
718
719

◆ image()

lsst.afw.image._image._multiband.MultibandTripleBase.image ( self)
The image of the MultibandMaskedImage

Definition at line 696 of file _multiband.py.

696 def image(self):
697 """The image of the MultibandMaskedImage"""
698 return self._image
699
afw::table::Key< afw::table::Array< ImagePixelT > > image

◆ mask()

lsst.afw.image._image._multiband.MultibandTripleBase.mask ( self)
The mask of the MultibandMaskedImage

Definition at line 701 of file _multiband.py.

701 def mask(self):
702 """The mask of the MultibandMaskedImage"""
703 return self._mask
704
afw::table::Key< afw::table::Array< MaskPixelT > > mask

◆ setXY0()

lsst.afw.image._image._multiband.MultibandTripleBase.setXY0 ( self,
xy0 )
Shift the bounding box but keep the same Extent
This is different than `MultibandBase.setXY0`
because the multiband `image`, `mask`, and `variance` objects
must all have their bounding boxes updated.
Parameters
----------
xy0 : `Point2I`
   New minimum bounds of the bounding box

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 595 of file _multiband.py.

595 def setXY0(self, xy0):
596 """Shift the bounding box but keep the same Extent
597 This is different than `MultibandBase.setXY0`
598 because the multiband `image`, `mask`, and `variance` objects
599 must all have their bounding boxes updated.
600 Parameters
601 ----------
602 xy0 : `Point2I`
603 New minimum bounds of the bounding box
604 """
605 super().setXY0(xy0)
606 self.image.setXY0(xy0)
607 if self.mask is not None:
608 self.mask.setXY0(xy0)
609 if self.variance is not None:
610 self.variance.setXY0(xy0)
611

◆ shiftedTo()

lsst.afw.image._image._multiband.MultibandTripleBase.shiftedTo ( self,
xy0 )
Shift the bounding box but keep the same Extent

This is different than `MultibandBase.shiftedTo`
because the multiband `image`, `mask`, and `variance` objects
must all have their bounding boxes updated.

Parameters
----------
xy0 : `Point2I`
   New minimum bounds of the bounding box

Returns
-------
result : `MultibandBase`
   A copy of the object, shifted to `xy0`.

Reimplemented from lsst.afw.multiband.MultibandBase.

Definition at line 612 of file _multiband.py.

612 def shiftedTo(self, xy0):
613 """Shift the bounding box but keep the same Extent
614
615 This is different than `MultibandBase.shiftedTo`
616 because the multiband `image`, `mask`, and `variance` objects
617 must all have their bounding boxes updated.
618
619 Parameters
620 ----------
621 xy0 : `Point2I`
622 New minimum bounds of the bounding box
623
624 Returns
625 -------
626 result : `MultibandBase`
627 A copy of the object, shifted to `xy0`.
628 """
629 raise NotImplementedError("shiftedTo not implemented until DM-10781")
630 result = self.clone(False)
631 result._image = result.image.shiftedTo(xy0)
632 if self.mask is not None:
633 result._mask = result.mask.shiftedTo(xy0)
634 if self.variance is not None:
635 result._variance = result.variance.shiftedTo(xy0)
636 result._bbox = result.image.getBBox()
637 return result
638

◆ variance()

lsst.afw.image._image._multiband.MultibandTripleBase.variance ( self)
The variance of the MultibandMaskedImage

Definition at line 706 of file _multiband.py.

706 def variance(self):
707 """The variance of the MultibandMaskedImage"""
708 return self._variance
709
afw::table::Key< afw::table::Array< VariancePixelT > > variance

Member Data Documentation

◆ _bbox

lsst.afw.image._image._multiband.MultibandTripleBase._bbox
protected

Definition at line 593 of file _multiband.py.

◆ _filters

lsst.afw.image._image._multiband.MultibandTripleBase._filters
protected

Definition at line 580 of file _multiband.py.

◆ _image

lsst.afw.image._image._multiband.MultibandTripleBase._image
protected

Definition at line 588 of file _multiband.py.

◆ _mask

lsst.afw.image._image._multiband.MultibandTripleBase._mask
protected

Definition at line 589 of file _multiband.py.

◆ _singles

lsst.afw.image._image._multiband.MultibandTripleBase._singles
protected

Definition at line 592 of file _multiband.py.

◆ _variance

lsst.afw.image._image._multiband.MultibandTripleBase._variance
protected

Definition at line 590 of file _multiband.py.

◆ filters

lsst.afw.image._image._multiband.MultibandTripleBase.filters

Definition at line 651 of file _multiband.py.


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