LSSTApplications  18.0.0+53,19.0.0,19.0.0+1,19.0.0+15,19.0.0+16,19.0.0+18,19.0.0+23,19.0.0+3,19.0.0-1-g20d9b18+9,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+9,19.0.0-1-g6fe20d0+2,19.0.0-1-g8c57eb9+9,19.0.0-1-gbfe0924,19.0.0-1-gdc0e4a7+14,19.0.0-1-ge272bc4+9,19.0.0-1-ge3aa853+1,19.0.0-14-gbb28fe44,19.0.0-16-g8258e2a,19.0.0-2-g0d9f9cd+16,19.0.0-2-g260436e,19.0.0-2-g9b11441+3,19.0.0-2-gd955cfd+22,19.0.0-3-g6513920,19.0.0-3-gc4f6e04,19.0.0-4-g41ffa1d+2,19.0.0-4-g725f80e+18,19.0.0-4-g75300c1e,19.0.0-4-ga8eba22,19.0.0-5-g0745e3f,19.0.0-6-g6637c4fb6,19.0.0-6-gb6b8b0a,19.0.0-7-gea0a0fe+5,w.2020.03
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