LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.ip.diffim.psfMatch.PsfMatchTask Class Reference
Inheritance diagram for lsst.ip.diffim.psfMatch.PsfMatchTask:
lsst.ip.diffim.imagePsfMatch.ImagePsfMatchTask lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask lsst.ip.diffim.snapPsfMatch.SnapPsfMatchTask lsst.ip.diffim.zogy.ZogyImagePsfMatchTask

Public Member Functions

def __init__ (self, *args, **kwargs)
 

Public Attributes

 kConfig
 
 useRegularization
 
 hMat
 

Static Public Attributes

 ConfigClass = PsfMatchConfig
 

Detailed Description

Base class for Psf Matching; should not be called directly

Notes
-----
PsfMatchTask is a base class that implements the core functionality for matching the
Psfs of two images using a spatially varying Psf-matching `lsst.afw.math.LinearCombinationKernel`.
The Task requires the user to provide an instance of an `lsst.afw.math.SpatialCellSet`,
filled with `lsst.ip.diffim.KernelCandidate` instances, and a list of `lsst.afw.math.Kernels`
of basis shapes that will be used for the decomposition.  If requested, the Task
also performs background matching and returns the differential background model as an
`lsst.afw.math.Kernel.SpatialFunction`.

**Invoking the Task**

As a base class, this Task is not directly invoked.  However, ``run()`` methods that are
implemented on derived classes will make use of the core ``_solve()`` functionality,
which defines a sequence of `lsst.afw.math.CandidateVisitor` classes that iterate
through the KernelCandidates, first building up a per-candidate solution and then
building up a spatial model from the ensemble of candidates.  Sigma clipping is
performed using the mean and standard deviation of all kernel sums (to reject
variable objects), on the per-candidate substamp diffim residuals
(to indicate a bad choice of kernel basis shapes for that particular object),
and on the substamp diffim residuals using the spatial kernel fit (to indicate a bad
choice of spatial kernel order, or poor constraints on the spatial model).  The
``_diagnostic()`` method logs information on the quality of the spatial fit, and also
modifies the Task metadata.

.. list-table:: Quantities set in Metadata
   :header-rows: 1

   * - Parameter
     - Description
   * - ``spatialConditionNum``
     - Condition number of the spatial kernel fit
   * - ``spatialKernelSum``
     - Kernel sum (10^{-0.4 * ``Delta``; zeropoint}) of the spatial Psf-matching kernel
   * - ``ALBasisNGauss``
     - If using sum-of-Gaussian basis, the number of gaussians used
   * - ``ALBasisDegGauss``
     - If using sum-of-Gaussian basis, the deg of spatial variation of the Gaussians
   * - ``ALBasisSigGauss``
     - If using sum-of-Gaussian basis, the widths (sigma) of the Gaussians
   * - ``ALKernelSize``
     - If using sum-of-Gaussian basis, the kernel size
   * - ``NFalsePositivesTotal``
     - Total number of diaSources
   * - ``NFalsePositivesRefAssociated``
     - Number of diaSources that associate with the reference catalog
   * - ``NFalsePositivesRefAssociated``
     - Number of diaSources that associate with the source catalog
   * - ``NFalsePositivesUnassociated``
     - Number of diaSources that are orphans
   * - ``metric_MEAN``
     - Mean value of substamp diffim quality metrics across all KernelCandidates,
       for both the per-candidate (LOCAL) and SPATIAL residuals
   * - ``metric_MEDIAN``
     - Median value of substamp diffim quality metrics across all KernelCandidates,
       for both the per-candidate (LOCAL) and SPATIAL residuals
   * - ``metric_STDEV``
     - Standard deviation of substamp diffim quality metrics across all KernelCandidates,
       for both the per-candidate (LOCAL) and SPATIAL residuals

**Debug variables**

The `lsst.pipe.base.cmdLineTask.CmdLineTask` command line task interface supports a
flag -d/--debug to import @b debug.py from your PYTHONPATH.  The relevant contents of debug.py
for this Task include:

.. code-block:: py

    import sys
    import lsstDebug
    def DebugInfo(name):
        di = lsstDebug.getInfo(name)
        if name == "lsst.ip.diffim.psfMatch":
            # enable debug output
            di.display = True
            # display mask transparency
            di.maskTransparency = 80
            # show all the candidates and residuals
            di.displayCandidates = True
            # show kernel basis functions
            di.displayKernelBasis = False
            # show kernel realized across the image
            di.displayKernelMosaic = True
            # show coefficients of spatial model
            di.plotKernelSpatialModel = False
            # show fixed and spatial coefficients and coefficient histograms
            di.plotKernelCoefficients = True
            # show the bad candidates (red) along with good (green)
            di.showBadCandidates = True
        return di
    lsstDebug.Info = DebugInfo
    lsstDebug.frame = 1

Note that if you want additional logging info, you may add to your scripts:

.. code-block:: py

    import lsst.log.utils as logUtils
    logUtils.traceSetAt("lsst.ip.diffim", 4)

Definition at line 528 of file psfMatch.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.ip.diffim.psfMatch.PsfMatchTask.__init__ (   self,
args,
**  kwargs 
)
Create the psf-matching Task

Parameters
----------
*args
    Arguments to be passed to ``lsst.pipe.base.task.Task.__init__``
**kwargs
    Keyword arguments to be passed to ``lsst.pipe.base.task.Task.__init__``

Notes
-----
The initialization sets the Psf-matching kernel configuration using the value of
self.config.kernel.active.  If the kernel is requested with regularization to moderate
the bias/variance tradeoff, currently only used when a delta function kernel basis
is provided, it creates a regularization matrix stored as member variable
self.hMat.

Reimplemented in lsst.ip.diffim.zogy.ZogyImagePsfMatchTask, lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask, and lsst.ip.diffim.imagePsfMatch.ImagePsfMatchTask.

Definition at line 634 of file psfMatch.py.

634  def __init__(self, *args, **kwargs):
635  """Create the psf-matching Task
636 
637  Parameters
638  ----------
639  *args
640  Arguments to be passed to ``lsst.pipe.base.task.Task.__init__``
641  **kwargs
642  Keyword arguments to be passed to ``lsst.pipe.base.task.Task.__init__``
643 
644  Notes
645  -----
646  The initialization sets the Psf-matching kernel configuration using the value of
647  self.config.kernel.active. If the kernel is requested with regularization to moderate
648  the bias/variance tradeoff, currently only used when a delta function kernel basis
649  is provided, it creates a regularization matrix stored as member variable
650  self.hMat.
651  """
652  pipeBase.Task.__init__(self, *args, **kwargs)
653  self.kConfig = self.config.kernel.active
654 
655  if 'useRegularization' in self.kConfig:
656  self.useRegularization = self.kConfig.useRegularization
657  else:
658  self.useRegularization = False
659 
660  if self.useRegularization:
661  self.hMat = diffimLib.makeRegularizationMatrix(pexConfig.makePropertySet(self.kConfig))
662 

Member Data Documentation

◆ ConfigClass

lsst.ip.diffim.psfMatch.PsfMatchTask.ConfigClass = PsfMatchConfig
static

Definition at line 631 of file psfMatch.py.

◆ hMat

lsst.ip.diffim.psfMatch.PsfMatchTask.hMat

Definition at line 661 of file psfMatch.py.

◆ kConfig

lsst.ip.diffim.psfMatch.PsfMatchTask.kConfig

Definition at line 653 of file psfMatch.py.

◆ useRegularization

lsst.ip.diffim.psfMatch.PsfMatchTask.useRegularization

Definition at line 656 of file psfMatch.py.


The documentation for this class was generated from the following file: