LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
diffimTools.py
Go to the documentation of this file.
1 #
2 # LSST Data Management System
3 # Copyright 2008-2016 LSST Corporation.
4 #
5 # This product includes software developed by the
6 # LSST Project (http://www.lsst.org/).
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the LSST License Statement and
19 # the GNU General Public License along with this program. If not,
20 # see <http://www.lsstcorp.org/LegalNotices/>.
21 #
22 
23 __all__ = ["backgroundSubtract", "writeKernelCellSet", "sourceToFootprintList", "NbasisEvaluator"]
24 
25 # python
26 import time
27 import os
28 from collections import Counter
29 import numpy as np
30 
31 # all the c++ level classes and routines
32 from . import diffimLib
33 
34 # all the other LSST packages
35 import lsst.afw.geom as afwGeom
36 import lsst.afw.image as afwImage
37 import lsst.afw.table as afwTable
38 import lsst.afw.detection as afwDetect
39 import lsst.afw.math.mathLib as afwMath
40 from lsst.log import Log
41 import lsst.pex.config as pexConfig
42 from .makeKernelBasisList import makeKernelBasisList
43 
44 # Helper functions for ipDiffim; mostly viewing of results and writing
45 # debugging info to disk.
46 
47 
50 
51 
52 def makeFlatNoiseImage(mi, seedStat=afwMath.MAX):
53  img = mi.getImage()
54  seed = int(10. * afwMath.makeStatistics(mi.getImage(), seedStat).getValue() + 1)
55  rdm = afwMath.Random(afwMath.Random.MT19937, seed)
56  rdmImage = img.Factory(img.getDimensions())
57  afwMath.randomGaussianImage(rdmImage, rdm)
58  return rdmImage
59 
60 
62  """Return a Poisson noise image based on im
63 
64  Parameters
65  ----------
66  im : `lsst.afw.image.Image`
67  image; the output image has the same dimensions and shape
68  and its expectation value is the value of im at each pixel
69 
70  Returns
71  -------
72  noiseIm : 'lsst.afw.image.Image'
73  TODO: DM-17458
74 
75  Notes
76  -----
77 
78  - Warning: This uses an undocumented numpy API (the documented API
79  uses a single float expectation value instead of an array).
80 
81  - Uses numpy.random; you may wish to call numpy.random.seed first.
82  """
83  import numpy.random as rand
84  imArr = im.getArray()
85  noiseIm = im.Factory(im.getBBox())
86  noiseArr = noiseIm.getArray()
87 
88  with np.errstate(invalid='ignore'):
89  intNoiseArr = rand.poisson(imArr)
90 
91  noiseArr[:, :] = intNoiseArr.astype(noiseArr.dtype)
92  return noiseIm
93 
94 
99 
100 
102  kCoeffs = ((1.0, 0.0, 0.0),
103  (0.005, -0.000001, 0.000001),
104  (0.005, 0.000004, 0.000004),
105  (-0.001, -0.000030, 0.000030),
106  (-0.001, 0.000015, 0.000015),
107  (-0.005, -0.000050, 0.000050))
108  return kCoeffs
109 
110 
111 def makeFakeKernelSet(sizeCell=128, nCell=3,
112  deltaFunctionCounts=1.e4, tGaussianWidth=1.0,
113  addNoise=True, bgValue=100., display=False):
114  """TODO: DM-17458
115 
116  Parameters
117  ----------
118  sizeCell : `int`, optional
119  TODO: DM-17458
120  nCell : `int`, optional
121  TODO: DM-17458
122  deltaFunctionCounts : `float`, optional
123  TODO: DM-17458
124  tGaussianWidth : `float`, optional
125  TODO: DM-17458
126  addNoise : `bool`, optional
127  TODO: DM-17458
128  bgValue : `float`, optional
129  TODO: DM-17458
130  display : `bool`, optional
131  TODO: DM-17458
132 
133  Returns
134  -------
135  TODO: DM-17458
136  TODO: DM-17458
137  """
138  from . import imagePsfMatch
139  configFake = imagePsfMatch.ImagePsfMatchConfig()
140  configFake.kernel.name = "AL"
141  subconfigFake = configFake.kernel.active
142  subconfigFake.alardNGauss = 1
143  subconfigFake.alardSigGauss = [2.5, ]
144  subconfigFake.alardDegGauss = [2, ]
145  subconfigFake.sizeCellX = sizeCell
146  subconfigFake.sizeCellY = sizeCell
147  subconfigFake.spatialKernelOrder = 1
148  subconfigFake.spatialModelType = "polynomial"
149  subconfigFake.singleKernelClipping = False # variance is a hack
150  subconfigFake.spatialKernelClipping = False # variance is a hack
151  if bgValue > 0.0:
152  subconfigFake.fitForBackground = True
153 
154  policyFake = pexConfig.makePolicy(subconfigFake)
155 
156  basisList = makeKernelBasisList(subconfigFake)
157  kSize = subconfigFake.kernelSize
158 
159  # This sets the final extent of each convolved delta function
160  gaussKernelWidth = sizeCell//2
161 
162  # This sets the scale over which pixels are correlated in the
163  # spatial convolution; should be at least as big as the kernel you
164  # are trying to fit for
165  spatialKernelWidth = kSize
166 
167  # Number of bad pixels due to convolutions
168  border = (gaussKernelWidth + spatialKernelWidth)//2
169 
170  # Make a fake image with a matrix of delta functions
171  totalSize = nCell * sizeCell + 2*border
172  tim = afwImage.ImageF(afwGeom.Extent2I(totalSize, totalSize))
173  for x in range(nCell):
174  for y in range(nCell):
175  tim[x*sizeCell + sizeCell//2 + border - 1,
176  y*sizeCell + sizeCell//2 + border - 1,
177  afwImage.LOCAL] = deltaFunctionCounts
178 
179  # Turn this into stars with a narrow width; conserve counts
180  gaussFunction = afwMath.GaussianFunction2D(tGaussianWidth, tGaussianWidth)
181  gaussKernel = afwMath.AnalyticKernel(gaussKernelWidth, gaussKernelWidth, gaussFunction)
182  cim = afwImage.ImageF(tim.getDimensions())
183  afwMath.convolve(cim, tim, gaussKernel, True)
184  tim = cim
185 
186  # Trim off border pixels
187  bbox = gaussKernel.shrinkBBox(tim.getBBox(afwImage.LOCAL))
188  tim = afwImage.ImageF(tim, bbox, afwImage.LOCAL)
189 
190  # Now make a science image which is this convolved with some
191  # spatial function. Use input basis list.
192  polyFunc = afwMath.PolynomialFunction2D(1)
193  kCoeffs = fakeCoeffs()
194  nToUse = min(len(kCoeffs), len(basisList))
195 
196  # Make the full convolved science image
197  sKernel = afwMath.LinearCombinationKernel(basisList[:nToUse], polyFunc)
198  sKernel.setSpatialParameters(kCoeffs[:nToUse])
199  sim = afwImage.ImageF(tim.getDimensions())
200  afwMath.convolve(sim, tim, sKernel, True)
201 
202  # Get the good subregion
203  bbox = sKernel.shrinkBBox(sim.getBBox(afwImage.LOCAL))
204 
205  # Add background
206  sim += bgValue
207 
208  # Watch out for negative values
209  tim += 2 * np.abs(np.min(tim.getArray()))
210 
211  # Add noise?
212  if addNoise:
213  sim = makePoissonNoiseImage(sim)
214  tim = makePoissonNoiseImage(tim)
215 
216  # And turn into MaskedImages
217  sim = afwImage.ImageF(sim, bbox, afwImage.LOCAL)
218  svar = afwImage.ImageF(sim, True)
219  smask = afwImage.Mask(sim.getDimensions())
220  smask.set(0x0)
221  sMi = afwImage.MaskedImageF(sim, smask, svar)
222 
223  tim = afwImage.ImageF(tim, bbox, afwImage.LOCAL)
224  tvar = afwImage.ImageF(tim, True)
225  tmask = afwImage.Mask(tim.getDimensions())
226  tmask.set(0x0)
227  tMi = afwImage.MaskedImageF(tim, tmask, tvar)
228 
229  if display:
230  import lsst.afw.display.ds9 as ds9
231  ds9.mtv(tMi, frame=1)
232  ds9.mtv(sMi, frame=2)
233 
234  # Finally, make a kernelSet from these 2 images
236  afwGeom.Extent2I(sizeCell * nCell,
237  sizeCell * nCell)),
238  sizeCell,
239  sizeCell)
240  stampHalfWidth = 2 * kSize
241  for x in range(nCell):
242  for y in range(nCell):
243  xCoord = x * sizeCell + sizeCell // 2
244  yCoord = y * sizeCell + sizeCell // 2
245  p0 = afwGeom.Point2I(xCoord - stampHalfWidth,
246  yCoord - stampHalfWidth)
247  p1 = afwGeom.Point2I(xCoord + stampHalfWidth,
248  yCoord + stampHalfWidth)
249  bbox = afwGeom.Box2I(p0, p1)
250  tsi = afwImage.MaskedImageF(tMi, bbox, origin=afwImage.LOCAL)
251  ssi = afwImage.MaskedImageF(sMi, bbox, origin=afwImage.LOCAL)
252 
253  kc = diffimLib.makeKernelCandidate(xCoord, yCoord, tsi, ssi, policyFake)
254  kernelCellSet.insertCandidate(kc)
255 
256  tMi.setXY0(0, 0)
257  sMi.setXY0(0, 0)
258  return tMi, sMi, sKernel, kernelCellSet, configFake
259 
260 
261 
264 
265 def backgroundSubtract(config, maskedImages):
266  """Subtract the background from masked images.
267 
268  Parameters
269  ----------
270  config : TODO: DM-17458
271  TODO: DM-17458
272  maskedImages : `list` of `lsst.afw.image.MaskedImage`
273  TODO: DM-17458
274 
275  Returns
276  -------
277  TODO: DM-17458
278  TODO: DM-17458
279  """
280  backgrounds = []
281  t0 = time.time()
282  algorithm = config.algorithm
283  binsize = config.binSize
284  undersample = config.undersampleStyle
285  bctrl = afwMath.BackgroundControl(algorithm)
286  bctrl.setUndersampleStyle(undersample)
287  for maskedImage in maskedImages:
288  bctrl.setNxSample(maskedImage.getWidth()//binsize + 1)
289  bctrl.setNySample(maskedImage.getHeight()//binsize + 1)
290  image = maskedImage.getImage()
291  backobj = afwMath.makeBackground(image, bctrl)
292 
293  image -= backobj.getImageF()
294  backgrounds.append(backobj.getImageF())
295  del backobj
296 
297  t1 = time.time()
298  logger = Log.getLogger("ip.diffim.backgroundSubtract")
299  logger.debug("Total time for background subtraction : %.2f s", (t1-t0))
300  return backgrounds
301 
302 
305 
306 
307 def writeKernelCellSet(kernelCellSet, psfMatchingKernel, backgroundModel, outdir):
308  """TODO: DM-17458
309 
310  Parameters
311  ----------
312  kernelCellSet : TODO: DM-17458
313  TODO: DM-17458
314  psfMatchingKernel : TODO: DM-17458
315  TODO: DM-17458
316  backgroundModel : TODO: DM-17458
317  TODO: DM-17458
318  outdir : TODO: DM-17458
319  TODO: DM-17458
320  """
321  if not os.path.isdir(outdir):
322  os.makedirs(outdir)
323 
324  for cell in kernelCellSet.getCellList():
325  for cand in cell.begin(False): # False = include bad candidates
326  if cand.getStatus() == afwMath.SpatialCellCandidate.GOOD:
327  xCand = int(cand.getXCenter())
328  yCand = int(cand.getYCenter())
329  idCand = cand.getId()
330  diffIm = cand.getDifferenceImage(diffimLib.KernelCandidateF.ORIG)
331  kernel = cand.getKernelImage(diffimLib.KernelCandidateF.ORIG)
332  diffIm.writeFits(os.path.join(outdir, 'diffim_c%d_x%d_y%d.fits' % (idCand, xCand, yCand)))
333  kernel.writeFits(os.path.join(outdir, 'kernel_c%d_x%d_y%d.fits' % (idCand, xCand, yCand)))
334 
335  # Diffim from spatial model
336  ski = afwImage.ImageD(kernel.getDimensions())
337  psfMatchingKernel.computeImage(ski, False, xCand, yCand)
338  sk = afwMath.FixedKernel(ski)
339  sbg = backgroundModel(xCand, yCand)
340  sdmi = cand.getDifferenceImage(sk, sbg)
341  sdmi.writeFits(os.path.join(outdir, 'sdiffim_c%d_x%d_y%d.fits' % (idCand, xCand, yCand)))
342 
343 
346 
347 
348 def sourceToFootprintList(candidateInList, templateExposure, scienceExposure, kernelSize, config, log):
349  """Convert a list of sources for the PSF-matching Kernel to Footprints.
350 
351  Parameters
352  ----------
353  candidateInList : TODO: DM-17458
354  Input list of Sources
355  templateExposure : TODO: DM-17458
356  Template image, to be checked for Mask bits in Source Footprint
357  scienceExposure : TODO: DM-17458
358  Science image, to be checked for Mask bits in Source Footprint
359  kernelSize : TODO: DM-17458
360  TODO: DM-17458
361  config : TODO: DM-17458
362  Config that defines the Mask planes that indicate an invalid Source and Bbox grow radius
363  log : TODO: DM-17458
364  Log for output
365 
366  Returns
367  -------
368  candidateOutList : `list`
369  a list of dicts having a "source" and "footprint" field, to be used for Psf-matching
370 
371  Raises
372  ------
373  RuntimeError
374  TODO: DM-17458
375 
376  Notes
377  -----
378  Takes an input list of Sources that were selected to constrain
379  the Psf-matching Kernel and turns them into a List of Footprints,
380  which are used to seed a set of KernelCandidates. The function
381  checks both the template and science image for masked pixels,
382  rejecting the Source if certain Mask bits (defined in config) are
383  set within the Footprint.
384  """
385 
386  candidateOutList = []
387  fsb = diffimLib.FindSetBitsU()
388  badBitMask = 0
389  for mp in config.badMaskPlanes:
390  badBitMask |= afwImage.Mask.getPlaneBitMask(mp)
391  bbox = scienceExposure.getBBox()
392 
393  # Size to grow Sources
394  if config.scaleByFwhm:
395  fpGrowPix = int(config.fpGrowKernelScaling * kernelSize + 0.5)
396  else:
397  fpGrowPix = config.fpGrowPix
398  log.info("Growing %d kernel candidate stars by %d pixels", len(candidateInList), fpGrowPix)
399 
400  for kernelCandidate in candidateInList:
401  if not type(kernelCandidate) == afwTable.SourceRecord:
402  raise RuntimeError("Candiate not of type afwTable.SourceRecord")
403  bm1 = 0
404  bm2 = 0
405  center = afwGeom.Point2I(scienceExposure.getWcs().skyToPixel(kernelCandidate.getCoord()))
406  if center[0] < bbox.getMinX() or center[0] > bbox.getMaxX():
407  continue
408  if center[1] < bbox.getMinY() or center[1] > bbox.getMaxY():
409  continue
410 
411  xmin = center[0] - fpGrowPix
412  xmax = center[0] + fpGrowPix
413  ymin = center[1] - fpGrowPix
414  ymax = center[1] + fpGrowPix
415 
416  # Keep object centered
417  if (xmin - bbox.getMinX()) < 0:
418  xmax += (xmin - bbox.getMinX())
419  xmin -= (xmin - bbox.getMinX())
420  if (ymin - bbox.getMinY()) < 0:
421  ymax += (ymin - bbox.getMinY())
422  ymin -= (ymin - bbox.getMinY())
423  if (bbox.getMaxX() - xmax) < 0:
424  xmin -= (bbox.getMaxX() - xmax)
425  xmax += (bbox.getMaxX() - xmax)
426  if (bbox.getMaxY() - ymax) < 0:
427  ymin -= (bbox.getMaxY() - ymax)
428  ymax += (bbox.getMaxY() - ymax)
429  if xmin > xmax or ymin > ymax:
430  continue
431 
432  kbbox = afwGeom.Box2I(afwGeom.Point2I(xmin, ymin), afwGeom.Point2I(xmax, ymax))
433  try:
434  fsb.apply(afwImage.MaskedImageF(templateExposure.getMaskedImage(), kbbox, deep=False).getMask())
435  bm1 = fsb.getBits()
436  fsb.apply(afwImage.MaskedImageF(scienceExposure.getMaskedImage(), kbbox, deep=False).getMask())
437  bm2 = fsb.getBits()
438  except Exception:
439  pass
440  else:
441  if not((bm1 & badBitMask) or (bm2 & badBitMask)):
442  candidateOutList.append({'source': kernelCandidate,
443  'footprint': afwDetect.Footprint(afwGeom.SpanSet(kbbox))})
444  log.info("Selected %d / %d sources for KernelCandidacy", len(candidateOutList), len(candidateInList))
445  return candidateOutList
446 
447 
448 def sourceTableToCandidateList(sourceTable, templateExposure, scienceExposure, kConfig, dConfig, log,
449  basisList, doBuild=False):
450  """Convert a list of Sources into KernelCandidates.
451 
452  The KernelCandidates are used for fitting the Psf-matching kernel.
453 
454  Parameters
455  ----------
456  sourceTable : TODO: DM-17458
457  TODO: DM-17458
458  templateExposure : TODO: DM-17458
459  TODO: DM-17458
460  scienceExposure : TODO: DM-17458
461  TODO: DM-17458
462  kConfig : TODO: DM-17458
463  TODO: DM-17458
464  dConfig : TODO: DM-17458
465  TODO: DM-17458
466  log : TODO: DM-17458
467  TODO: DM-17458
468  basisList : TODO: DM-17458
469  TODO: DM-17458
470  doBuild : `bool`, optional
471  TODO: DM-17458
472 
473  Returns
474  -------
475  TODO: DM-17458
476  TODO: DM-17458
477  """
478  kernelSize = basisList[0].getWidth()
479  footprintList = sourceToFootprintList(list(sourceTable), templateExposure, scienceExposure,
480  kernelSize, dConfig, log)
481  candList = []
482 
483  if doBuild and not basisList:
484  doBuild = False
485  else:
486  policy = pexConfig.makePolicy(kConfig)
487  visitor = diffimLib.BuildSingleKernelVisitorF(basisList, policy)
488 
489  policy = pexConfig.makePolicy(kConfig)
490  for cand in footprintList:
491  bbox = cand['footprint'].getBBox()
492  tmi = afwImage.MaskedImageF(templateExposure.getMaskedImage(), bbox)
493  smi = afwImage.MaskedImageF(scienceExposure.getMaskedImage(), bbox)
494  kCand = diffimLib.makeKernelCandidate(cand['source'], tmi, smi, policy)
495  if doBuild:
496  visitor.processCandidate(kCand)
497  kCand.setStatus(afwMath.SpatialCellCandidate.UNKNOWN)
498  candList.append(kCand)
499  return candList
500 
501 
502 
505 
506 
508  """A functor to evaluate the Bayesian Information Criterion for the number of basis sets
509  going into the kernel fitting"""
510 
511  def __init__(self, psfMatchConfig, psfFwhmPixTc, psfFwhmPixTnc):
512  self.psfMatchConfig = psfMatchConfig
513  self.psfFwhmPixTc = psfFwhmPixTc
514  self.psfFwhmPixTnc = psfFwhmPixTnc
515  if not self.psfMatchConfig.kernelBasisSet == "alard-lupton":
516  raise RuntimeError("BIC only implemnted for AL (alard lupton) basis")
517 
518  def __call__(self, kernelCellSet, log):
519  d1, d2, d3 = self.psfMatchConfig.alardDegGauss
520  bicArray = {}
521  for d1i in range(1, d1+1):
522  for d2i in range(1, d2+1):
523  for d3i in range(1, d3+1):
524  dList = [d1i, d2i, d3i]
525  bicConfig = type(self.psfMatchConfig)(self.psfMatchConfig, alardDegGauss=dList)
526  kList = makeKernelBasisList(bicConfig, self.psfFwhmPixTc, self.psfFwhmPixTnc)
527  k = len(kList)
528  visitor = diffimLib.BuildSingleKernelVisitorF(kList, pexConfig.makePolicy(bicConfig))
529  visitor.setSkipBuilt(False)
530  kernelCellSet.visitCandidates(visitor, bicConfig.nStarPerCell)
531 
532  for cell in kernelCellSet.getCellList():
533  for cand in cell.begin(False): # False = include bad candidates
534  if cand.getStatus() != afwMath.SpatialCellCandidate.GOOD:
535  continue
536  diffIm = cand.getDifferenceImage(diffimLib.KernelCandidateF.RECENT)
537  bbox = cand.getKernel(diffimLib.KernelCandidateF.RECENT).shrinkBBox(
538  diffIm.getBBox(afwImage.LOCAL))
539  diffIm = type(diffIm)(diffIm, bbox, True)
540  chi2 = diffIm.getImage().getArray()**2 / diffIm.getVariance().getArray()
541  n = chi2.shape[0] * chi2.shape[1]
542  bic = np.sum(chi2) + k * np.log(n)
543  if cand.getId() not in bicArray:
544  bicArray[cand.getId()] = {}
545  bicArray[cand.getId()][(d1i, d2i, d3i)] = bic
546 
547  bestConfigs = []
548  for candId in bicArray:
549  cconfig, cvals = list(bicArray[candId].keys()), list(bicArray[candId].values())
550  idx = np.argsort(cvals)
551  bestConfig = cconfig[idx[0]]
552  bestConfigs.append(bestConfig)
553 
554  counter = Counter(bestConfigs).most_common(3)
555  log.info("B.I.C. prefers basis complexity %s %d times; %s %d times; %s %d times",
556  counter[0][0], counter[0][1],
557  counter[1][0], counter[1][1],
558  counter[2][0], counter[2][1])
559  return counter[0][0], counter[1][0], counter[2][0]
def makeFlatNoiseImage(mi, seedStat=afwMath.MAX)
Add noise.
Definition: diffimTools.py:52
def makeKernelBasisList(config, targetFwhmPix=None, referenceFwhmPix=None, basisDegGauss=None, metadata=None)
def fakeCoeffs()
Make fake images for testing; one is a delta function (or narrow gaussian) and the other is a convolu...
Definition: diffimTools.py:101
A compact representation of a collection of pixels.
Definition: SpanSet.h:77
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...
Definition: Background.h:566
Pass parameters to a Background object.
Definition: Background.h:57
int min
def backgroundSubtract(config, maskedImages)
Background subtraction for ip_diffim.
Definition: diffimTools.py:265
def makeFakeKernelSet(sizeCell=128, nCell=3, deltaFunctionCounts=1.e4, tGaussianWidth=1.0, addNoise=True, bgValue=100., display=False)
Definition: diffimTools.py:113
Definition: Log.h:691
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<>
Definition: Statistics.h:520
A collection of SpatialCells covering an entire image.
Definition: SpatialCell.h:387
def writeKernelCellSet(kernelCellSet, psfMatchingKernel, backgroundModel, outdir)
More coarse debugging.
Definition: diffimTools.py:307
table::Key< int > type
Definition: Detector.cc:164
Represent a 2-dimensional array of bitmask pixels.
Definition: Mask.h:78
A kernel that is a linear combination of fixed basis kernels.
Definition: Kernel.h:741
void randomGaussianImage(ImageT *image, Random &rand)
Set image to random numbers with a gaussian N(0, 1) distribution.
Definition: RandomImage.cc:130
Class to describe the properties of a detected object from an image.
Definition: Footprint.h:62
def sourceTableToCandidateList(sourceTable, templateExposure, scienceExposure, kConfig, dConfig, log, basisList, doBuild=False)
Definition: diffimTools.py:449
Record class that contains measurements made on a single exposure.
Definition: Source.h:82
def __init__(self, psfMatchConfig, psfFwhmPixTc, psfFwhmPixTnc)
Definition: diffimTools.py:511
void convolve(OutImageT &convolvedImage, InImageT const &inImage, KernelT const &kernel, bool doNormalize, bool doCopyEdge=false)
Old, deprecated version of convolve.
A kernel described by a function.
Definition: Kernel.h:573
An integer coordinate rectangle.
Definition: Box.h:54
daf::base::PropertyList * list
Definition: fits.cc:833
def __call__(self, kernelCellSet, log)
Definition: diffimTools.py:518
A class that can be used to generate sequences of random numbers according to a number of different a...
Definition: Random.h:57
def sourceToFootprintList(candidateInList, templateExposure, scienceExposure, kernelSize, config, log)
Converting types.
Definition: diffimTools.py:348
A kernel created from an Image.
Definition: Kernel.h:509