|
def | __init__ (self, *args, **kwargs) |
|
def | run (self, subExposure, expandedSubExposure, fullBBox, template, **kwargs) |
|
def | setup (self, templateExposure=None, scienceExposure=None, sig1=None, sig2=None, psf1=None, psf2=None, correctBackground=False, *args, **kwargs) |
|
def | computePrereqs (self, psf1=None, psf2=None, padSize=0) |
|
def | computeDiffimFourierSpace (self, debug=False, returnMatchedTemplate=False, **kwargs) |
|
def | computeDiffimImageSpace (self, padSize=None, debug=False, **kwargs) |
|
def | computeDiffim (self, inImageSpace=None, padSize=None, returnMatchedTemplate=False, **kwargs) |
|
def | computeDiffimPsf (self, padSize=0, keepFourier=False, psf1=None, psf2=None) |
|
def | computeScorrFourierSpace (self, xVarAst=0., yVarAst=0., **kwargs) |
|
def | computeScorrImageSpace (self, xVarAst=0., yVarAst=0., padSize=None, **kwargs) |
|
def | computeScorr (self, xVarAst=0., yVarAst=0., inImageSpace=None, padSize=0, **kwargs) |
|
def | run (self, subExposure, expandedSubExposure, fullBBox, **kwargs) |
|
Task to be used as an ImageMapper for performing
ZOGY image subtraction on a grid of subimages.
Definition at line 927 of file zogy.py.
◆ __init__()
def lsst.ip.diffim.zogy.ZogyMapper.__init__ |
( |
|
self, |
|
|
* |
args, |
|
|
** |
kwargs |
|
) |
| |
◆ computeDiffim()
def lsst.ip.diffim.zogy.ZogyTask.computeDiffim |
( |
|
self, |
|
|
|
inImageSpace = None , |
|
|
|
padSize = None , |
|
|
|
returnMatchedTemplate = False , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Wrapper method to compute ZOGY proper diffim
This method should be used as the public interface for
computing the ZOGY diffim.
Parameters
----------
inImageSpace : `bool`
Override config `inImageSpace` parameter
padSize : `int`
Override config `padSize` parameter
returnMatchedTemplate : `bool`
Include the PSF-matched template in the results Struct
**kwargs
additional keyword arguments to be passed to
`computeDiffimFourierSpace` or `computeDiffimImageSpace`.
Returns
-------
An lsst.pipe.base.Struct containing:
- D : `lsst.afw.Exposure`
the proper image difference, including correct variance,
masks, and PSF
- R : `lsst.afw.Exposure`
If `returnMatchedTemplate` is True, the PSF-matched template
exposure
Definition at line 610 of file zogy.py.
◆ computeDiffimFourierSpace()
def lsst.ip.diffim.zogy.ZogyTask.computeDiffimFourierSpace |
( |
|
self, |
|
|
|
debug = False , |
|
|
|
returnMatchedTemplate = False , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Compute ZOGY diffim `D` as proscribed in ZOGY (2016) manuscript
Parameters
----------
debug : `bool`, optional
If set to True, filter the kernels by setting the edges to zero.
returnMatchedTemplate : `bool`, optional
Calculate the template image.
If not set, the returned template will be None.
Notes
-----
In all functions, im1 is R (reference, or template) and im2 is N (new, or science)
Compute the ZOGY eqn. (13):
.. math::
\widehat{D} = \frac{Fr\widehat{Pr}\widehat{N} -
F_n\widehat{Pn}\widehat{R}}{\sqrt{\sigma_n^2 Fr^2
\|\widehat{Pr}\|^2 + \sigma_r^2 F_n^2 \|\widehat{Pn}\|^2}}
where :math:`D` is the optimal difference image, :math:`R` and :math:`N` are the
reference and "new" image, respectively, :math:`Pr` and :math:`P_n` are their
PSFs, :math:`Fr` and :math:`Fn` are their flux-based zero-points (which we
will set to one here), :math:`\sigma_r^2` and :math:`\sigma_n^2` are their
variance, and :math:`\widehat{D}` denotes the FT of :math:`D`.
Returns
-------
result : `lsst.pipe.base.Struct`
Result struct with components:
- ``D`` : 2D `numpy.array`, the proper image difference
- ``D_var`` : 2D `numpy.array`, the variance image for `D`
Definition at line 406 of file zogy.py.
◆ computeDiffimImageSpace()
def lsst.ip.diffim.zogy.ZogyTask.computeDiffimImageSpace |
( |
|
self, |
|
|
|
padSize = None , |
|
|
|
debug = False , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Compute ZOGY diffim `D` using image-space convlutions
This method is still being debugged as it results in artifacts
when the PSFs are noisy (see module-level docstring). Thus
there are several options still enabled by the `debug` flag,
which are disabled by defult.
Parameters
----------
padSize : `int`
The amount to pad the PSFs by
debug : `bool`
Flag to enable debugging tests and options
Returns
-------
D : `lsst.afw.Exposure`
the proper image difference, including correct variance,
masks, and PSF
Definition at line 540 of file zogy.py.
◆ computeDiffimPsf()
def lsst.ip.diffim.zogy.ZogyTask.computeDiffimPsf |
( |
|
self, |
|
|
|
padSize = 0 , |
|
|
|
keepFourier = False , |
|
|
|
psf1 = None , |
|
|
|
psf2 = None |
|
) |
| |
|
inherited |
Compute the ZOGY diffim PSF (ZOGY manuscript eq. 14)
Parameters
----------
padSize : `int`
Override config `padSize` parameter
keepFourier : `bool`
Return the FFT of the diffim PSF (do not inverse-FFT it)
psf1 : 2D `numpy.array`
(Optional) Input psf of template, override if already padded
psf2 : 2D `numpy.array`
(Optional) Input psf of science image, override if already padded
Returns
-------
Pd : 2D `numpy.array`
The diffim PSF (or FFT of PSF if `keepFourier=True`)
Definition at line 661 of file zogy.py.
◆ computePrereqs()
def lsst.ip.diffim.zogy.ZogyTask.computePrereqs |
( |
|
self, |
|
|
|
psf1 = None , |
|
|
|
psf2 = None , |
|
|
|
padSize = 0 |
|
) |
| |
|
inherited |
Compute standard ZOGY quantities used by (nearly) all methods.
Many of the ZOGY calculations require similar quantities, including
FFTs of the PSFs, and the "denominator" term (e.g. in eq. 13 of
ZOGY manuscript (2016). This function consolidates many of those
operations.
Parameters
----------
psf1 : 2D `numpy.array`
(Optional) Input psf of template, override if already padded
psf2 : 2D `numpy.array`
(Optional) Input psf of science image, override if already padded
padSize : `int`, optional
Number of pixels to pad the image on each side with zeroes.
Returns
-------
A `lsst.pipe.base.Struct` containing:
- Pr : 2D `numpy.array`, the (possibly zero-padded) template PSF
- Pn : 2D `numpy.array`, the (possibly zero-padded) science PSF
- Pr_hat : 2D `numpy.array`, the FFT of `Pr`
- Pn_hat : 2D `numpy.array`, the FFT of `Pn`
- denom : 2D `numpy.array`, the denominator of equation (13) in ZOGY (2016) manuscript
- Fd : `float`, the relative flux scaling factor between science and template
Definition at line 355 of file zogy.py.
◆ computeScorr()
def lsst.ip.diffim.zogy.ZogyTask.computeScorr |
( |
|
self, |
|
|
|
xVarAst = 0. , |
|
|
|
yVarAst = 0. , |
|
|
|
inImageSpace = None , |
|
|
|
padSize = 0 , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Wrapper method to compute ZOGY corrected likelihood image, optimal for
source detection
This method should be used as the public interface for
computing the ZOGY S_corr.
Parameters
----------
xVarAst, yVarAst : `float`
estimated astrometric noise (variance of astrometric registration errors)
inImageSpace : `bool`
Override config `inImageSpace` parameter
padSize : `int`
Override config `padSize` parameter
Returns
-------
S : `lsst.afw.image.Exposure`
The likelihood exposure S (eq. 12 of ZOGY (2016)),
including corrected variance, masks, and PSF
Definition at line 890 of file zogy.py.
◆ computeScorrFourierSpace()
def lsst.ip.diffim.zogy.ZogyTask.computeScorrFourierSpace |
( |
|
self, |
|
|
|
xVarAst = 0. , |
|
|
|
yVarAst = 0. , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Compute corrected likelihood image, optimal for source detection
Compute ZOGY S_corr image. This image can be thresholded for
detection without optimal filtering, and the variance image is
corrected to account for astrometric noise (errors in
astrometric registration whether systematic or due to effects
such as DCR). The calculations here are all performed in
Fourier space, as proscribed in ZOGY (2016).
Parameters
----------
xVarAst, yVarAst : `float`
estimated astrometric noise (variance of astrometric registration errors)
Returns
-------
result : `lsst.pipe.base.Struct`
Result struct with components:
- ``S`` : `numpy.array`, the likelihood image S (eq. 12 of ZOGY (2016))
- ``S_var`` : the corrected variance image (denominator of eq. 25 of ZOGY (2016))
- ``Dpsf`` : the PSF of the diffim D, likely never to be used.
Definition at line 748 of file zogy.py.
◆ computeScorrImageSpace()
def lsst.ip.diffim.zogy.ZogyTask.computeScorrImageSpace |
( |
|
self, |
|
|
|
xVarAst = 0. , |
|
|
|
yVarAst = 0. , |
|
|
|
padSize = None , |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Compute corrected likelihood image, optimal for source detection
Compute ZOGY S_corr image. This image can be thresholded for
detection without optimal filtering, and the variance image is
corrected to account for astrometric noise (errors in
astrometric registration whether systematic or due to effects
such as DCR). The calculations here are all performed in
Real (image) space.
Parameters
----------
xVarAst, yVarAst : `float`
estimated astrometric noise (variance of astrometric registration errors)
Returns
-------
A `lsst.pipe.base.Struct` containing:
- S : `lsst.afw.image.Exposure`, the likelihood exposure S (eq. 12 of ZOGY (2016)),
including corrected variance, masks, and PSF
- D : `lsst.afw.image.Exposure`, the proper image difference, including correct
variance, masks, and PSF
Definition at line 828 of file zogy.py.
◆ run() [1/2]
def lsst.ip.diffim.imageMapReduce.ImageMapper.run |
( |
|
self, |
|
|
|
subExposure, |
|
|
|
expandedSubExposure, |
|
|
|
fullBBox, |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Perform operation on `subExposure`.
To be implemented by subclasses. See class docstring for more
details. This method is given the `subExposure` which
is to be operated upon, and an `expandedSubExposure` which
will contain `subExposure` with additional surrounding
pixels. This allows for, for example, convolutions (which
should be performed on `expandedSubExposure`), to prevent the
returned sub-exposure from containing invalid pixels.
This method may return a new, processed sub-exposure which can
be be "stitched" back into a new resulting larger exposure
(depending on the paired, configured `ImageReducer`);
otherwise if it does not return an lsst.afw.image.Exposure, then the
`ImageReducer.config.mapper.reduceOperation`
should be set to 'none' and the result will be propagated
as-is.
Parameters
----------
subExposure : `lsst.afw.image.Exposure`
the sub-exposure upon which to operate
expandedSubExposure : `lsst.afw.image.Exposure`
the expanded sub-exposure upon which to operate
fullBBox : `lsst.geom.Box2I`
the bounding box of the original exposure
kwargs :
additional keyword arguments propagated from
`ImageMapReduceTask.run`.
Returns
-------
result : `lsst.pipe.base.Struct`
A structure containing the result of the `subExposure` processing,
which may itself be of any type. See above for details. If it is an
`lsst.afw.image.Exposure` (processed sub-exposure), then the name in
the Struct should be 'subExposure'. This is implemented here as a
pass-through example only.
Definition at line 109 of file imageMapReduce.py.
◆ run() [2/2]
def lsst.ip.diffim.zogy.ZogyMapper.run |
( |
|
self, |
|
|
|
subExposure, |
|
|
|
expandedSubExposure, |
|
|
|
fullBBox, |
|
|
|
template, |
|
|
** |
kwargs |
|
) |
| |
Perform ZOGY proper image subtraction on sub-images
This method performs ZOGY proper image subtraction on
`subExposure` using local measures for image variances and
PSF. `subExposure` is a sub-exposure of the science image. It
also requires the corresponding sub-exposures of the template
(`template`). The operations are actually performed on
`expandedSubExposure` to allow for invalid edge pixels arising
from convolutions, which are then removed.
Parameters
----------
subExposure : `lsst.afw.image.Exposure`
the sub-exposure of the diffim
expandedSubExposure : `lsst.afw.image.Exposure`
the expanded sub-exposure upon which to operate
fullBBox : `lsst.geom.Box2I`
the bounding box of the original exposure
template : `lsst.afw.image.Exposure`
the template exposure, from which a corresponding sub-exposure
is extracted
**kwargs
additional keyword arguments propagated from
`ImageMapReduceTask.run`. These include:
``doScorr`` : `bool`
Compute and return the corrected likelihood image S_corr
rather than the proper image difference
``inImageSpace`` : `bool`
Perform all convolutions in real (image) space rather than
in Fourier space. This option currently leads to artifacts
when using real (measured and noisy) PSFs, thus it is set
to `False` by default.
These kwargs may also include arguments to be propagated to
`ZogyTask.computeDiffim` and `ZogyTask.computeScorr`.
Returns
-------
result : `lsst.pipe.base.Struct`
Result struct with components:
``subExposure``: Either the subExposure of the proper image difference ``D``,
or (if `doScorr==True`) the corrected likelihood exposure ``S``.
Notes
-----
This `run` method accepts parameters identical to those of
`ImageMapper.run`, since it is called from the
`ImageMapperTask`. See that class for more information.
Definition at line 937 of file zogy.py.
◆ setup()
def lsst.ip.diffim.zogy.ZogyTask.setup |
( |
|
self, |
|
|
|
templateExposure = None , |
|
|
|
scienceExposure = None , |
|
|
|
sig1 = None , |
|
|
|
sig2 = None , |
|
|
|
psf1 = None , |
|
|
|
psf2 = None , |
|
|
|
correctBackground = False , |
|
|
* |
args, |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
Set up the ZOGY task.
Parameters
----------
templateExposure : `lsst.afw.image.Exposure`
Template exposure ("Reference image" in ZOGY (2016)).
scienceExposure : `lsst.afw.image.Exposure`
Science exposure ("New image" in ZOGY (2016)). Must have already been
registered and photometrically matched to template.
sig1 : `float`
(Optional) sqrt(variance) of `templateExposure`. If `None`, it is
computed from the sqrt(mean) of the `templateExposure` variance image.
sig2 : `float`
(Optional) sqrt(variance) of `scienceExposure`. If `None`, it is
computed from the sqrt(mean) of the `scienceExposure` variance image.
psf1 : 2D `numpy.array`
(Optional) 2D array containing the PSF image for the template. If
`None`, it is extracted from the PSF taken at the center of `templateExposure`.
psf2 : 2D `numpy.array`
(Optional) 2D array containing the PSF image for the science img. If
`None`, it is extracted from the PSF taken at the center of `scienceExposure`.
correctBackground : `bool`
(Optional) subtract sigma-clipped mean of exposures. Zogy doesn't correct
nonzero backgrounds (unlike AL) so subtract them here.
*args
additional arguments to be passed to
`lsst.pipe.base.Task`
**kwargs
additional keyword arguments to be passed to
`lsst.pipe.base.Task`
Definition at line 176 of file zogy.py.
◆ ConfigClass
lsst.ip.diffim.zogy.ZogyMapper.ConfigClass = ZogyConfig |
|
static |
◆ Fn
lsst.ip.diffim.zogy.ZogyTask.Fn |
|
inherited |
◆ Fr
lsst.ip.diffim.zogy.ZogyTask.Fr |
|
inherited |
◆ im1
lsst.ip.diffim.zogy.ZogyTask.im1 |
|
inherited |
◆ im1_psf
lsst.ip.diffim.zogy.ZogyTask.im1_psf |
|
inherited |
◆ im1_var
lsst.ip.diffim.zogy.ZogyTask.im1_var |
|
inherited |
◆ im2
lsst.ip.diffim.zogy.ZogyTask.im2 |
|
inherited |
◆ im2_psf
lsst.ip.diffim.zogy.ZogyTask.im2_psf |
|
inherited |
◆ im2_var
lsst.ip.diffim.zogy.ZogyTask.im2_var |
|
inherited |
◆ padSize
lsst.ip.diffim.zogy.ZogyTask.padSize |
|
inherited |
◆ science
lsst.ip.diffim.zogy.ZogyTask.science |
|
inherited |
◆ sig1
lsst.ip.diffim.zogy.ZogyTask.sig1 |
|
inherited |
◆ sig2
lsst.ip.diffim.zogy.ZogyTask.sig2 |
|
inherited |
◆ statsControl
lsst.ip.diffim.zogy.ZogyTask.statsControl |
|
inherited |
◆ template
lsst.ip.diffim.zogy.ZogyTask.template |
|
inherited |
The documentation for this class was generated from the following file: