24 "FocalPlaneBackground",
25 "FocalPlaneBackgroundConfig",
28 "SkyMeasurementConfig",
37from scipy.ndimage
import gaussian_filter
47from lsst.pex.config import Config, Field, ListField, ChoiceField, ConfigField, RangeField, ConfigurableField
52 """Measure a robust mean of an array
56 array : `numpy.ndarray`
57 Array for which to measure the mean.
59 k-sigma rejection threshold.
64 Robust mean of `array`.
66 q1, median, q3 = numpy.percentile(array, [25.0, 50.0, 100.0])
67 good = numpy.abs(array - median) < rej*0.74*(q3 - q1)
68 return array[good].mean()
72 """Configuration for background measurement"""
73 statistic =
ChoiceField(dtype=str, default=
"MEANCLIP", doc=
"type of statistic to use for grid points",
74 allowed={
"MEANCLIP":
"clipped mean",
75 "MEAN":
"unclipped mean",
77 xBinSize =
RangeField(dtype=int, default=32, min=1, doc=
"Superpixel size in x")
78 yBinSize =
RangeField(dtype=int, default=32, min=1, doc=
"Superpixel size in y")
79 algorithm =
ChoiceField(dtype=str, default=
"NATURAL_SPLINE", optional=
True,
80 doc=
"How to interpolate the background values. "
81 "This maps to an enum; see afw::math::Background",
83 "CONSTANT":
"Use a single constant value",
84 "LINEAR":
"Use linear interpolation",
85 "NATURAL_SPLINE":
"cubic spline with zero second derivative at endpoints",
86 "AKIMA_SPLINE":
"higher-level nonlinear spline that is more robust"
88 "NONE":
"No background estimation is to be attempted",
90 mask =
ListField(dtype=str, default=[
"SAT",
"BAD",
"EDGE",
"DETECTED",
"DETECTED_NEGATIVE",
"NO_DATA"],
91 doc=
"Names of mask planes to ignore while estimating the background")
95 """Parameters controlling the measurement of sky statistics"""
96 statistic =
ChoiceField(dtype=str, default=
"MEANCLIP", doc=
"type of statistic to use for grid points",
97 allowed={
"MEANCLIP":
"clipped mean",
98 "MEAN":
"unclipped mean",
100 clip =
Field(doc=
"Clipping threshold for background", dtype=float, default=3.0)
101 nIter =
Field(doc=
"Clipping iterations for background", dtype=int, default=3)
102 mask =
ListField(doc=
"Mask planes to reject", dtype=str,
103 default=[
"SAT",
"DETECTED",
"DETECTED_NEGATIVE",
"BAD",
"NO_DATA"])
107 """Configuration for SkyMeasurementTask"""
108 skyIter =
Field(dtype=int, default=3, doc=
"k-sigma rejection iterations for sky scale")
109 skyRej =
Field(dtype=float, default=3.0, doc=
"k-sigma rejection threshold for sky scale")
110 background =
ConfigField(dtype=BackgroundConfig, doc=
"Background measurement")
111 xNumSamples =
Field(dtype=int, default=4, doc=
"Number of samples in x for scaling sky frame")
112 yNumSamples =
Field(dtype=int, default=4, doc=
"Number of samples in y for scaling sky frame")
113 stats =
ConfigField(dtype=SkyStatsConfig, doc=
"Measurement of sky statistics in the samples")
117 """Task for creating, persisting and using sky frames
119 A sky frame is like a fringe frame (the sum of many exposures of the night sky,
120 combined
with rejection to remove astrophysical objects)
except the structure
121 is on larger scales,
and hence we bin the images
and represent them
as a
123 the dominant response of the camera to the sky background.
125 ConfigClass = SkyMeasurementConfig
129 """Convert an exposure to background model
131 Calibs need to be persisted as an Exposure, so we need to convert
132 the persisted Exposure to a background model.
137 Background model
in Exposure format.
144 header = bgExp.getMetadata()
145 xMin = header.getScalar("BOX.MINX")
146 yMin = header.getScalar(
"BOX.MINY")
147 xMax = header.getScalar(
"BOX.MAXX")
148 yMax = header.getScalar(
"BOX.MAXY")
149 algorithm = header.getScalar(
"ALGORITHM")
155 afwMath.ApproximateControl.UNKNOWN,
159 """Convert a background model to an exposure
161 Calibs need to be persisted as an Exposure, so we need to convert
162 the background model to an Exposure.
166 statsImage : `lsst.afw.image.MaskedImageF`
167 Background model
's statistics image.
169 Bounding box for image.
174 Background model
in Exposure format.
177 header = exp.getMetadata()
178 header.set("BOX.MINX", bbox.getMinX())
179 header.set(
"BOX.MINY", bbox.getMinY())
180 header.set(
"BOX.MAXX", bbox.getMaxX())
181 header.set(
"BOX.MAXY", bbox.getMaxY())
182 header.set(
"ALGORITHM", self.config.background.algorithm)
186 """Measure a background model for image
188 This doesn't use a full-featured background model (e.g., no Chebyshev
189 approximation) because we just want the binning behaviour. This will
190 allow us to average the bins later (`averageBackgrounds`).
192 The `BackgroundMI` is wrapped
in a `BackgroundList` so it can be
193 pickled
and persisted.
198 Image
for which to measure background.
206 stats.setAndMask(image.getMask().getPlaneBitMask(self.config.background.mask))
207 stats.setNanSafe(True)
209 self.config.background.algorithm,
210 max(int(image.getWidth()/self.config.background.xBinSize + 0.5), 1),
211 max(int(image.getHeight()/self.config.background.yBinSize + 0.5), 1),
212 "REDUCE_INTERP_ORDER",
214 self.config.background.statistic
223 afwMath.ApproximateControl.UNKNOWN,
228 """Average multiple background models
230 The input background models should be a `BackgroundList` consisting
231 of a single `BackgroundMI`.
236 Background models to average.
241 Background model in Exposure format.
243 assert all(len(bg) == 1
for bg
in bgList),
"Mixed bgList: %s" % ([len(bg)
for bg
in bgList],)
244 images = [bg[0][0].getStatsImage()
for bg
in bgList]
245 boxes = [bg[0][0].getImageBBox()
for bg
in bgList]
246 assert len(
set((box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY())
for box
in boxes)) == 1, \
247 "Bounding boxes not all equal"
251 maskVal = afwImage.Mask.getPlaneBitMask(
"BAD")
253 bad = numpy.isnan(img.getImage().getArray())
254 img.getMask().getArray()[bad] = maskVal
257 stats.setAndMask(maskVal)
258 stats.setNanSafe(
True)
265 array = combined.getImage().getArray()
266 bad = numpy.isnan(array)
267 median = numpy.median(array[~bad])
274 """Measure scale of background model in image
276 We treat the sky frame much as we would a fringe frame
277 (
except the length scale of the variations
is different):
278 we measure samples on the input image
and the sky frame,
279 which we will use to determine the scaling factor
in the
280 'solveScales` method.
285 Science image
for which to measure scale.
287 Sky background model.
291 imageSamples : `numpy.ndarray`
292 Sample measurements on image.
293 skySamples : `numpy.ndarray`
294 Sample measurements on sky frame.
297 image = image.getMaskedImage()
299 xNumSamples =
min(self.config.xNumSamples, image.getWidth())
300 yNumSamples =
min(self.config.yNumSamples, image.getHeight())
301 xLimits = numpy.linspace(0, image.getWidth(), xNumSamples + 1, dtype=int)
302 yLimits = numpy.linspace(0, image.getHeight(), yNumSamples + 1, dtype=int)
303 sky = skyBackground.getImage()
304 maskVal = image.getMask().getPlaneBitMask(self.config.stats.mask)
309 for xIndex, yIndex
in itertools.product(range(xNumSamples), range(yNumSamples)):
311 xStart, xStop = xLimits[xIndex], xLimits[xIndex + 1] - 1
312 yStart, yStop = yLimits[yIndex], yLimits[yIndex + 1] - 1
314 subImage = image.Factory(image, box)
315 subSky = sky.Factory(sky, box)
318 return imageSamples, skySamples
321 """Solve multiple scales for a single scale factor
323 Having measured samples from the image
and sky frame, we
324 fit
for the scaling factor.
328 scales : `list` of a `tuple` of two `numpy.ndarray` arrays
329 A `list` of the results
from `measureScale` method.
338 for ii, ss
in scales:
339 imageSamples.extend(ii)
340 skySamples.extend(ss)
341 assert len(imageSamples) == len(skySamples)
342 imageSamples = numpy.array(imageSamples)
343 skySamples = numpy.array(skySamples)
346 return afwMath.LeastSquares.fromDesignMatrix(skySamples[mask].reshape(mask.sum(), 1),
348 afwMath.LeastSquares.DIRECT_SVD).getSolution()
350 mask = numpy.isfinite(imageSamples) & numpy.isfinite(skySamples)
351 for ii
in range(self.config.skyIter):
352 solution = solve(mask)
353 residuals = imageSamples - solution*skySamples
354 lq, uq = numpy.percentile(residuals[mask], [25, 75])
355 stdev = 0.741*(uq - lq)
356 with numpy.errstate(invalid=
"ignore"):
357 bad = numpy.abs(residuals) > self.config.skyRej*stdev
363 """Subtract sky frame from science image
370 Sky background model.
372 Scale to apply to background model.
374 List of backgrounds applied to image
377 image = image.getMaskedImage()
379 image = image.getImage()
380 image.scaledMinus(scale, skyBackground.getImage())
381 if bgList
is not None:
383 bgData =
list(skyBackground[0])
385 statsImage = bg.getStatsImage().clone()
388 newBgData = [newBg] + bgData[1:]
389 bgList.append(newBgData)
393 """Interpolate in one dimension
395 Interpolates the curve provided by `xSample` and `ySample` at
396 the positions of `xInterp`. Automatically backs off the
397 interpolation method to achieve successful interpolation.
401 method : `lsst.afw.math.Interpolate.Style`
402 Interpolation method to use.
403 xSample : `numpy.ndarray`
405 ySample : `numpy.ndarray`
406 Vector of coordinates.
407 xInterp : `numpy.ndarray`
408 Vector of ordinates to which to interpolate.
412 yInterp : `numpy.ndarray`
413 Vector of interpolated coordinates.
416 if len(xSample) == 0:
417 return numpy.ones_like(xInterp)*numpy.nan
420 method).interpolate(xInterp.astype(float))
422 if method == afwMath.Interpolate.CONSTANT:
424 return numpy.ones_like(xInterp)*numpy.nan
426 if newMethod == method:
427 newMethod = afwMath.Interpolate.CONSTANT
432 """Interpolate bad pixels in an image array
434 The bad pixels are modified in the array.
438 array : `numpy.ndarray`
439 Image array
with bad pixels.
440 isBad : `numpy.ndarray` of type `bool`
441 Boolean array indicating which pixels are bad.
442 interpolationStyle : `str`
444 supported values are CONSTANT, LINEAR, NATURAL_SPLINE,
448 raise RuntimeError(
"No good pixels in image array")
449 height, width = array.shape
450 xIndices = numpy.arange(width, dtype=float)
451 yIndices = numpy.arange(height, dtype=float)
454 for y
in range(height):
455 if numpy.any(isBad[y, :])
and numpy.any(isGood[y, :]):
456 array[y][isBad[y]] =
interpolate1D(method, xIndices[isGood[y]], array[y][isGood[y]],
459 isBad = numpy.isnan(array)
461 for x
in range(width):
462 if numpy.any(isBad[:, x])
and numpy.any(isGood[:, x]):
463 array[:, x][isBad[:, x]] =
interpolate1D(method, yIndices[isGood[:, x]],
464 array[:, x][isGood[:, x]], yIndices[isBad[:, x]])
468 """Configuration for FocalPlaneBackground
470 Note that `xSize` and `ySize` are floating-point values,
as
471 the focal plane frame
is usually defined
in units of microns
472 or millimetres rather than pixels. As such, their values will
473 need to be revised according to each particular camera. For
474 this reason, no defaults are set
for those.
476 xSize = Field(dtype=float, doc="Bin size in x")
477 ySize =
Field(dtype=float, doc=
"Bin size in y")
478 pixelSize =
Field(dtype=float, default=1.0, doc=
"Pixel size in same units as xSize/ySize")
479 minFrac =
Field(dtype=float, default=0.1, doc=
"Minimum fraction of bin size for good measurement")
480 mask =
ListField(dtype=str, doc=
"Mask planes to treat as bad",
481 default=[
"BAD",
"SAT",
"INTRP",
"DETECTED",
"DETECTED_NEGATIVE",
"EDGE",
"NO_DATA"])
483 doc=
"how to interpolate the background values. This maps to an enum; see afw::math::Background",
484 dtype=str, default=
"AKIMA_SPLINE", optional=
True,
486 "CONSTANT":
"Use a single constant value",
487 "LINEAR":
"Use linear interpolation",
488 "NATURAL_SPLINE":
"cubic spline with zero second derivative at endpoints",
489 "AKIMA_SPLINE":
"higher-level nonlinear spline that is more robust to outliers",
490 "NONE":
"No background estimation is to be attempted",
493 doSmooth =
Field(dtype=bool, default=
False, doc=
"Do smoothing?")
494 smoothScale =
Field(dtype=float, default=2.0, doc=
"Smoothing scale, as a multiple of the bin size")
495 binning =
Field(dtype=int, default=64, doc=
"Binning to use for CCD background model (pixels)")
499 """Background model for a focal plane camera
501 We model the background empirically with the
"superpixel" method: we
502 measure the background
in each superpixel
and interpolate between
503 superpixels to
yield the model.
506 is that here the superpixels are defined
in the frame of the focal
507 plane of the camera which removes discontinuities across detectors.
509 The constructor you probably want to use
is the `fromCamera` classmethod.
511 There are two use patterns
for building a background model:
513 * Serial: create a `FocalPlaneBackground`, then `addCcd`
for each of the
516 * Parallel: create a `FocalPlaneBackground`, then `clone` it
for each
517 of the CCDs
in an exposure
and use those to `addCcd` their respective
518 CCD image. Finally, `merge` all the clones into the original.
520 Once you
've built the background model, you can apply it to individual
521 CCDs with the `toCcdBackground` method.
525 """Construct from a camera object
529 config : `FocalPlaneBackgroundConfig`
530 Configuration for measuring backgrounds.
532 Camera
for which to measure backgrounds.
536 for point
in ccd.getCorners(afwCameraGeom.FOCAL_PLANE):
537 cameraBox.include(point)
539 width, height = cameraBox.getDimensions()
543 dims =
geom.Extent2I(int(numpy.ceil(width/config.xSize)) + 2,
544 int(numpy.ceil(height/config.ySize)) + 2)
546 transform = (geom.AffineTransform.makeTranslation(
geom.Extent2D(1, 1))
547 * geom.AffineTransform.makeScaling(1.0/config.xSize, 1.0/config.ySize)
548 * geom.AffineTransform.makeTranslation(offset))
554 """Construct from an object that has the same interface.
558 other : `FocalPlaneBackground`-like
559 An object that matches the interface of `FocalPlaneBackground`
560 but which may be different.
564 background : `FocalPlaneBackground`
565 Something guaranteed to be a `FocalPlaneBackground`.
567 return cls(other.config, other.dims, other.transform, other._values, other._numbers)
569 def __init__(self, config, dims, transform, values=None, numbers=None):
572 Developers should note that changes to the signature of this method
573 require coordinated changes to the `__reduce__` and `clone` methods.
577 config : `FocalPlaneBackgroundConfig`
578 Configuration
for measuring backgrounds.
580 Dimensions
for background samples.
582 Transformation
from focal plane coordinates to sample coordinates.
583 values : `lsst.afw.image.ImageF`
584 Measured background values.
585 numbers : `lsst.afw.image.ImageF`
586 Number of pixels
in each background measurement.
593 values = afwImage.ImageF(self.
dims)
596 values = values.clone()
597 assert values.getDimensions() == self.
dims
600 numbers = afwImage.ImageF(self.
dims)
603 numbers = numbers.clone()
604 assert numbers.getDimensions() == self.
dims
616 We measure the background on the CCD (clipped mean), and record
617 the results
in the model. For simplicity, measurements are made
618 in a box on the CCD corresponding to the warped coordinates of the
619 superpixel rather than accounting
for little rotations, etc.
620 We also record the number of pixels used
in the measurement so we
621 can have a measure of confidence
in each bin
's value.
626 CCD exposure to measure
628 detector = exposure.getDetector()
629 transform = detector.getTransformMap().getTransform(detector.makeCameraSys(afwCameraGeom.PIXELS),
630 detector.makeCameraSys(afwCameraGeom.FOCAL_PLANE))
631 image = exposure.getMaskedImage()
632 maskVal = image.getMask().getPlaneBitMask(self.config.mask)
635 toSample = transform.then(self.
transform)
637 warped = afwImage.ImageF(self.
_values.getBBox())
638 warpedCounts = afwImage.ImageF(self.
_numbers.getBBox())
639 width, height = warped.getDimensions()
642 stats.setAndMask(maskVal)
643 stats.setNanSafe(
True)
645 pixels = itertools.product(range(width), range(height))
646 for xx, yy
in pixels:
647 llc = toSample.applyInverse(
geom.Point2D(xx - 0.5, yy - 0.5))
648 urc = toSample.applyInverse(
geom.Point2D(xx + 0.5, yy + 0.5))
650 bbox.clip(image.getBBox())
653 subImage = image.Factory(image, bbox)
655 mean = result.getValue(afwMath.MEANCLIP)
656 num = result.getValue(afwMath.NPOINT)
657 if not numpy.isfinite(mean)
or not numpy.isfinite(num):
659 warped[xx, yy, afwImage.LOCAL] = mean*num
660 warpedCounts[xx, yy, afwImage.LOCAL] = num
666 """Produce a background model for a CCD
668 The superpixel background model is warped back to the
669 CCD frame,
for application to the individual CCD.
674 CCD
for which to produce background model.
676 Bounding box of CCD exposure.
681 Background model
for CCD.
683 transform = detector.getTransformMap().getTransform(detector.makeCameraSys(afwCameraGeom.PIXELS),
684 detector.makeCameraSys(afwCameraGeom.FOCAL_PLANE))
685 binTransform = (geom.AffineTransform.makeScaling(self.config.binning)
686 * geom.AffineTransform.makeTranslation(geom.Extent2D(0.5, 0.5)))
692 fpNorm = afwImage.ImageF(focalPlane.getBBox())
695 image = afwImage.ImageF(bbox.getDimensions()//self.
config.binning)
696 norm = afwImage.ImageF(image.getBBox())
703 isBad = numpy.isnan(image.getArray())
704 mask.getArray()[isBad] = mask.getPlaneBitMask(
"BAD")
705 image.getArray()[isBad] = image.getArray()[~isBad].mean()
711 afwMath.ApproximateControl.UNKNOWN,
716 """Merge with another FocalPlaneBackground
718 This allows multiple background models to be constructed from
719 different CCDs,
and then merged to form a single consistent
720 background model
for the entire focal plane.
724 other : `FocalPlaneBackground`
725 Another background model to merge.
729 self : `FocalPlaneBackground`
730 The merged background model.
732 if (self.
config.xSize, self.
config.ySize) != (other.config.xSize, other.config.ySize):
733 raise RuntimeError(
"Size mismatch: %s vs %s" % ((self.
config.xSize, self.
config.ySize),
734 (other.config.xSize, other.config.ySize)))
735 if self.
dims != other.dims:
736 raise RuntimeError(
"Dimensions mismatch: %s vs %s" % (self.
dims, other.dims))
742 """Merge with another FocalPlaneBackground
746 other : `FocalPlaneBackground`
747 Another background model to merge.
751 self : `FocalPlaneBackground`
752 The merged background model.
754 return self.
merge(other)
757 """Return the background model data
759 This is the measurement of the background
for each of the superpixels.
763 thresh = (self.config.minFrac
765 isBad = self._numbers.getArray() < thresh
767 array = values.getArray()
769 isBad = numpy.isnan(values.array)
776 """Configuration for MaskObjectsTask"""
777 nIter =
Field(dtype=int, default=3, doc=
"Number of iterations")
779 doc=
"Background subtraction")
781 detectSigma =
Field(dtype=float, default=5.0, doc=
"Detection threshold (standard deviations)")
782 doInterpolate =
Field(dtype=bool, default=
True, doc=
"Interpolate when removing objects?")
786 self.
detection.reEstimateBackground =
False
787 self.
detection.doTempLocalBackground =
False
788 self.
detection.doTempWideBackground =
False
799 raise RuntimeError(
"Incorrect settings for object masking: reEstimateBackground, "
800 "doTempLocalBackground and doTempWideBackground must be False")
804 """Iterative masking of objects on an Exposure
806 This task makes more exhaustive object mask by iteratively doing detection
807 and background-subtraction. The purpose of this task
is to get true
808 background removing faint tails of large objects. This
is useful to get a
809 clean sky estimate
from relatively small number of visits.
811 We deliberately use the specified ``detectSigma`` instead of the PSF,
812 in order to better pick up the faint wings of objects.
814 ConfigClass = MaskObjectsConfig
820 self.makeSubtask(
"interpolate")
821 self.makeSubtask(
"subtractBackground")
823 def run(self, exposure, maskPlanes=None):
824 """Mask objects on Exposure
826 Objects are found and removed.
831 Exposure on which to mask objects.
832 maskPlanes : iterable of `str`, optional
833 List of mask planes to remove.
839 """Iteratively find objects on an exposure
841 Objects are masked with the ``DETECTED`` mask plane.
846 Exposure on which to mask objects.
848 for _
in range(self.config.nIter):
849 bg = self.subtractBackground.run(exposure).background
850 self.detection.detectFootprints(exposure, sigma=self.config.detectSigma, clearMask=
True)
851 exposure.maskedImage += bg.getImage()
854 """Remove objects from exposure
856 We interpolate over using a background model if ``doInterpolate``
is
857 set; otherwise we simply replace everything
with the median.
862 Exposure on which to mask objects.
863 maskPlanes : iterable of `str`, optional
864 List of mask planes to remove. ``DETECTED`` will be added
as well.
866 image = exposure.image
868 maskVal = mask.getPlaneBitMask("DETECTED")
869 if maskPlanes
is not None:
870 maskVal |= mask.getPlaneBitMask(maskPlanes)
871 isBad = mask.array & maskVal > 0
873 if self.config.doInterpolate:
874 smooth = self.interpolate.fitBackground(exposure.maskedImage)
875 replace = smooth.getImageF().array[isBad]
876 mask.array &= ~mask.getPlaneBitMask([
"DETECTED"])
878 replace = numpy.median(image.array[~isBad])
879 image.array[isBad] = replace
883 """Gaussian-smooth an array while ignoring bad pixels
885 It's not sufficient to set the bad pixels to zero, as then they're treated
886 as if they are zero, rather than being ignored altogether. We need to apply
887 a correction to that image that removes the effect of the bad pixels.
891 array : `numpy.ndarray` of floating-point
893 bad : `numpy.ndarray` of `bool`
894 Flag array indicating bad pixels.
900 convolved : `numpy.ndarray`
903 convolved = gaussian_filter(numpy.where(bad, 0.0, array), sigma, mode="constant", cval=0.0)
904 denominator = gaussian_filter(numpy.where(bad, 0.0, 1.0), sigma, mode=
"constant", cval=0.0)
905 return convolved/denominator
909 """Create an empty module attached to the relevant parent."""
910 parent, child = name.rsplit(
".", 1)
911 spec = importlib.machinery.ModuleSpec(name,
None)
912 newmod = importlib.util.module_from_spec(spec)
913 setattr(sys.modules[parent], child, newmod)
914 sys.modules[name] = newmod
923 import lsst.pipe.drivers.background
932 setattr(pipe_drivers_background, FocalPlaneBackground.__name__, FocalPlaneBackground)
933 setattr(pipe_drivers_background, FocalPlaneBackgroundConfig.__name__, FocalPlaneBackgroundConfig)
An immutable representation of a camera.
A representation of a detector in a mosaic camera.
A class to contain the data, WCS, and other information needed to describe an image of the sky.
Represent a 2-dimensional array of bitmask pixels.
A class to manipulate images, masks, and variance as a single object.
Pass parameters to a Background object.
A virtual base class to evaluate image background levels.
A class to evaluate image background levels.
Pass parameters to a Statistics object.
Parameters to control convolution.
Defines the fields and offsets for a table.
A floating-point coordinate rectangle geometry.
An integer coordinate rectangle.
fromCamera(cls, config, camera)
__init__(self, config, dims, transform, values=None, numbers=None)
toCcdBackground(self, detector, bbox)
__init__(self, *args, **kwargs)
findObjects(self, exposure)
removeObjects(self, exposure, maskPlanes=None)
subtractSkyFrame(self, image, skyBackground, scale, bgList=None)
measureScale(self, image, skyBackground)
averageBackgrounds(self, bgList)
solveScales(self, scales)
exposureToBackground(bgExp)
backgroundToExposure(self, statsImage, bbox)
measureBackground(self, image)
daf::base::PropertyList * list
daf::base::PropertySet * set
std::shared_ptr< TransformPoint2ToPoint2 > makeTransform(lsst::geom::AffineTransform const &affine)
Wrap an lsst::geom::AffineTransform as a Transform.
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.
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.
std::shared_ptr< lsst::afw::image::Image< PixelT > > statisticsStack(std::vector< std::shared_ptr< lsst::afw::image::Image< PixelT > > > &images, Property flags, StatisticsControl const &sctrl=StatisticsControl(), std::vector< lsst::afw::image::VariancePixel > const &wvector=std::vector< lsst::afw::image::VariancePixel >(0))
A function to compute some statistics of a stack of Images.
Interpolate::Style lookupMaxInterpStyle(int const n)
Get the highest order Interpolation::Style available for 'n' points.
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.
Statistics makeStatistics(lsst::afw::image::Image< Pixel > const &img, lsst::afw::image::Mask< image::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl=StatisticsControl())
Handle a watered-down front-end to the constructor (no variance)
Property stringToStatisticsProperty(std::string const property)
Conversion function to switch a string to a Property (see Statistics.h)
Interpolate::Style stringToInterpStyle(std::string const &style)
Conversion function to switch a string to an Interpolate::Style.
int warpImage(DestImageT &destImage, geom::SkyWcs const &destWcs, SrcImageT const &srcImage, geom::SkyWcs const &srcWcs, WarpingControl const &control, typename DestImageT::SinglePixel padValue=lsst::afw::math::edgePixel< DestImageT >(typename lsst::afw::image::detail::image_traits< DestImageT >::image_category()))
Warp an Image or MaskedImage to a new Wcs.
UndersampleStyle stringToUndersampleStyle(std::string const &style)
Conversion function to switch a string to an UndersampleStyle.
std::shared_ptr< Interpolate > makeInterpolate(std::vector< double > const &x, std::vector< double > const &y, Interpolate::Style const style=Interpolate::AKIMA_SPLINE)
A factory function to make Interpolate objects.
_create_module_child(name)
smoothArray(array, bad, sigma)
robustMean(array, rej=3.0)
interpolate1D(method, xSample, ySample, xInterp)
interpolateBadPixels(array, isBad, interpolationStyle)