AlardLuptonSubtractTask

AlardLuptonSubtractTask performs image differencing, including decorrelation.

Description

This task takes the pair of science and template exposures, together with the science image source catalog, and produces difference and matched template exposures as outputs.

The process involves selecting sources from the science exposure source catalog, obtaining the convolution kernel, applying this to the target image, and subtracting the images.

As discussed in the general package overview the task has two possible modes: one convolving the template image and the alternative convolving the science image. Both modes share the preparation sub-tasks, but the method that performs the convolution is not the same. The parameter that controls this behavior is mode (check AlardLuptonSubtractConfig), and it allows convolveScience, convolveTemplate and finally auto which means that the decision is made at runtime automatically.

Finally, mask planes are set on the difference and matched template outputs based on the masks of the input science and template images.

Python API summary

from lsst.ip.diffim.subtractImages import AlardLuptonSubtractTask
classAlardLuptonSubtractTask(**kwargs)

Compute the image difference of a science and template image using the Alard & Lupton (1998) algorithm...

attributeconfig

Access configuration fields and retargetable subtasks.

methodrun(template, science, sources, visitSummary=None)

PSF match, subtract, and decorrelate two images...

See also

See the AlardLuptonSubtractTask API reference for complete details.

Retargetable subtasks

decorrelate

Default

lsst.ip.diffim.imageDecorrelation.DecorrelateALKernelTask

Field type

ConfigurableField

Task to decorrelate the image difference.

makeKernel

Default

lsst.ip.diffim.makeKernel.MakeKernelTask

Field type

ConfigurableField

Task to construct a matching kernel for convolution.

scaleVariance

Default

lsst.meas.algorithms.scaleVariance.ScaleVarianceTask

Field type

ConfigurableField

Subtask to rescale the variance of the template to the statistically expected level.

Configuration fields

allowKernelSourceDetection

Default
False
Field type

bool Field

Re-run source detection for kernel candidates if an error is encountered while calculating the matching kernel.

badMaskPlanes

Default
('NO_DATA', 'BAD', 'SAT', 'EDGE')
Field type

str ListField

Mask planes to interpolate over.

badSourceFlags

Default
('sky_source', 'slot_Centroid_flag', 'slot_ApFlux_flag', 'slot_PsfFlux_flag', 'base_PixelFlags_flag_interpolated', 'base_PixelFlags_flag_saturated', 'base_PixelFlags_flag_bad')
Field type

str ListField

Flags that, if set, the associated source should not be used to determine the PSF matching kernel.

connections

Data type

lsst.pipe.base.config.AlardLuptonSubtractConfigConnections

Field type

ConfigField

Configurations describing the connections of the PipelineTask to datatypes

detectionThreshold

Default
10
Field type

float Field

Minimum signal to noise ratio of detected sources to use for calculating the PSF matching kernel.

detectionThresholdMax

Default
500
Field type

float Field

Maximum signal to noise ratio of detected sources to use for calculating the PSF matching kernel.

doApplyExternalCalibrations

Default
False
Field type

bool Field

Replace science Exposure’s calibration objects with those in visitSummary. Ignored if `doApplyFinalizedPsf is True.

doDecorrelation

Default
True
Field type

bool Field

Perform diffim decorrelation to undo pixel correlation due to A&L kernel convolution? If True, also update the diffim PSF.

doScaleVariance

Default
True
Field type

bool Field

Scale variance of the image difference?

doSubtractBackground

Default
True
Field type

bool Field

Subtract the background fit when solving the kernel?

excludeMaskPlanes

Default
('NO_DATA', 'BAD', 'SAT', 'EDGE', 'FAKE')
Field type

str ListField

Mask planes to exclude when selecting sources for PSF matching.

maxKernelSources

Default
1000
Field type

int Field

Maximum number of sources to use for calculating the PSF matching kernel.Set to -1 to disable.

minKernelSources

Default
3
Field type

int Field

Minimum number of sources needed for calculating the PSF matching kernel.

minTemplateFractionForExpectedSuccess

Default
0.2
Field type

float Field

Raise NoWorkFound if PSF-matching fails and template covers less than this fraction of pixels. If the fraction of pixels covered by the template is less than this value (and greater than requiredTemplateFraction) this task is attempted but failure is anticipated and tolerated.

mode

Default
'convolveTemplate'
Field type

str ChoiceField (optional)

Choices
'auto'

Choose which image to convolve at runtime.

'convolveScience'

Only convolve the science image.

'convolveTemplate'

Only convolve the template image.

None

Field is optional

Choose which image to convolve at runtime, or require that a specific image is convolved.

preserveTemplateMask

Default
('NO_DATA', 'BAD')
Field type

str ListField

Mask planes from the template to propagate to the image difference.

renameTemplateMask

Default
('SAT', 'INJECTED', 'INJECTED_CORE')
Field type

str ListField

Mask planes from the template to propagate to the image differencewith ‘_TEMPLATE’ appended to the name.

requiredTemplateFraction

Default
0.1
Field type

float Field

Raise NoWorkFound and do not attempt image subtraction if template covers less than this fraction of pixels. Setting to 0 will always attempt image subtraction.

saveLogOutput

Default
True
Field type

bool Field

Flag to enable/disable saving of log output for a task, enabled by default.