23 from __future__
import absolute_import, division, print_function
29 from .
import SingleGaussianPsf
32 def plantSources(bbox, kwid, sky, coordList, addPoissonNoise=True):
33 """Make an exposure with stars (modelled as Gaussians) 35 @param bbox: parent bbox of exposure 36 @param kwid: kernel width (and height; kernel is square) 37 @param sky: amount of sky background (counts) 38 @param coordList: a list of [x, y, counts, sigma], where: 39 * x,y are relative to exposure origin 40 * counts is the integrated counts for the star 41 * sigma is the Gaussian sigma in pixels 42 @param addPoissonNoise: add Poisson noise to the exposure? 45 img = afwImage.ImageD(bbox)
47 for coord
in coordList:
48 x, y, counts, sigma = coord
52 psf = SingleGaussianPsf(kwid, kwid, sigma)
59 psfBox = thisPsfImg.getBBox()
61 if psfBox != thisPsfImg.getBBox():
62 thisPsfImg = thisPsfImg[psfBox, afwImage.PARENT]
63 imgSeg = img[psfBox, afwImage.PARENT]
65 meanSigma /= len(coordList)
71 numpy.random.seed(seed=1)
72 imgArr = img.getArray()
73 imgArr[:] = numpy.random.poisson(imgArr)
77 var = img.convertFloat()
79 mimg = afwImage.MaskedImageF(img.convertFloat(), mask, var)
83 psf = SingleGaussianPsf(kwid, kwid, meanSigma)
def plantSources(bbox, kwid, sky, coordList, addPoissonNoise=True)
std::shared_ptr< Exposure< ImagePixelT, MaskPixelT, VariancePixelT > > makeExposure(MaskedImage< ImagePixelT, MaskPixelT, VariancePixelT > &mimage, std::shared_ptr< Wcs const > wcs=std::shared_ptr< Wcs const >())