LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
LSST Data Management Base Package
Namespaces | Functions
lsst::coadd::utils Namespace Reference

Namespaces

 coaddDataIdContainer
 
 version
 

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 More...
 
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 More...
 
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 More...
 
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 More...
 
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 More...
 
 PYBIND11_MODULE (addToCoadd, mod)
 
 PYBIND11_MODULE (copyGoodPixels, mod)
 
 PYBIND11_MODULE (setCoaddEdgeBits, mod)
 

Function Documentation

◆ addToCoadd() [1/2]

template<typename CoaddPixelT , typename WeightPixelT >
lsst::geom::Box2I lsst::coadd::utils::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

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).

Returns
overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)
Exceptions
pexExcept::InvalidParameterErrorif coadd and weightMap dimensions or xy0 do not match.
Parameters
[in,out]coaddcoadd to be modified
[in,out]weightMapweight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd
imageimage to add to coadd
weightrelative weight of this image

Definition at line 127 of file addToCoadd.cc.

133  {
135  return addToCoaddImpl<Image, WeightPixelT, CheckKnownValue>(coadd, weightMap, image, 0x0, weight);
136 }
A class to represent a 2-dimensional array of pixels.
Definition: Image.h:51
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
afw::table::Key< double > weight

◆ addToCoadd() [2/2]

template<typename CoaddPixelT , typename WeightPixelT >
lsst::geom::Box2I lsst::coadd::utils::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

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.

Returns
overlapBBox: overlapping bounding box, relative to parent image (hence xy0 is taken into account)
Exceptions
pexExcept::InvalidParameterErrorif coadd and weightMap dimensions or xy0 do not match.
Parameters
[in,out]coaddcoadd to be modified
[in,out]weightMapweight map to be modified; this is the sum of weights of all images contributing each pixel of the coadd
maskedImagemasked image to add to coadd
badPixelMaskskip input pixel if input mask & badPixelMask !=0
weightrelative weight of this image

Definition at line 139 of file addToCoadd.cc.

148  {
150  return addToCoaddImpl<Image,WeightPixelT,CheckMask>(coadd, weightMap, maskedImage, badPixelMask, weight);
151 }
A class to manipulate images, masks, and variance as a single object.
Definition: MaskedImage.h:73

◆ copyGoodPixels() [1/2]

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

copy good pixels from one image to another

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.

Returns
number of pixels copied
Parameters
[in,out]destImageimage to be modified
srcImageimage to copy

Definition at line 116 of file copyGoodPixels.cc.

120  {
122  return copyGoodPixelsImpl<Image, CheckKnownValue>(destImage, srcImage, 0x0);
123 }

◆ copyGoodPixels() [2/2]

template<typename ImagePixelT >
int lsst::coadd::utils::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

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.

Returns
number of pixels copied
Parameters
[in,out]destImageimage to be modified
srcImageimage to copy
badPixelMaskskip input pixel if src mask & badPixelMask != 0

Definition at line 126 of file copyGoodPixels.cc.

133  {
135  return copyGoodPixelsImpl<Image, CheckMask>(destImage, srcImage, badPixelMask);
136 }

◆ PYBIND11_MODULE() [1/3]

lsst::coadd::utils::PYBIND11_MODULE ( addToCoadd  ,
mod   
)

Definition at line 56 of file addToCoadd.cc.

56  {
57  py::module::import("lsst.afw.geom");
58  py::module::import("lsst.afw.image");
59 
60  declareAddToCoadd<double, double>(mod);
61  declareAddToCoadd<double, float>(mod);
62  declareAddToCoadd<double, int>(mod);
63  declareAddToCoadd<double, std::uint16_t>(mod);
64  declareAddToCoadd<float, double>(mod);
65  declareAddToCoadd<float, float>(mod);
66  declareAddToCoadd<float, int>(mod);
67  declareAddToCoadd<float, std::uint16_t>(mod);
68 }

◆ PYBIND11_MODULE() [2/3]

lsst::coadd::utils::PYBIND11_MODULE ( copyGoodPixels  ,
mod   
)

Definition at line 52 of file copyGoodPixels.cc.

52  {
53  py::module::import("lsst.afw.image");
54 
55  declareCopyGoodPixels<double>(mod);
56  declareCopyGoodPixels<float>(mod);
57  declareCopyGoodPixels<int>(mod);
58  declareCopyGoodPixels<std::uint16_t>(mod);
59 }

◆ PYBIND11_MODULE() [3/3]

lsst::coadd::utils::PYBIND11_MODULE ( setCoaddEdgeBits  ,
mod   
)

Definition at line 48 of file setCoaddEdgeBits.cc.

48  {
49  py::module::import("lsst.afw.image");
50 
51  declareSetCoaddEdgeBits<double>(mod);
52  declareSetCoaddEdgeBits<float>(mod);
53  declareSetCoaddEdgeBits<int>(mod);
54  declareSetCoaddEdgeBits<std::uint16_t>(mod);
55 }

◆ setCoaddEdgeBits()

template<typename WeightPixelT >
void lsst::coadd::utils::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

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::InvalidParameterErrorif the dimensions of coaddMask and weightMap do not match.
Parameters
[in,out]coaddMaskmask of coadd
weightMapweight map

Definition at line 42 of file setCoaddEdgeBits.cc.

46  {
48  typedef typename afwImage::Image<WeightPixelT>::const_x_iterator WeightMapConstXIter;
49 
50  if (coaddMask.getDimensions() != weightMap.getDimensions()) {
52  (boost::format("coaddMask and weightMap dimensions differ: %dx%d != %dx%d") %
53  coaddMask.getWidth() % coaddMask.getHeight() % weightMap.getWidth() % weightMap.getHeight()
54  ).str());
55  }
56 
58 
59  // Set the pixels row by row, to avoid repeated checks for end-of-row
60  for (int y = 0, endY = weightMap.getHeight(); y != endY; ++y) {
61  WeightMapConstXIter weightMapPtr = weightMap.row_begin(y);
62  WeightMapConstXIter const weightMapEndPtr = weightMap.row_end(y);
63  MaskXIter coaddMaskPtr = coaddMask.row_begin(y);
64  for (; weightMapPtr != weightMapEndPtr; ++weightMapPtr, ++coaddMaskPtr) {
65  if (*weightMapPtr == 0) {
66  (*coaddMaskPtr) = (*coaddMaskPtr) | edgeMask;
67  }
68  }
69  }
70 }
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
int y
Definition: SpanSet.cc:48
int getWidth() const
Return the number of columns in the image.
Definition: ImageBase.h:294
lsst::geom::Extent2I getDimensions() const
Return the image's size; useful for passing to constructors.
Definition: ImageBase.h:356
int getHeight() const
Return the number of rows in the image.
Definition: ImageBase.h:296
x_iterator row_begin(int y) const
Return an x_iterator to the start of the y'th row.
Definition: ImageBase.h:401
x_iterator row_end(int y) const
Return an x_iterator to the end of the y'th row.
Definition: ImageBase.h:404
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:77
static MaskPixelT getPlaneBitMask(const std::vector< std::string > &names)
Return the bitmask corresponding to a vector of plane names OR'd together.
Definition: Mask.cc:372
Reports invalid arguments.
Definition: Runtime.h:66
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174