1 from __future__
import absolute_import, division, print_function
5 from scipy.ndimage
import gaussian_filter
14 from lsst.pex.config import Config, Field, ListField, ChoiceField, ConfigField, RangeField, ConfigurableField
19 """Measure a robust mean of an array 23 array : `numpy.ndarray` 24 Array for which to measure the mean. 26 k-sigma rejection threshold. 31 Robust mean of `array`. 33 q1, median, q3 = numpy.percentile(array, [25.0, 50.0, 100.0])
34 good = numpy.abs(array - median) < rej*0.74*(q3 - q1)
35 return array[good].mean()
39 """Configuration for background measurement""" 40 statistic =
ChoiceField(dtype=str, default=
"MEANCLIP", doc=
"type of statistic to use for grid points",
41 allowed={
"MEANCLIP":
"clipped mean",
42 "MEAN":
"unclipped mean",
44 xBinSize =
RangeField(dtype=int, default=32, min=1, doc=
"Superpixel size in x")
45 yBinSize =
RangeField(dtype=int, default=32, min=1, doc=
"Superpixel size in y")
46 algorithm =
ChoiceField(dtype=str, default=
"NATURAL_SPLINE", optional=
True,
47 doc=
"How to interpolate the background values. " 48 "This maps to an enum; see afw::math::Background",
50 "CONSTANT":
"Use a single constant value",
51 "LINEAR":
"Use linear interpolation",
52 "NATURAL_SPLINE":
"cubic spline with zero second derivative at endpoints",
53 "AKIMA_SPLINE":
"higher-level nonlinear spline that is more robust" 55 "NONE":
"No background estimation is to be attempted",
57 mask =
ListField(dtype=str, default=[
"SAT",
"BAD",
"EDGE",
"DETECTED",
"DETECTED_NEGATIVE",
"NO_DATA"],
58 doc=
"Names of mask planes to ignore while estimating the background")
62 """Parameters controlling the measurement of sky statistics""" 63 statistic =
ChoiceField(dtype=str, default=
"MEANCLIP", doc=
"type of statistic to use for grid points",
64 allowed={
"MEANCLIP":
"clipped mean",
65 "MEAN":
"unclipped mean",
67 clip =
Field(doc=
"Clipping threshold for background", dtype=float, default=3.0)
68 nIter =
Field(doc=
"Clipping iterations for background", dtype=int, default=3)
69 mask =
ListField(doc=
"Mask planes to reject", dtype=str,
70 default=[
"SAT",
"DETECTED",
"DETECTED_NEGATIVE",
"BAD",
"NO_DATA"])
74 """Configuration for SkyMeasurementTask""" 75 skyIter =
Field(dtype=int, default=3, doc=
"k-sigma rejection iterations for sky scale")
76 skyRej =
Field(dtype=float, default=3.0, doc=
"k-sigma rejection threshold for sky scale")
77 background =
ConfigField(dtype=BackgroundConfig, doc=
"Background measurement")
78 xNumSamples =
Field(dtype=int, default=4, doc=
"Number of samples in x for scaling sky frame")
79 yNumSamples =
Field(dtype=int, default=4, doc=
"Number of samples in y for scaling sky frame")
80 stats =
ConfigField(dtype=SkyStatsConfig, doc=
"Measurement of sky statistics in the samples")
84 """Task for creating, persisting and using sky frames 86 A sky frame is like a fringe frame (the sum of many exposures of the night sky, 87 combined with rejection to remove astrophysical objects) except the structure 88 is on larger scales, and hence we bin the images and represent them as a 89 background model (a `lsst.afw.math.BackgroundMI`). The sky frame represents 90 the dominant response of the camera to the sky background. 92 ConfigClass = SkyMeasurementConfig
95 """Retrieve sky frame from the butler 99 butler : `lsst.daf.persistence.Butler` 102 Data identifier for calib 106 sky : `lsst.afw.math.BackgroundList` 109 exp = butler.get(
"sky", calibId)
114 """Convert an exposure to background model 116 Calibs need to be persisted as an Exposure, so we need to convert 117 the persisted Exposure to a background model. 121 bgExp : `lsst.afw.image.Exposure` 122 Background model in Exposure format. 126 bg : `lsst.afw.math.BackgroundList` 129 header = bgExp.getMetadata()
130 xMin = header.getScalar(
"BOX.MINX")
131 yMin = header.getScalar(
"BOX.MINY")
132 xMax = header.getScalar(
"BOX.MAXX")
133 yMax = header.getScalar(
"BOX.MAXY")
134 algorithm = header.getScalar(
"ALGORITHM")
140 afwMath.ApproximateControl.UNKNOWN,
144 """Convert a background model to an exposure 146 Calibs need to be persisted as an Exposure, so we need to convert 147 the background model to an Exposure. 151 statsImage : `lsst.afw.image.MaskedImageF` 152 Background model's statistics image. 153 bbox : `lsst.afw.geom.Box2I` 154 Bounding box for image. 158 exp : `lsst.afw.image.Exposure` 159 Background model in Exposure format. 162 header = exp.getMetadata()
163 header.set(
"BOX.MINX", bbox.getMinX())
164 header.set(
"BOX.MINY", bbox.getMinY())
165 header.set(
"BOX.MAXX", bbox.getMaxX())
166 header.set(
"BOX.MAXY", bbox.getMaxY())
167 header.set(
"ALGORITHM", self.
config.background.algorithm)
171 """Measure a background model for image 173 This doesn't use a full-featured background model (e.g., no Chebyshev 174 approximation) because we just want the binning behaviour. This will 175 allow us to average the bins later (`averageBackgrounds`). 177 The `BackgroundMI` is wrapped in a `BackgroundList` so it can be 178 pickled and persisted. 182 image : `lsst.afw.image.MaskedImage` 183 Image for which to measure background. 187 bgModel : `lsst.afw.math.BackgroundList` 191 stats.setAndMask(image.getMask().getPlaneBitMask(self.
config.background.mask))
192 stats.setNanSafe(
True)
194 self.
config.background.algorithm,
195 max(
int(image.getWidth()/self.
config.background.xBinSize + 0.5), 1),
196 max(
int(image.getHeight()/self.
config.background.yBinSize + 0.5), 1),
197 "REDUCE_INTERP_ORDER",
199 self.
config.background.statistic
208 afwMath.ApproximateControl.UNKNOWN,
213 """Average multiple background models 215 The input background models should be a `BackgroundList` consisting 216 of a single `BackgroundMI`. 220 bgList : `list` of `lsst.afw.math.BackgroundList` 221 Background models to average. 225 bgExp : `lsst.afw.image.Exposure` 226 Background model in Exposure format. 228 assert all(len(bg) == 1
for bg
in bgList),
"Mixed bgList: %s" % ([len(bg)
for bg
in bgList],)
229 images = [bg[0][0].getStatsImage()
for bg
in bgList]
230 boxes = [bg[0][0].getImageBBox()
for bg
in bgList]
231 assert len(
set((box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY())
for box
in boxes)) == 1, \
232 "Bounding boxes not all equal" 236 maskVal = afwImage.Mask.getPlaneBitMask(
"BAD")
238 bad = numpy.isnan(img.getImage().getArray())
239 img.getMask().getArray()[bad] = maskVal
242 stats.setAndMask(maskVal)
243 stats.setNanSafe(
True)
250 array = combined.getImage().getArray()
251 bad = numpy.isnan(array)
252 median = numpy.median(array[~bad])
259 """Measure scale of background model in image 261 We treat the sky frame much as we would a fringe frame 262 (except the length scale of the variations is different): 263 we measure samples on the input image and the sky frame, 264 which we will use to determine the scaling factor in the 265 'solveScales` method. 269 image : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage` 270 Science image for which to measure scale. 271 skyBackground : `lsst.afw.math.BackgroundList` 272 Sky background model. 276 imageSamples : `numpy.ndarray` 277 Sample measurements on image. 278 skySamples : `numpy.ndarray` 279 Sample measurements on sky frame. 282 image = image.getMaskedImage()
284 xNumSamples =
min(self.
config.xNumSamples, image.getWidth())
285 yNumSamples =
min(self.
config.yNumSamples, image.getHeight())
286 xLimits = numpy.linspace(0, image.getWidth(), xNumSamples + 1, dtype=int)
287 yLimits = numpy.linspace(0, image.getHeight(), yNumSamples + 1, dtype=int)
288 sky = skyBackground.getImage()
289 maskVal = image.getMask().getPlaneBitMask(self.
config.stats.mask)
294 for xIndex, yIndex
in itertools.product(range(xNumSamples), range(yNumSamples)):
296 xStart, xStop = xLimits[xIndex], xLimits[xIndex + 1] - 1
297 yStart, yStop = yLimits[yIndex], yLimits[yIndex + 1] - 1
299 subImage = image.Factory(image, box)
300 subSky = sky.Factory(sky, box)
303 return imageSamples, skySamples
306 """Solve multiple scales for a single scale factor 308 Having measured samples from the image and sky frame, we 309 fit for the scaling factor. 313 scales : `list` of a `tuple` of two `numpy.ndarray` arrays 314 A `list` of the results from `measureScale` method. 323 for ii, ss
in scales:
324 imageSamples.extend(ii)
325 skySamples.extend(ss)
326 assert len(imageSamples) == len(skySamples)
327 imageSamples = numpy.array(imageSamples)
328 skySamples = numpy.array(skySamples)
331 return afwMath.LeastSquares.fromDesignMatrix(skySamples[mask].reshape(mask.sum(), 1),
333 afwMath.LeastSquares.DIRECT_SVD).getSolution()
335 mask = numpy.isfinite(imageSamples) & numpy.isfinite(skySamples)
336 for ii
in range(self.
config.skyIter):
337 solution = solve(mask)
338 residuals = imageSamples - solution*skySamples
339 lq, uq = numpy.percentile(residuals[mask], [25, 75])
340 stdev = 0.741*(uq - lq)
341 with numpy.errstate(invalid=
"ignore"):
342 bad = numpy.abs(residuals) > self.
config.skyRej*stdev
348 """Subtract sky frame from science image 352 image : `lsst.afw.image.Exposure` or `lsst.afw.image.MaskedImage` 354 skyBackground : `lsst.afw.math.BackgroundList` 355 Sky background model. 357 Scale to apply to background model. 358 bgList : `lsst.afw.math.BackgroundList` 359 List of backgrounds applied to image 362 image = image.getMaskedImage()
364 image = image.getImage()
365 image.scaledMinus(scale, skyBackground.getImage())
366 if bgList
is not None:
368 bgData =
list(skyBackground[0])
370 statsImage = bg.getStatsImage().
clone()
373 newBgData = [newBg] + bgData[1:]
374 bgList.append(newBgData)
378 """Interpolate in one dimension 380 Interpolates the curve provided by `xSample` and `ySample` at 381 the positions of `xInterp`. Automatically backs off the 382 interpolation method to achieve successful interpolation. 386 method : `lsst.afw.math.Interpolate.Style` 387 Interpolation method to use. 388 xSample : `numpy.ndarray` 390 ySample : `numpy.ndarray` 391 Vector of coordinates. 392 xInterp : `numpy.ndarray` 393 Vector of ordinates to which to interpolate. 397 yInterp : `numpy.ndarray` 398 Vector of interpolated coordinates. 401 if len(xSample) == 0:
402 return numpy.ones_like(xInterp)*numpy.nan
407 if method == afwMath.Interpolate.CONSTANT:
409 return numpy.ones_like(xInterp)*numpy.nan
411 if newMethod == method:
412 newMethod = afwMath.Interpolate.CONSTANT
417 """Interpolate bad pixels in an image array 419 The bad pixels are modified in the array. 423 array : `numpy.ndarray` 424 Image array with bad pixels. 425 isBad : `numpy.ndarray` of type `bool` 426 Boolean array indicating which pixels are bad. 427 interpolationStyle : `str` 428 Style for interpolation (see `lsst.afw.math.Background`); 429 supported values are CONSTANT, LINEAR, NATURAL_SPLINE, 433 raise RuntimeError(
"No good pixels in image array")
434 height, width = array.shape
435 xIndices = numpy.arange(width, dtype=float)
436 yIndices = numpy.arange(height, dtype=float)
439 for y
in range(height):
440 if numpy.any(isBad[y, :])
and numpy.any(isGood[y, :]):
441 array[y][isBad[y]] =
interpolate1D(method, xIndices[isGood[y]], array[y][isGood[y]],
444 isBad = numpy.isnan(array)
446 for x
in range(width):
447 if numpy.any(isBad[:, x])
and numpy.any(isGood[:, x]):
448 array[:, x][isBad[:, x]] =
interpolate1D(method, yIndices[isGood[:, x]],
449 array[:, x][isGood[:, x]], yIndices[isBad[:, x]])
453 """Configuration for FocalPlaneBackground 455 Note that `xSize` and `ySize` are floating-point values, as 456 the focal plane frame is usually defined in units of microns 457 or millimetres rather than pixels. As such, their values will 458 need to be revised according to each particular camera. For 459 this reason, no defaults are set for those. 461 xSize =
Field(dtype=float, doc=
"Bin size in x")
462 ySize =
Field(dtype=float, doc=
"Bin size in y")
463 minFrac =
Field(dtype=float, default=0.1, doc=
"Minimum fraction of bin size for good measurement")
464 mask =
ListField(dtype=str, doc=
"Mask planes to treat as bad",
465 default=[
"BAD",
"SAT",
"INTRP",
"DETECTED",
"DETECTED_NEGATIVE",
"EDGE",
"NO_DATA"])
467 doc=
"how to interpolate the background values. This maps to an enum; see afw::math::Background",
468 dtype=str, default=
"AKIMA_SPLINE", optional=
True,
470 "CONSTANT":
"Use a single constant value",
471 "LINEAR":
"Use linear interpolation",
472 "NATURAL_SPLINE":
"cubic spline with zero second derivative at endpoints",
473 "AKIMA_SPLINE":
"higher-level nonlinear spline that is more robust to outliers",
474 "NONE":
"No background estimation is to be attempted",
477 doSmooth =
Field(dtype=bool, default=
False, doc=
"Do smoothing?")
478 smoothScale =
Field(dtype=float, default=2.0, doc=
"Smoothing scale, as a multiple of the bin size")
479 binning =
Field(dtype=int, default=64, doc=
"Binning to use for CCD background model (pixels)")
483 """Background model for a focal plane camera 485 We model the background empirically with the "superpixel" method: we 486 measure the background in each superpixel and interpolate between 487 superpixels to yield the model. 489 The principal difference between this and `lsst.afw.math.BackgroundMI` 490 is that here the superpixels are defined in the frame of the focal 491 plane of the camera which removes discontinuities across detectors. 493 The constructor you probably want to use is the `fromCamera` classmethod. 495 There are two use patterns for building a background model: 497 * Serial: create a `FocalPlaneBackground`, then `addCcd` for each of the 500 * Parallel: create a `FocalPlaneBackground`, then `clone` it for each 501 of the CCDs in an exposure and use those to `addCcd` their respective 502 CCD image. Finally, `merge` all the clones into the original. 504 Once you've built the background model, you can apply it to individual 505 CCDs with the `toCcdBackground` method. 509 """Construct from a camera object 513 config : `FocalPlaneBackgroundConfig` 514 Configuration for measuring backgrounds. 515 camera : `lsst.afw.cameraGeom.Camera` 516 Camera for which to measure backgrounds. 520 for point
in ccd.getCorners(afwCameraGeom.FOCAL_PLANE):
521 cameraBox.include(point)
523 width, height = cameraBox.getDimensions()
528 int(numpy.ceil(height/config.ySize)) + 2)
530 transform = (afwGeom.AffineTransform.makeTranslation(
afwGeom.Extent2D(1, 1))*
531 afwGeom.AffineTransform.makeScaling(1.0/config.xSize, 1.0/config.ySize)*
532 afwGeom.AffineTransform.makeTranslation(offset))
536 def __init__(self, config, dims, transform, values=None, numbers=None):
539 Developers should note that changes to the signature of this method 540 require coordinated changes to the `__reduce__` and `clone` methods. 544 config : `FocalPlaneBackgroundConfig` 545 Configuration for measuring backgrounds. 546 dims : `lsst.afw.geom.Extent2I` 547 Dimensions for background samples. 548 transform : `lsst.afw.geom.TransformPoint2ToPoint2` 549 Transformation from focal plane coordinates to sample coordinates. 550 values : `lsst.afw.image.ImageF` 551 Measured background values. 552 numbers : `lsst.afw.image.ImageF` 553 Number of pixels in each background measurement. 560 values = afwImage.ImageF(self.
dims)
563 values = values.clone()
564 assert(values.getDimensions() == self.
dims)
567 numbers = afwImage.ImageF(self.
dims)
570 numbers = numbers.clone()
571 assert(numbers.getDimensions() == self.
dims)
583 We measure the background on the CCD (clipped mean), and record 584 the results in the model. For simplicity, measurements are made 585 in a box on the CCD corresponding to the warped coordinates of the 586 superpixel rather than accounting for little rotations, etc. 587 We also record the number of pixels used in the measurement so we 588 can have a measure of confidence in each bin's value. 592 exposure : `lsst.afw.image.Exposure` 593 CCD exposure to measure 595 detector = exposure.getDetector()
596 transform = detector.getTransformMap().getTransform(detector.makeCameraSys(afwCameraGeom.PIXELS),
597 detector.makeCameraSys(afwCameraGeom.FOCAL_PLANE))
598 image = exposure.getMaskedImage()
599 maskVal = image.getMask().getPlaneBitMask(self.
config.mask)
602 toSample = transform.then(self.
transform)
604 warped = afwImage.ImageF(self.
_values.getBBox())
605 warpedCounts = afwImage.ImageF(self.
_numbers.getBBox())
606 width, height = warped.getDimensions()
609 stats.setAndMask(maskVal)
610 stats.setNanSafe(
True)
612 pixels = itertools.product(range(width), range(height))
613 for xx, yy
in pixels:
617 bbox.clip(image.getBBox())
620 subImage = image.Factory(image, bbox)
622 mean = result.getValue(afwMath.MEANCLIP)
623 num = result.getValue(afwMath.NPOINT)
624 if not numpy.isfinite(mean)
or not numpy.isfinite(num):
626 warped[xx, yy, afwImage.LOCAL] = mean*num
627 warpedCounts[xx, yy, afwImage.LOCAL] = num
633 """Produce a background model for a CCD 635 The superpixel background model is warped back to the 636 CCD frame, for application to the individual CCD. 640 detector : `lsst.afw.cameraGeom.Detector` 641 CCD for which to produce background model. 642 bbox : `lsst.afw.geom.Box2I` 643 Bounding box of CCD exposure. 647 bg : `lsst.afw.math.BackgroundList` 648 Background model for CCD. 650 transform = detector.getTransformMap().getTransform(detector.makeCameraSys(afwCameraGeom.PIXELS),
651 detector.makeCameraSys(afwCameraGeom.FOCAL_PLANE))
652 binTransform = (afwGeom.AffineTransform.makeScaling(self.
config.binning)*
659 fpNorm = afwImage.ImageF(focalPlane.getBBox())
662 image = afwImage.ImageF(bbox.getDimensions()//self.
config.binning)
663 norm = afwImage.ImageF(image.getBBox())
670 isBad = numpy.isnan(image.getArray())
671 mask.getArray()[isBad] = mask.getPlaneBitMask(
"BAD")
672 image.getArray()[isBad] = image.getArray()[~isBad].mean()
678 afwMath.ApproximateControl.UNKNOWN,
683 """Merge with another FocalPlaneBackground 685 This allows multiple background models to be constructed from 686 different CCDs, and then merged to form a single consistent 687 background model for the entire focal plane. 691 other : `FocalPlaneBackground` 692 Another background model to merge. 696 self : `FocalPlaneBackground` 697 The merged background model. 699 if (self.
config.xSize, self.
config.ySize) != (other.config.xSize, other.config.ySize):
700 raise RuntimeError(
"Size mismatch: %s vs %s" % ((self.
config.xSize, self.
config.ySize),
701 (other.config.xSize, other.config.ySize)))
702 if self.
dims != other.dims:
703 raise RuntimeError(
"Dimensions mismatch: %s vs %s" % (self.
dims, other.dims))
709 """Merge with another FocalPlaneBackground 713 other : `FocalPlaneBackground` 714 Another background model to merge. 718 self : `FocalPlaneBackground` 719 The merged background model. 721 return self.
merge(other)
724 """Return the background model data 726 This is the measurement of the background for each of the superpixels. 731 isBad = self.
_numbers.getArray() < thresh
733 array = values.getArray()
735 isBad = numpy.isnan(values.array)
742 """Configuration for MaskObjectsTask""" 743 nIter =
Field(dtype=int, default=3, doc=
"Number of iterations")
745 doc=
"Background subtraction")
747 detectSigma =
Field(dtype=float, default=5.0, doc=
"Detection threshold (standard deviations)")
748 doInterpolate =
Field(dtype=bool, default=
True, doc=
"Interpolate when removing objects?")
752 self.
detection.reEstimateBackground =
False 753 self.
detection.doTempLocalBackground =
False 754 self.
detection.doTempWideBackground =
False 762 if (self.
detection.reEstimateBackground
or 765 raise RuntimeError(
"Incorrect settings for object masking: reEstimateBackground, " 766 "doTempLocalBackground and doTempWideBackground must be False")
770 """Iterative masking of objects on an Exposure 772 This task makes more exhaustive object mask by iteratively doing detection 773 and background-subtraction. The purpose of this task is to get true 774 background removing faint tails of large objects. This is useful to get a 775 clean sky estimate from relatively small number of visits. 777 We deliberately use the specified ``detectSigma`` instead of the PSF, 778 in order to better pick up the faint wings of objects. 780 ConfigClass = MaskObjectsConfig
789 def run(self, exposure, maskPlanes=None):
790 """Mask objects on Exposure 792 Objects are found and removed. 796 exposure : `lsst.afw.image.Exposure` 797 Exposure on which to mask objects. 798 maskPlanes : iterable of `str`, optional 799 List of mask planes to remove. 805 """Iteratively find objects on an exposure 807 Objects are masked with the ``DETECTED`` mask plane. 811 exposure : `lsst.afw.image.Exposure` 812 Exposure on which to mask objects. 814 for _
in range(self.
config.nIter):
815 bg = self.subtractBackground.
run(exposure).background
816 self.detection.detectFootprints(exposure, sigma=self.
config.detectSigma, clearMask=
True)
817 exposure.maskedImage += bg.getImage()
820 """Remove objects from exposure 822 We interpolate over using a background model if ``doInterpolate`` is 823 set; otherwise we simply replace everything with the median. 827 exposure : `lsst.afw.image.Exposure` 828 Exposure on which to mask objects. 829 maskPlanes : iterable of `str`, optional 830 List of mask planes to remove. ``DETECTED`` will be added as well. 832 image = exposure.image
834 maskVal = mask.getPlaneBitMask(
"DETECTED")
835 if maskPlanes
is not None:
836 maskVal |= mask.getPlaneBitMask(maskPlanes)
837 isBad = mask.array & maskVal > 0
839 if self.
config.doInterpolate:
840 smooth = self.interpolate.fitBackground(exposure.maskedImage)
841 replace = smooth.getImageF().array[isBad]
842 mask.array &= ~mask.getPlaneBitMask([
"DETECTED"])
844 replace = numpy.median(image.array[~isBad])
845 image.array[isBad] = replace
849 """Gaussian-smooth an array while ignoring bad pixels 851 It's not sufficient to set the bad pixels to zero, as then they're treated 852 as if they are zero, rather than being ignored altogether. We need to apply 853 a correction to that image that removes the effect of the bad pixels. 857 array : `numpy.ndarray` of floating-point 859 bad : `numpy.ndarray` of `bool` 860 Flag array indicating bad pixels. 866 convolved : `numpy.ndarray` 869 convolved = gaussian_filter(numpy.where(bad, 0.0, array), sigma, mode=
"constant", cval=0.0)
870 denominator = gaussian_filter(numpy.where(bad, 0.0, 1.0), sigma, mode=
"constant", cval=0.0)
871 return convolved/denominator
Defines the fields and offsets for a table.
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
def removeObjects(self, exposure, maskPlanes=None)
def makeSubtask(self, name, keyArgs)
def fromCamera(cls, config, camera)
A floating-point coordinate rectangle geometry.
def robustMean(array, rej=3.0)
int warpImage(DestImageT &destImage, SrcImageT const &srcImage, geom::TransformPoint2ToPoint2 const &srcToDest, WarpingControl const &control, typename DestImageT::SinglePixel padValue=lsst::afw::math::edgePixel< DestImageT >(typename lsst::afw::image::detail::image_traits< DestImageT >::image_category()))
A variant of warpImage that uses a Transform<Point2Endpoint, Point2Endpoint> instead of a pair of WCS...
A class to contain the data, WCS, and other information needed to describe an image of the sky...
def interpolateBadPixels(array, isBad, interpolationStyle)
def addCcd(self, exposure)
def subtractSkyFrame(self, image, skyBackground, scale, bgList=None)
std::shared_ptr< Background > makeBackground(ImageT const &img, BackgroundControl const &bgCtrl)
A convenience function that uses function overloading to make the correct type of Background...
def run(self, exposure, maskPlanes=None)
Parameters to control convolution.
def smoothArray(array, bad, sigma)
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations...
daf::base::PropertySet * set
def toCcdBackground(self, detector, bbox)
Pass parameters to a Background object.
MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > * makeMaskedImage(typename std::shared_ptr< Image< ImagePixelT >> image, typename std::shared_ptr< Mask< MaskPixelT >> mask=Mask< MaskPixelT >(), typename std::shared_ptr< Image< VariancePixelT >> variance=Image< VariancePixelT >())
A function to return a MaskedImage of the correct type (cf.
Statistics makeStatistics(lsst::afw::math::MaskedVector< EntryT > const &mv, std::vector< WeightPixel > const &vweights, int const flags, StatisticsControl const &sctrl=StatisticsControl())
The makeStatistics() overload to handle lsst::afw::math::MaskedVector<>
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< geom::SkyWcs const > wcs=std::shared_ptr< geom::SkyWcs const >())
A function to return an Exposure of the correct type (cf.
Property stringToStatisticsProperty(std::string const property)
Conversion function to switch a string to a Property (see Statistics.h)
bool all(CoordinateExpr< N > const &expr) noexcept
Return true if all elements are true.
Pass parameters to a Statistics object.
def interpolate1D(method, xSample, ySample, xInterp)
def measureBackground(self, image)
Represent a 2-dimensional array of bitmask pixels.
def averageBackgrounds(self, bgList)
def getSkyData(self, butler, calibId)
std::shared_ptr< Interpolate > makeInterpolate(ndarray::Array< double const, 1 > const &x, ndarray::Array< double const, 1 > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
A class to manipulate images, masks, and variance as a single object.
Interpolate::Style lookupMaxInterpStyle(int const n)
Get the highest order Interpolation::Style available for 'n' points.
def exposureToBackground(bgExp)
def __init__(self, args, kwargs)
std::shared_ptr< image::MaskedImage< PixelT > > statisticsStack(image::MaskedImage< PixelT > const &image, Property flags, char dimension, StatisticsControl const &sctrl)
A function to compute statistics on the rows or columns of an image.
def solveScales(self, scales)
def __init__(self, config, dims, transform, values=None, numbers=None)
A class to evaluate image background levels.
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects...
def findObjects(self, exposure)
def measureScale(self, image, skyBackground)
def __iadd__(self, other)
An integer coordinate rectangle.
daf::base::PropertyList * list
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
def backgroundToExposure(self, statsImage, bbox)