LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
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 342 of file measurePsf.py.

343 def plotPsfCandidates(cellSet, showBadCandidates=False, frame=1):
344  import lsst.afw.display.utils as displayUtils
345 
346  stamps = []
347  for cell in cellSet.getCellList():
348  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
349  cand = measAlg.cast_PsfCandidateF(cand)
350 
351  try:
352  im = cand.getMaskedImage()
353 
354  chi2 = cand.getChi2()
355  if chi2 < 1e100:
356  chi2 = "%.1f" % chi2
357  else:
358  chi2 = numpy.nan
359 
360  stamps.append((im, "%d%s" %
361  (maUtils.splitId(cand.getSource().getId(), True)["objId"], chi2),
362  cand.getStatus()))
363  except Exception, e:
364  continue
365 
366  mos = displayUtils.Mosaic()
367  for im, label, status in stamps:
368  im = type(im)(im, True)
369  try:
370  im /= afwMath.makeStatistics(im, afwMath.MAX).getValue()
371  except NotImplementedError:
372  pass
373 
374  mos.append(im, label,
375  ds9.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
376  ds9.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else ds9.RED)
377 
378  if mos.images:
379  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:1082
def lsst.pipe.tasks.measurePsf.plotResiduals (   exposure,
  cellSet,
  showBadCandidates = False,
  normalizeResiduals = True,
  frame = 2 
)

Definition at line 380 of file measurePsf.py.

381 def plotResiduals(exposure, cellSet, showBadCandidates=False, normalizeResiduals=True, frame=2):
382  psf = exposure.getPsf()
383  while True:
384  try:
385  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, frame=frame,
386  normalize=normalizeResiduals,
387  showBadCandidates=showBadCandidates)
388  frame += 1
389  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, frame=frame,
390  normalize=normalizeResiduals,
391  showBadCandidates=showBadCandidates,
392  variance=True)
393  frame += 1
394  except Exception as e:
395  if not showBadCandidates:
396  showBadCandidates = True
397  continue
398  break
399 
400  return frame
def lsst.pipe.tasks.measurePsf.showPsfSpatialCells (   exposure,
  cellSet,
  showBadCandidates,
  frame = 1 
)

Definition at line 330 of file measurePsf.py.

331 def showPsfSpatialCells(exposure, cellSet, showBadCandidates, frame=1):
332  maUtils.showPsfSpatialCells(exposure, cellSet,
333  symb="o", ctype=ds9.CYAN, ctypeUnused=ds9.YELLOW,
334  size=4, frame=frame)
335  for cell in cellSet.getCellList():
336  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
337  cand = measAlg.cast_PsfCandidateF(cand)
338  status = cand.getStatus()
339  ds9.dot('+', *cand.getSource().getCentroid(), frame=frame,
340  ctype=ds9.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
341  ds9.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else ds9.RED)