lsst.ip.diffim  19.0.0-21-g2644856+13
Classes | Functions | Variables
lsst.ip.diffim.utils Namespace Reference

Classes

class  DipoleTestImage
 

Functions

def showSourceSet (sSet, xy0=(0, 0), frame=0, ctype=afwDisplay.GREEN, symb="+", size=2)
 
def showKernelSpatialCells (maskedIm, kernelCellSet, showChi2=False, symb="o", ctype=None, ctypeUnused=None, ctypeBad=None, size=3, frame=None, title="Spatial Cells")
 
def showDiaSources (sources, exposure, isFlagged, isDipole, frame=None)
 
def showKernelCandidates (kernelCellSet, kernel, background, frame=None, showBadCandidates=True, resids=False, kernels=False)
 
def showKernelBasis (kernel, frame=None)
 
def plotKernelSpatialModel (kernel, kernelCellSet, showBadCandidates=True, numSample=128, keepPlots=True, maxCoeff=10)
 
def plotKernelCoefficients (spatialKernel, kernelCellSet, showBadCandidates=False, keepPlots=True)
 
def showKernelMosaic (bbox, kernel, nx=7, ny=None, frame=None, title=None, showCenter=True, showEllipticity=True)
 
def plotPixelResiduals (exposure, warpedTemplateExposure, diffExposure, kernelCellSet, kernel, background, testSources, config, origVariance=False, nptsFull=1e6, keepPlots=True, titleFs=14)
 
def calcCentroid (arr)
 
def calcWidth (arr, centx, centy)
 
def printSkyDiffs (sources, wcs)
 
def makeRegions (sources, outfilename, wcs=None)
 
def showSourceSetSky (sSet, wcs, xy0, frame=0, ctype=afwDisplay.GREEN, symb="+", size=2)
 
def plotWhisker (results, newWcs)
 

Variables

bool keptPlots = False
 

Function Documentation

◆ calcCentroid()

def lsst.ip.diffim.utils.calcCentroid (   arr)
Calculate first moment of a (kernel) image.

Definition at line 814 of file utils.py.

◆ calcWidth()

def lsst.ip.diffim.utils.calcWidth (   arr,
  centx,
  centy 
)
Calculate second moment of a (kernel) image.

Definition at line 829 of file utils.py.

◆ makeRegions()

def lsst.ip.diffim.utils.makeRegions (   sources,
  outfilename,
  wcs = None 
)
Create regions file for display from input source list.

Definition at line 860 of file utils.py.

◆ plotKernelCoefficients()

def lsst.ip.diffim.utils.plotKernelCoefficients (   spatialKernel,
  kernelCellSet,
  showBadCandidates = False,
  keepPlots = True 
)
Plot the individual kernel candidate and the spatial kernel solution coefficients.

Parameters
----------

spatialKernel : `lsst.afw.math.LinearCombinationKernel`
    The spatial spatialKernel solution model which is a spatially varying linear combination
    of the spatialKernel basis functions.
    Typically returned by `lsst.ip.diffim.SpatialKernelSolution.getSolutionPair()`.

kernelCellSet : `lsst.afw.math.SpatialCellSet`
    The spatial cells that was used for solution for the spatialKernel. They contain the
    local solutions of the AL kernel for the selected sources.

showBadCandidates : `bool`, optional
    If True, plot the coefficient values for kernel candidates where the solution was marked
    bad by the numerical algorithm. Defaults to False.

keepPlots: `bool`, optional
    If True, sets ``plt.show()`` to be called before the task terminates, so that the plots
    can be explored interactively. Defaults to True.

Notes
-----
This function produces 3 figures per image subtraction operation.
* A grid plot of the local solutions. Each grid cell corresponds to a proportional area in
  the image. In each cell, local kernel solution coefficients are plotted of kernel candidates (color)
  that fall into this area as a function of the kernel basis function number.
* A grid plot of the spatial solution. Each grid cell corresponds to a proportional area in
  the image. In each cell, the spatial solution coefficients are evaluated for the center of the cell.
* Histogram of the local solution coefficients. Red line marks the spatial solution value at
  center of the image.

This function is called if ``lsst.ip.diffim.psfMatch.plotKernelCoefficients==True`` in lsstDebug. This
function was implemented as part of DM-17825.

Definition at line 428 of file utils.py.

◆ plotKernelSpatialModel()

def lsst.ip.diffim.utils.plotKernelSpatialModel (   kernel,
  kernelCellSet,
  showBadCandidates = True,
  numSample = 128,
  keepPlots = True,
  maxCoeff = 10 
)
Plot the Kernel spatial model.

Definition at line 278 of file utils.py.

◆ plotPixelResiduals()

def lsst.ip.diffim.utils.plotPixelResiduals (   exposure,
  warpedTemplateExposure,
  diffExposure,
  kernelCellSet,
  kernel,
  background,
  testSources,
  config,
  origVariance = False,
  nptsFull = 1e6,
  keepPlots = True,
  titleFs = 14 
)
Plot diffim residuals for LOCAL and SPATIAL models.

Definition at line 670 of file utils.py.

◆ plotWhisker()

def lsst.ip.diffim.utils.plotWhisker (   results,
  newWcs 
)
Plot whisker diagram of astromeric offsets between results.matches.

Definition at line 889 of file utils.py.

◆ printSkyDiffs()

def lsst.ip.diffim.utils.printSkyDiffs (   sources,
  wcs 
)
Print differences in sky coordinates.

The difference is that between the source Position and its Centroid mapped
through Wcs.

Definition at line 845 of file utils.py.

◆ showDiaSources()

def lsst.ip.diffim.utils.showDiaSources (   sources,
  exposure,
  isFlagged,
  isDipole,
  frame = None 
)
Display Dia Sources.

Definition at line 106 of file utils.py.

◆ showKernelBasis()

def lsst.ip.diffim.utils.showKernelBasis (   kernel,
  frame = None 
)
Display a Kernel's basis images.

Definition at line 260 of file utils.py.

◆ showKernelCandidates()

def lsst.ip.diffim.utils.showKernelCandidates (   kernelCellSet,
  kernel,
  background,
  frame = None,
  showBadCandidates = True,
  resids = False,
  kernels = False 
)
Display the Kernel candidates.

If kernel is provided include spatial model and residuals;
If chi is True, generate a plot of residuals/sqrt(variance), i.e. chi.

Definition at line 142 of file utils.py.

◆ showKernelMosaic()

def lsst.ip.diffim.utils.showKernelMosaic (   bbox,
  kernel,
  nx = 7,
  ny = None,
  frame = None,
  title = None,
  showCenter = True,
  showEllipticity = True 
)
Show a mosaic of Kernel images.

Definition at line 587 of file utils.py.

◆ showKernelSpatialCells()

def lsst.ip.diffim.utils.showKernelSpatialCells (   maskedIm,
  kernelCellSet,
  showChi2 = False,
  symb = "o",
  ctype = None,
  ctypeUnused = None,
  ctypeBad = None,
  size = 3,
  frame = None,
  title = "Spatial Cells" 
)
Show the SpatialCells.

If symb is something that display.dot understands (e.g. "o"), the top
nMaxPerCell candidates will be indicated with that symbol, using ctype
and size.

Definition at line 67 of file utils.py.

◆ showSourceSet()

def lsst.ip.diffim.utils.showSourceSet (   sSet,
  xy0 = (0, 0),
  frame = 0,
  ctype = afwDisplay.GREEN,
  symb = "+",
  size = 2 
)
Draw the (XAstrom, YAstrom) positions of a set of Sources.

Image has the given XY0.

Definition at line 47 of file utils.py.

◆ showSourceSetSky()

def lsst.ip.diffim.utils.showSourceSetSky (   sSet,
  wcs,
  xy0,
  frame = 0,
  ctype = afwDisplay.GREEN,
  symb = "+",
  size = 2 
)
Draw the (RA, Dec) positions of a set of Sources. Image has the XY0.

Definition at line 877 of file utils.py.

Variable Documentation

◆ keptPlots

bool lsst.ip.diffim.utils.keptPlots = False

Definition at line 44 of file utils.py.