120 """Create a snapshot thumbnail from input exposure.
122 The output thumbnail image is constructed based on the parameters
123 in the configuration file. Currently, the asinh mapping is the
124 only mapping method used.
128 exposure : `lsst.afw.image.Exposure`
129 The exposure to be converted into a thumbnail.
130 isrQaConfig : `Config`
131 Configuration object containing all parameters to control the
132 thumbnail generation.
136 rgbImage : `numpy.ndarray`
137 Binned and scaled version of the exposure, converted to an
138 integer array to allow it to be written as PNG.
140 if isrQaConfig
is not None:
141 binning = isrQaConfig.thumbnailBinning
142 binnedImage =
afwMath.binImage(exposure.getMaskedImage(), binning, binning, afwMath.MEAN)
145 statsCtrl.setAndMask(binnedImage.getMask().getPlaneBitMask([
"SAT",
"BAD",
"INTRP"]))
147 afwMath.MEDIAN | afwMath.STDEVCLIP | afwMath.MAX, statsCtrl)
149 low = stats.getValue(afwMath.MEDIAN) - isrQaConfig.thumbnailStdev*stats.getValue(afwMath.STDEVCLIP)
151 if isrQaConfig.thumbnailSatBorder:
152 afwRGB.replaceSaturatedPixels(binnedImage, binnedImage, binnedImage,
153 isrQaConfig.thumbnailSatBorder, stats.getValue(afwMath.MAX))
155 asinhMap = afwRGB.AsinhMapping(low, isrQaConfig.thumbnailRange, Q=isrQaConfig.thumbnailQ)
156 rgbImage = asinhMap.makeRgbImage(binnedImage)