LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Classes | Functions
lsst.pipe.tasks.measurePsf Namespace Reference

Classes

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

Functions

def showPsfSpatialCells (exposure, cellSet, showBadCandidates, frame=1)
 
def plotPsfCandidates (cellSet, showBadCandidates=False, frame=1)
 
def plotResiduals (exposure, cellSet, showBadCandidates=False, normalizeResiduals=True, frame=2)
 

Function Documentation

◆ plotPsfCandidates()

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

Definition at line 355 of file measurePsf.py.

355 def plotPsfCandidates(cellSet, showBadCandidates=False, frame=1):
356  stamps = []
357  for cell in cellSet.getCellList():
358  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
359  try:
360  im = cand.getMaskedImage()
361 
362  chi2 = cand.getChi2()
363  if chi2 < 1e100:
364  chi2 = "%.1f" % chi2
365  else:
366  chi2 = float("nan")
367 
368  stamps.append((im, "%d%s" %
369  (maUtils.splitId(cand.getSource().getId(), True)["objId"], chi2),
370  cand.getStatus()))
371  except Exception:
372  continue
373 
374  mos = afwDisplay.utils.Mosaic()
375  disp = afwDisplay.Display(frame=frame)
376  for im, label, status in stamps:
377  im = type(im)(im, True)
378  try:
379  im /= afwMath.makeStatistics(im, afwMath.MAX).getValue()
380  except NotImplementedError:
381  pass
382 
383  mos.append(im, label,
384  afwDisplay.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
385  afwDisplay.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else afwDisplay.RED)
386 
387  if mos.images:
388  disp.mtv(mos.makeMosaic(), title="Psf Candidates")
389 
390 

◆ plotResiduals()

def lsst.pipe.tasks.measurePsf.plotResiduals (   exposure,
  cellSet,
  showBadCandidates = False,
  normalizeResiduals = True,
  frame = 2 
)

Definition at line 391 of file measurePsf.py.

391 def plotResiduals(exposure, cellSet, showBadCandidates=False, normalizeResiduals=True, frame=2):
392  psf = exposure.getPsf()
393  disp = afwDisplay.Display(frame=frame)
394  while True:
395  try:
396  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, display=disp,
397  normalize=normalizeResiduals,
398  showBadCandidates=showBadCandidates)
399  frame += 1
400  maUtils.showPsfCandidates(exposure, cellSet, psf=psf, display=disp,
401  normalize=normalizeResiduals,
402  showBadCandidates=showBadCandidates,
403  variance=True)
404  frame += 1
405  except Exception:
406  if not showBadCandidates:
407  showBadCandidates = True
408  continue
409  break
410 
411  return frame

◆ showPsfSpatialCells()

def lsst.pipe.tasks.measurePsf.showPsfSpatialCells (   exposure,
  cellSet,
  showBadCandidates,
  frame = 1 
)

Definition at line 342 of file measurePsf.py.

342 def showPsfSpatialCells(exposure, cellSet, showBadCandidates, frame=1):
343  disp = afwDisplay.Display(frame=frame)
344  maUtils.showPsfSpatialCells(exposure, cellSet,
345  symb="o", ctype=afwDisplay.CYAN, ctypeUnused=afwDisplay.YELLOW,
346  size=4, display=disp)
347  for cell in cellSet.getCellList():
348  for cand in cell.begin(not showBadCandidates): # maybe include bad candidates
349  status = cand.getStatus()
350  disp.dot('+', *cand.getSource().getCentroid(),
351  ctype=afwDisplay.GREEN if status == afwMath.SpatialCellCandidate.GOOD else
352  afwDisplay.YELLOW if status == afwMath.SpatialCellCandidate.UNKNOWN else afwDisplay.RED)
353 
354 
lsst::afw::math::makeStatistics
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
lsst.pipe.tasks.measurePsf.plotPsfCandidates
def plotPsfCandidates(cellSet, showBadCandidates=False, frame=1)
Definition: measurePsf.py:355
lsst.pipe.tasks.measurePsf.plotResiduals
def plotResiduals(exposure, cellSet, showBadCandidates=False, normalizeResiduals=True, frame=2)
Definition: measurePsf.py:391
type
table::Key< int > type
Definition: Detector.cc:163
lsst.pipe.tasks.measurePsf.showPsfSpatialCells
def showPsfSpatialCells(exposure, cellSet, showBadCandidates, frame=1)
Definition: measurePsf.py:342