LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
Matching of two model Psfs, and application of the Psf-matching kernel to an input Exposure. More...
Public Member Functions | |
def | __init__ |
Create a ModelPsfMatchTask. More... | |
def | run |
Psf-match an exposure to a model Psf. More... | |
Public Attributes | |
kConfig | |
Static Public Attributes | |
ConfigClass = ModelPsfMatchConfig | |
Private Member Functions | |
def | _diagnostic |
Print diagnostic information on spatial kernel and background fit. More... | |
def | _buildCellSet |
Build a SpatialCellSet for use with the solve method. More... | |
Matching of two model Psfs, and application of the Psf-matching kernel to an input Exposure.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This Task differs from ImagePsfMatchTask in that it matches two Psf models, by realizing them in an Exposure-sized SpatialCellSet and then inserting each Psf-image pair into KernelCandidates. Because none of the pairs of sources that are to be matched should be invalid, all sigma clipping is turned off in ModelPsfMatchConfig. And because there is no tracked variance in the Psf images, the debugging and logging QA info should be interpreted with caution.
One item of note is that the sizes of Psf models are fixed (e.g. its defined as a 21x21 matrix). When the Psf-matching kernel is being solved for, the Psf "image" is convolved with each kernel basis function, leading to a loss of information around the borders. This pixel loss will be problematic for the numerical stability of the kernel solution if the size of the convolution kernel (set by ModelPsfMatchConfig.kernelSize) is much bigger than: psfSize//2. Thus the sizes of Psf-model matching kernels are typically smaller than their image-matching counterparts. If the size of the kernel is too small, the convolved stars will look "boxy"; if the kernel is too large, the kernel solution will be "noisy". This is a trade-off that needs careful attention for a given dataset.
The primary use case for this Task is in matching an Exposure to a constant-across-the-sky Psf model for the purposes of image coaddition. It is important to note that in the code, the "template" Psf is the Psf that the science image gets matched to. In this sense the order of template and science image are reversed, compared to ImagePsfMatchTask, which operates on the template image.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Create a ModelPsfMatchTask.
*args | arguments to be passed to lsst.ip.diffim.PsfMatchTask.__init__ |
**kwargs | keyword arguments to be passed to lsst.ip.diffim.PsfMatchTask.__init__ |
Upon initialization, the kernel configuration is defined by self.config.kernel.active. This Task does have a run() method, which is the default way to call the Task.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Psf-match an exposure to a model Psf.
exposure: | Exposure to Psf-match to the reference Psf model; it must return a valid PSF model via exposure.getPsf() |
referencePsfModel: | The Psf model to match to (an lsst.afw.detection.Psf) |
kernelSum: | A multipicative factor to apply to the kernel sum (default=1.0) |
Raise a RuntimeError if the Exposure does not contain a Psf model
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
See PsfMatchTask
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The command line task interface supports a flag -d/–debug
to import debug.py from your PYTHONPATH
. The relevant contents of debug.py for this Task include:
Note that if you want addional logging info, you may add to your scripts:
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This code is modelPsfMatchTask.py in the examples directory, and can be run as e.g.
And allow the user the freedom to either run the script in default mode, or point to their own images on disk. Note that these images must be readable as an lsst.afw.image.Exposure:
We have enabled some minor display debugging in this script via the –debug option. However, if you have an lsstDebug debug.py in your PYTHONPATH you will get additional debugging displays. The following block checks for this script:
Make sure the images (if any) that were sent to the script exist on disk and are readable. If no images are sent, make some fake data up for the sake of this example script (have a look at the code if you want more details on generateFakeData):
Display the two images if –debug:
Create and run the Task:
And finally provide optional debugging display of the Psf-matched (via the Psf models) science image:
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Definition at line 69 of file modelPsfMatch.py.
def lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask.__init__ | ( | self, | |
args, | |||
kwargs | |||
) |
Create a ModelPsfMatchTask.
*args | arguments to be passed to lsst.ip.diffim.PsfMatchTask.__init__ |
**kwargs | keyword arguments to be passed to lsst.ip.diffim.PsfMatchTask.__init__ |
Upon initialization, the kernel configuration is defined by self.config.kernel.active. This Task does have a run() method, which is the default way to call the Task.
Definition at line 227 of file modelPsfMatch.py.
|
private |
Build a SpatialCellSet for use with the solve method.
exposure: | The science exposure that will be convolved; must contain a Psf |
referencePsfModel: | Psf model to match to |
Raise a RuntimeError if the reference Psf model and science Psf model have different dimensions
Definition at line 308 of file modelPsfMatch.py.
|
private |
Print diagnostic information on spatial kernel and background fit.
The debugging diagnostics are not really useful here, since the images we are matching have no variance. Thus override the _diagnostic method to generate no logging information
Definition at line 301 of file modelPsfMatch.py.
def lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask.run | ( | self, | |
exposure, | |||
referencePsfModel, | |||
kernelSum = 1.0 |
|||
) |
Psf-match an exposure to a model Psf.
exposure: | Exposure to Psf-match to the reference Psf model; it must return a valid PSF model via exposure.getPsf() |
referencePsfModel: | The Psf model to match to (an lsst.afw.detection.Psf) |
kernelSum: | A multipicative factor to apply to the kernel sum (default=1.0) |
Raise a RuntimeError if the Exposure does not contain a Psf model
Definition at line 240 of file modelPsfMatch.py.
|
static |
Definition at line 225 of file modelPsfMatch.py.
lsst.ip.diffim.modelPsfMatch.ModelPsfMatchTask.kConfig |
Definition at line 237 of file modelPsfMatch.py.