|
def | __init__ (self, modelImages, filterInfo=None, psf=None, mask=None, variance=None, photoCalib=None) |
|
def | fromImage (cls, maskedImage, dcrNumSubfilters, filterInfo=None, psf=None, photoCalib=None) |
|
def | fromDataRef (cls, dataRef, datasetType="dcrCoadd", numSubfilters=None, **kwargs) |
|
def | fromQuantum (cls, availableCoaddRefs) |
|
def | __len__ (self) |
|
def | __getitem__ (self, subfilter) |
|
def | __setitem__ (self, subfilter, maskedImage) |
|
def | filter (self) |
|
def | psf (self) |
|
def | bbox (self) |
|
def | mask (self) |
|
def | variance (self) |
|
def | getReferenceImage (self, bbox=None) |
|
def | assign (self, dcrSubModel, bbox=None) |
|
def | buildMatchedTemplate (self, exposure=None, order=3, visitInfo=None, bbox=None, wcs=None, mask=None, splitSubfilters=True, splitThreshold=0., amplifyModel=1.) |
|
def | buildMatchedExposure (self, exposure=None, visitInfo=None, bbox=None, wcs=None, mask=None) |
|
def | conditionDcrModel (self, modelImages, bbox, gain=1.) |
|
def | regularizeModelIter (self, subfilter, newModel, bbox, regularizationFactor, regularizationWidth=2) |
|
def | regularizeModelFreq (self, modelImages, bbox, statsCtrl, regularizationFactor, regularizationWidth=2, mask=None, convergenceMaskPlanes="DETECTED") |
|
def | calculateNoiseCutoff (self, image, statsCtrl, bufferSize, convergenceMaskPlanes="DETECTED", mask=None, bbox=None) |
|
def | applyImageThresholds (self, image, highThreshold=None, lowThreshold=None, regularizationWidth=2) |
|
A model of the true sky after correcting chromatic effects.
Attributes
----------
dcrNumSubfilters : `int`
Number of sub-filters used to model chromatic effects within a band.
modelImages : `list` of `lsst.afw.image.Image`
A list of masked images, each containing the model for one subfilter
Notes
-----
The ``DcrModel`` contains an estimate of the true sky, at a higher
wavelength resolution than the input observations. It can be forward-
modeled to produce Differential Chromatic Refraction (DCR) matched
templates for a given ``Exposure``, and provides utilities for conditioning
the model in ``dcrAssembleCoadd`` to avoid oscillating solutions between
iterations of forward modeling or between the subfilters of the model.
Definition at line 32 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.applyImageThresholds |
( |
|
self, |
|
|
|
image, |
|
|
|
highThreshold = None , |
|
|
|
lowThreshold = None , |
|
|
|
regularizationWidth = 2 |
|
) |
| |
Restrict image values to be between upper and lower limits.
This method flags all pixels in an image that are outside of the given
threshold values. The threshold values are taken from a reference image,
so noisy pixels are likely to get flagged. In order to exclude those
noisy pixels, the array of flags is eroded and dilated, which removes
isolated pixels outside of the thresholds from the list of pixels to be
modified. Pixels that remain flagged after this operation have their
values set to the appropriate upper or lower threshold value.
Parameters
----------
image : `numpy.ndarray`
The image to apply the thresholds to.
The values will be modified in place.
highThreshold : `numpy.ndarray`, optional
Array of upper limit values for each pixel of ``image``.
lowThreshold : `numpy.ndarray`, optional
Array of lower limit values for each pixel of ``image``.
regularizationWidth : `int`, optional
Minimum radius of a region to include in regularization, in pixels.
Definition at line 595 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.buildMatchedExposure |
( |
|
self, |
|
|
|
exposure = None , |
|
|
|
visitInfo = None , |
|
|
|
bbox = None , |
|
|
|
wcs = None , |
|
|
|
mask = None |
|
) |
| |
Wrapper to create an exposure from a template image.
Parameters
----------
exposure : `lsst.afw.image.Exposure`, optional
The input exposure to build a matched template for.
May be omitted if all of the metadata is supplied separately
visitInfo : `lsst.afw.image.VisitInfo`, optional
Metadata for the exposure. Ignored if ``exposure`` is set.
bbox : `lsst.afw.geom.Box2I`, optional
Sub-region of the coadd. Ignored if ``exposure`` is set.
wcs : `lsst.afw.geom.SkyWcs`, optional
Coordinate system definition (wcs) for the exposure.
Ignored if ``exposure`` is set.
mask : `lsst.afw.image.Mask`, optional
reference mask to use for the template image.
Returns
-------
templateExposure : `lsst.afw.image.exposureF`
The DCR-matched template
Definition at line 404 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.buildMatchedTemplate |
( |
|
self, |
|
|
|
exposure = None , |
|
|
|
order = 3 , |
|
|
|
visitInfo = None , |
|
|
|
bbox = None , |
|
|
|
wcs = None , |
|
|
|
mask = None , |
|
|
|
splitSubfilters = True , |
|
|
|
splitThreshold = 0. , |
|
|
|
amplifyModel = 1. |
|
) |
| |
Create a DCR-matched template image for an exposure.
Parameters
----------
exposure : `lsst.afw.image.Exposure`, optional
The input exposure to build a matched template for.
May be omitted if all of the metadata is supplied separately
order : `int`, optional
Interpolation order of the DCR shift.
visitInfo : `lsst.afw.image.VisitInfo`, optional
Metadata for the exposure. Ignored if ``exposure`` is set.
bbox : `lsst.afw.geom.Box2I`, optional
Sub-region of the coadd. Ignored if ``exposure`` is set.
wcs : `lsst.afw.geom.SkyWcs`, optional
Coordinate system definition (wcs) for the exposure.
Ignored if ``exposure`` is set.
mask : `lsst.afw.image.Mask`, optional
reference mask to use for the template image.
splitSubfilters : `bool`, optional
Calculate DCR for two evenly-spaced wavelengths in each subfilter,
instead of at the midpoint. Default: True
splitThreshold : `float`, optional
Minimum DCR difference within a subfilter required to use ``splitSubfilters``
amplifyModel : `float`, optional
Multiplication factor to amplify differences between model planes.
Used to speed convergence of iterative forward modeling.
Returns
-------
templateImage : `lsst.afw.image.ImageF`
The DCR-matched template
Raises
------
ValueError
If neither ``exposure`` or all of ``visitInfo``, ``bbox``, and ``wcs`` are set.
Definition at line 344 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.calculateNoiseCutoff |
( |
|
self, |
|
|
|
image, |
|
|
|
statsCtrl, |
|
|
|
bufferSize, |
|
|
|
convergenceMaskPlanes = "DETECTED" , |
|
|
|
mask = None , |
|
|
|
bbox = None |
|
) |
| |
Helper function to calculate the background noise level of an image.
Parameters
----------
image : `lsst.afw.image.Image`
The input image to evaluate the background noise properties.
statsCtrl : `lsst.afw.math.StatisticsControl`
Statistics control object for coaddition.
bufferSize : `int`
Number of additional pixels to exclude
from the edges of the bounding box.
convergenceMaskPlanes : `list` of `str`, or `str`
Mask planes to use to calculate convergence.
mask : `lsst.afw.image.Mask`, Optional
Optional alternate mask
bbox : `lsst.afw.geom.Box2I`, optional
Sub-region of the masked image to calculate the noise level over.
Returns
-------
noiseCutoff : `float`
The threshold value to treat pixels as noise in an image..
Definition at line 558 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.fromDataRef |
( |
|
cls, |
|
|
|
dataRef, |
|
|
|
datasetType = "dcrCoadd" , |
|
|
|
numSubfilters = None , |
|
|
** |
kwargs |
|
) |
| |
Load an existing DcrModel from a Gen 2 repository.
Parameters
----------
dataRef : `lsst.daf.persistence.ButlerDataRef`
Data reference defining the patch for coaddition and the
reference Warp
datasetType : `str`, optional
Name of the DcrModel in the registry {"dcrCoadd", "dcrCoadd_sub"}
numSubfilters : `int`
Number of sub-filters used to model chromatic effects within a band.
**kwargs
Additional keyword arguments to pass to look up the model in the data registry.
Common keywords and their types include: ``tract``:`str`, ``patch``:`str`,
``bbox``:`lsst.afw.geom.Box2I`
Returns
-------
dcrModel : `lsst.pipe.tasks.DcrModel`
Best fit model of the true sky after correcting chromatic effects.
Definition at line 109 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.fromImage |
( |
|
cls, |
|
|
|
maskedImage, |
|
|
|
dcrNumSubfilters, |
|
|
|
filterInfo = None , |
|
|
|
psf = None , |
|
|
|
photoCalib = None |
|
) |
| |
Initialize a DcrModel by dividing a coadd between the subfilters.
Parameters
----------
maskedImage : `lsst.afw.image.MaskedImage`
Input coadded image to divide equally between the subfilters.
dcrNumSubfilters : `int`
Number of sub-filters used to model chromatic effects within a band.
filterInfo : `lsst.afw.image.Filter`, optional
The filter definition, set in the current instruments' obs package.
Required for any calculation of DCR, including making matched templates.
psf : `lsst.afw.detection.Psf`, optional
Point spread function (PSF) of the model.
Required if the ``DcrModel`` will be persisted.
photoCalib : `lsst.afw.image.PhotoCalib`, optional
Calibration to convert instrumental flux and
flux error to nanoJansky.
Returns
-------
dcrModel : `lsst.pipe.tasks.DcrModel`
Best fit model of the true sky after correcting chromatic effects.
Raises
------
ValueError
If there are any unmasked NAN values in ``maskedImage``.
Definition at line 62 of file dcrModel.py.
def lsst.ip.diffim.dcrModel.DcrModel.regularizeModelFreq |
( |
|
self, |
|
|
|
modelImages, |
|
|
|
bbox, |
|
|
|
statsCtrl, |
|
|
|
regularizationFactor, |
|
|
|
regularizationWidth = 2 , |
|
|
|
mask = None , |
|
|
|
convergenceMaskPlanes = "DETECTED" |
|
) |
| |
Restrict large variations in the model between subfilters.
Parameters
----------
modelImages : `list` of `lsst.afw.image.Image`
The new DCR model images from the current iteration.
The values will be modified in place.
bbox : `lsst.afw.geom.Box2I`
Sub-region to coadd
statsCtrl : `lsst.afw.math.StatisticsControl`
Statistics control object for coaddition.
regularizationFactor : `float`
Maximum relative change of the model allowed between subfilters.
regularizationWidth : `int`, optional
Minimum radius of a region to include in regularization, in pixels.
mask : `lsst.afw.image.Mask`, optional
Optional alternate mask
convergenceMaskPlanes : `list` of `str`, or `str`, optional
Mask planes to use to calculate convergence.
Notes
-----
This implementation of frequency regularization restricts each subfilter
image to be a smoothly-varying function times a reference image.
Definition at line 496 of file dcrModel.py.