Namespace lsst::coadd::utils

namespace utils

Functions

template<typename CoaddPixelT, typename WeightPixelT>
lsst::geom::Box2I addToCoadd(lsst::afw::image::Image<CoaddPixelT> &coadd, lsst::afw::image::Image<WeightPixelT> &weightMap, lsst::afw::image::Image<CoaddPixelT> const &image, WeightPixelT weight)

add good pixels from an image to a coadd and associated weight map

Parameters
  • coadd: coadd to be modified

  • weightMap: weight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd

  • image: image to add to coadd

  • weight: relative weight of this image

The images are assumed to be registered to the same wcs and parent origin, thus: coadd[i+coadd.x0, j+coadd.y0] += image[i+image.x0, j+image.y0] weightMap[i+weightMap.x0, j+weightMap.y0] += weight for all good image pixels that overlap a coadd pixel. Good pixels are those that are not NaN (thus they do include +/- inf).

Return

overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)

Exceptions
  • pexExcept::InvalidParameterError: if coadd and weightMap dimensions or xy0 do not match.

template<typename CoaddPixelT, typename WeightPixelT>
lsst::geom::Box2I addToCoadd(lsst::afw::image::MaskedImage<CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel> &coadd, lsst::afw::image::Image<WeightPixelT> &weightMap, lsst::afw::image::MaskedImage<CoaddPixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel> const &maskedImage, lsst::afw::image::MaskPixel const badPixelMask, WeightPixelT weight)

add good pixels from a masked image to a coadd image and associated weight map

Parameters
  • coadd: coadd to be modified

  • weightMap: weight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd

  • maskedImage: masked image to add to coadd

  • badPixelMask: skip input pixel if input mask & badPixelMask !=0

  • weight: relative weight of this image

The images are assumed to be registered to the same wcs and parent origin, thus: coadd[i+coadd.x0, j+coadd.y0] += image[i+image.x0, j+image.y0] weightMap[i+weightMap.x0, j+weightMap.y0] += weight for all good image pixels that overlap a coadd pixel. Good pixels are those for which mask & badPixelMask == 0.

Return

overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)

Exceptions
  • pexExcept::InvalidParameterError: if coadd and weightMap dimensions or xy0 do not match.

template<typename ImagePixelT>
int copyGoodPixels(lsst::afw::image::Image<ImagePixelT> &destImage, lsst::afw::image::Image<ImagePixelT> const &srcImage)

copy good pixels from one image to another

Parameters
  • destImage: image to be modified

  • srcImage: image to copy

Good pixels are those that are not NaN (thus they do include +/- inf).

Only the overlapping pixels (relative to the parent) are copied; thus the images do not have to be the same size.

Return

number of pixels copied

template<typename ImagePixelT>
int copyGoodPixels(lsst::afw::image::MaskedImage<ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel> &destImage, lsst::afw::image::MaskedImage<ImagePixelT, lsst::afw::image::MaskPixel, lsst::afw::image::VariancePixel> const &srcImage, lsst::afw::image::MaskPixel const badPixelMask)

copy good pixels from one masked image to another

Parameters
  • destImage: image to be modified

  • srcImage: image to copy

  • badPixelMask: skip input pixel if src mask & badPixelMask != 0

Good pixels are those for which mask & badPixelMask == 0.

Only the overlapping pixels (relative to the parent) are copied; thus the images do not have to be the same size.

Return

number of pixels copied

template<typename WeightPixelT>
void setCoaddEdgeBits(lsst::afw::image::Mask<lsst::afw::image::MaskPixel> &coaddMask, lsst::afw::image::Image<WeightPixelT> const &weightMap)

set edge bits of coadd mask based on weight map

Parameters
  • coaddMask: mask of coadd

  • weightMap: weight map

Set pixels in the image to the edge pixel when the corresponding pixel in the weight map is zero. The edge pixel is image=nan, variance=inf, mask=NO_DATA for masked images and image=nan for plain images.

Exceptions
  • pexExcept::InvalidParameterError: if the dimensions of coaddMask and weightMap do not match.