LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
Classes | Functions
lsst.pipe.tasks.measurePsf Namespace Reference

Classes

class  MeasurePsfConfig
 
class  MeasurePsfTask
 Measure the PSF. More...
 

Functions

def showPsfSpatialCells
 
def plotPsfCandidates
 
def plotResiduals
 

Function Documentation

def lsst.pipe.tasks.measurePsf.plotPsfCandidates (   cellSet,
  showBadCandidates = False,
  frame = 1 
)

Definition at line 358 of file measurePsf.py.

359 def plotPsfCandidates(cellSet, showBadCandidates=False, frame=1):
360  import lsst.afw.display.utils as displayUtils
361 
362  stamps = []
363  for cell in cellSet.getCellList():
364  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
365  cand = measAlg.cast_PsfCandidateF(cand)
366 
367  try:
368  im = cand.getMaskedImage()
369 
370  chi2 = cand.getChi2()
371  if chi2 < 1e100:
372  chi2 = "%.1f" % chi2
373  else:
374  chi2 = numpy.nan
375 
376  stamps.append((im, "%d%s" %
377  (maUtils.splitId(cand.getSource().getId(), True)["objId"], chi2),
378  cand.getStatus()))
379  except Exception, e:
380  continue
381 
382  mos = displayUtils.Mosaic()
383  for im, label, status in stamps:
384  im = type(im)(im, True)
385  try:
386  im /= afwMath.makeStatistics(im, afwMath.MAX).getValue()
387  except NotImplementedError:
388  pass
389 
390  mos.append(im, label,
391  ds9.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
392  ds9.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else ds9.RED)
393 
394  if mos.images:
395  mos.makeMosaic(frame=frame, title="Psf Candidates")
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1023
def lsst.pipe.tasks.measurePsf.plotResiduals (   exposure,
  cellSet,
  showBadCandidates = False,
  normalizeResiduals = True,
  frame = 2 
)

Definition at line 396 of file measurePsf.py.

397 def plotResiduals(exposure, cellSet, showBadCandidates=False, normalizeResiduals=True, frame=2):
398  psf = exposure.getPsf()
399  while True:
400  try:
401  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, frame=frame,
402  normalize=normalizeResiduals,
403  showBadCandidates=showBadCandidates)
404  frame += 1
405  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, frame=frame,
406  normalize=normalizeResiduals,
407  showBadCandidates=showBadCandidates,
408  variance=True)
409  frame += 1
410  except Exception as e:
411  if not showBadCandidates:
412  showBadCandidates = True
413  continue
414  break
415 
416  return frame
def lsst.pipe.tasks.measurePsf.showPsfSpatialCells (   exposure,
  cellSet,
  showBadCandidates,
  frame = 1 
)

Definition at line 346 of file measurePsf.py.

347 def showPsfSpatialCells(exposure, cellSet, showBadCandidates, frame=1):
348  maUtils.showPsfSpatialCells(exposure, cellSet,
349  symb="o", ctype=ds9.CYAN, ctypeUnused=ds9.YELLOW,
350  size=4, frame=frame)
351  for cell in cellSet.getCellList():
352  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
353  cand = measAlg.cast_PsfCandidateF(cand)
354  status = cand.getStatus()
355  ds9.dot('+', *cand.getSource().getCentroid(), frame=frame,
356  ctype=ds9.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
357  ds9.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else ds9.RED)