LSSTApplications  17.0+10,17.0+51,17.0+88,18.0.0+10,18.0.0+15,18.0.0+34,18.0.0+4,18.0.0+6,18.0.0-2-ge43143a+6,18.1.0-1-g0001055+2,18.1.0-1-g0896a44+10,18.1.0-1-g1349e88+9,18.1.0-1-g2505f39+7,18.1.0-1-g380d4d4+9,18.1.0-1-g5e4b7ea+2,18.1.0-1-g7e8fceb,18.1.0-1-g85f8cd4+7,18.1.0-1-g9a6769a+3,18.1.0-1-ga1a4c1a+6,18.1.0-1-gc037db8+2,18.1.0-1-gd55f500+3,18.1.0-1-ge10677a+7,18.1.0-10-g73b8679e+12,18.1.0-12-gf30922b,18.1.0-13-g451e75588,18.1.0-13-gbfe7f7f,18.1.0-2-g31c43f9+7,18.1.0-2-g9c63283+9,18.1.0-2-gdf0b915+9,18.1.0-2-gf03bb23+2,18.1.0-3-g52aa583+3,18.1.0-3-g8f4a2b1+1,18.1.0-3-g9cb968e+8,18.1.0-4-g7bbbad0,18.1.0-5-g510c42a+8,18.1.0-5-ga46117f,18.1.0-5-gaeab27e+9,18.1.0-6-gdda7f3e+11,18.1.0-8-g4084bf03+1,w.2019.34
LSSTDataManagementBasePackage
Classes | Functions
lsst.afw.detection.multiband Namespace Reference

Classes

class  MultibandFootprint
 

Functions

def getSpanSetFromImages (images, thresh=0, xy0=None)
 
def heavyFootprintToImage (heavy, fill=np.nan, bbox=None, imageType=MaskedImage)
 

Function Documentation

◆ getSpanSetFromImages()

def lsst.afw.detection.multiband.getSpanSetFromImages (   images,
  thresh = 0,
  xy0 = None 
)
Create a Footprint from a set of Images

Parameters
----------
images: `MultibandImage` or list of `Image`, array
    Images to extract the footprint from
thresh: `float`
    All pixels above `thresh` will be included in the footprint
xy0: `Point2I`
    Location of the minimum value of the images bounding box
    (if images is an array, otherwise the image bounding box is used).

Returns
-------
spans: `SpanSet`
    Union of all spans in the images above the threshold
imageBBox: `Box2I`
    Bounding box for the input images.

Definition at line 33 of file multiband.py.

33 def getSpanSetFromImages(images, thresh=0, xy0=None):
34  """Create a Footprint from a set of Images
35 
36  Parameters
37  ----------
38  images: `MultibandImage` or list of `Image`, array
39  Images to extract the footprint from
40  thresh: `float`
41  All pixels above `thresh` will be included in the footprint
42  xy0: `Point2I`
43  Location of the minimum value of the images bounding box
44  (if images is an array, otherwise the image bounding box is used).
45 
46  Returns
47  -------
48  spans: `SpanSet`
49  Union of all spans in the images above the threshold
50  imageBBox: `Box2I`
51  Bounding box for the input images.
52  """
53  # Set the threshold for each band
54  if not hasattr(thresh, "__len__"):
55  thresh = [thresh] * len(images)
56 
57  # If images is a list of `afw Image` objects then
58  # merge the SpanSet in each band into a single Footprint
59  if isinstance(images, MultibandBase) or isinstance(images[0], Image):
60  spans = SpanSet()
61  for n, image in enumerate(images):
62  mask = image.array > thresh[n]
63  mask = Mask(mask.astype(np.int32), xy0=image.getBBox().getMin())
64  spans = spans.union(SpanSet.fromMask(mask))
65  imageBBox = images[0].getBBox()
66  else:
67  # Use thresh to detect the pixels above the threshold in each band
68  thresh = np.array(thresh)
69  if xy0 is None:
70  xy0 = Point2I(0, 0)
71  mask = np.any(images > thresh[:, None, None], axis=0)
72  mask = Mask(mask.astype(np.int32), xy0=xy0)
73  spans = SpanSet.fromMask(mask)
74  imageBBox = mask.getBBox()
75  return spans, imageBBox
76 
77 
def getSpanSetFromImages(images, thresh=0, xy0=None)
Definition: multiband.py:33
Point< int, 2 > Point2I
Definition: Point.h:321

◆ heavyFootprintToImage()

def lsst.afw.detection.multiband.heavyFootprintToImage (   heavy,
  fill = np.nan,
  bbox = None,
  imageType = MaskedImage 
)
Create an image of a HeavyFootprint

Parameters
----------
heavy: `HeavyFootprint`
    The HeavyFootprint to insert into the image
fill: number
    Number to fill the pixels in the image that are not
    contained in `heavy`.
bbox: `Box2I`
    Bounding box of the output image.
imageType: `type`
    This should be either a `MaskedImage` or `Image` and describes
    the type of the output image.

Returns
-------
image: `MaskedImage` or `Image`
    An image defined by `bbox` and padded with `fill` that
    contains the projected flux in `heavy`.

Definition at line 78 of file multiband.py.

78 def heavyFootprintToImage(heavy, fill=np.nan, bbox=None, imageType=MaskedImage):
79  """Create an image of a HeavyFootprint
80 
81  Parameters
82  ----------
83  heavy: `HeavyFootprint`
84  The HeavyFootprint to insert into the image
85  fill: number
86  Number to fill the pixels in the image that are not
87  contained in `heavy`.
88  bbox: `Box2I`
89  Bounding box of the output image.
90  imageType: `type`
91  This should be either a `MaskedImage` or `Image` and describes
92  the type of the output image.
93 
94  Returns
95  -------
96  image: `MaskedImage` or `Image`
97  An image defined by `bbox` and padded with `fill` that
98  contains the projected flux in `heavy`.
99  """
100  if bbox is None:
101  bbox = heavy.getBBox()
102  image = imageType(bbox, dtype=heavy.getImageArray().dtype)
103  image.set(fill)
104  heavy.insert(image)
105  return image
106 
107 
def heavyFootprintToImage(heavy, fill=np.nan, bbox=None, imageType=MaskedImage)
Definition: multiband.py:78