|
def | createPsf (fwhm) |
|
def | transposeMaskedImage (maskedImage) |
|
def | interpolateDefectList (maskedImage, defectList, fwhm, fallbackValue=None) |
|
def | makeThresholdMask (maskedImage, threshold, growFootprints=1, maskName='SAT') |
|
def | growMasks (mask, radius=0, maskNameList=['BAD'], maskValue="BAD") |
|
def | interpolateFromMask (maskedImage, fwhm, growSaturatedFootprints=1, maskNameList=['SAT'], fallbackValue=None) |
|
def | saturationCorrection (maskedImage, saturation, fwhm, growFootprints=1, interpolate=True, maskName='SAT', fallbackValue=None) |
|
def | trimToMatchCalibBBox (rawMaskedImage, calibMaskedImage) |
|
def | biasCorrection (maskedImage, biasMaskedImage, trimToFit=False) |
|
def | darkCorrection (maskedImage, darkMaskedImage, expScale, darkScale, invert=False, trimToFit=False) |
|
def | updateVariance (maskedImage, gain, readNoise) |
|
def | flatCorrection (maskedImage, flatMaskedImage, scalingType, userScale=1.0, invert=False, trimToFit=False) |
|
def | illuminationCorrection (maskedImage, illumMaskedImage, illumScale, trimToFit=True) |
|
def | brighterFatterCorrection (exposure, kernel, maxIter, threshold, applyGain, gains=None) |
|
def | transferFlux (cFunc, fStep, correctionMode=True) |
|
def | fluxConservingBrighterFatterCorrection (exposure, kernel, maxIter, threshold, applyGain, gains=None, correctionMode=True) |
|
def | gainContext (exp, image, apply, gains=None) |
|
def | attachTransmissionCurve (exposure, opticsTransmission=None, filterTransmission=None, sensorTransmission=None, atmosphereTransmission=None) |
|
def | applyGains (exposure, normalizeGains=False, ptcGains=None) |
|
def | widenSaturationTrails (mask) |
|
def | setBadRegions (exposure, badStatistic="MEDIAN") |
|
def | checkFilter (exposure, filterList, log) |
|
def | getPhysicalFilter (filterLabel, log) |
|
def | countMaskedPixels (maskedIm, maskPlane) |
|
def lsst.ip.isr.isrFunctions.attachTransmissionCurve |
( |
|
exposure, |
|
|
|
opticsTransmission = None , |
|
|
|
filterTransmission = None , |
|
|
|
sensorTransmission = None , |
|
|
|
atmosphereTransmission = None |
|
) |
| |
Attach a TransmissionCurve to an Exposure, given separate curves for
different components.
Parameters
----------
exposure : `lsst.afw.image.Exposure`
Exposure object to modify by attaching the product of all given
``TransmissionCurves`` in post-assembly trimmed detector coordinates.
Must have a valid ``Detector`` attached that matches the detector
associated with sensorTransmission.
opticsTransmission : `lsst.afw.image.TransmissionCurve`
A ``TransmissionCurve`` that represents the throughput of the optics,
to be evaluated in focal-plane coordinates.
filterTransmission : `lsst.afw.image.TransmissionCurve`
A ``TransmissionCurve`` that represents the throughput of the filter
itself, to be evaluated in focal-plane coordinates.
sensorTransmission : `lsst.afw.image.TransmissionCurve`
A ``TransmissionCurve`` that represents the throughput of the sensor
itself, to be evaluated in post-assembly trimmed detector coordinates.
atmosphereTransmission : `lsst.afw.image.TransmissionCurve`
A ``TransmissionCurve`` that represents the throughput of the
atmosphere, assumed to be spatially constant.
Returns
-------
combined : `lsst.afw.image.TransmissionCurve`
The TransmissionCurve attached to the exposure.
Notes
-----
All ``TransmissionCurve`` arguments are optional; if none are provided, the
attached ``TransmissionCurve`` will have unit transmission everywhere.
Definition at line 883 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.brighterFatterCorrection |
( |
|
exposure, |
|
|
|
kernel, |
|
|
|
maxIter, |
|
|
|
threshold, |
|
|
|
applyGain, |
|
|
|
gains = None |
|
) |
| |
Apply brighter fatter correction in place for the image.
Parameters
----------
exposure : `lsst.afw.image.Exposure`
Exposure to have brighter-fatter correction applied. Modified
by this method.
kernel : `numpy.ndarray`
Brighter-fatter kernel to apply.
maxIter : scalar
Number of correction iterations to run.
threshold : scalar
Convergence threshold in terms of the sum of absolute
deviations between an iteration and the previous one.
applyGain : `Bool`
If True, then the exposure values are scaled by the gain prior
to correction.
gains : `dict` [`str`, `float`]
A dictionary, keyed by amplifier name, of the gains to use.
If gains is None, the nominal gains in the amplifier object are used.
Returns
-------
diff : `float`
Final difference between iterations achieved in correction.
iteration : `int`
Number of iterations used to calculate correction.
Notes
-----
This correction takes a kernel that has been derived from flat
field images to redistribute the charge. The gradient of the
kernel is the deflection field due to the accumulated charge.
Given the original image I(x) and the kernel K(x) we can compute
the corrected image Ic(x) using the following equation:
Ic(x) = I(x) + 0.5*d/dx(I(x)*d/dx(int( dy*K(x-y)*I(y))))
To evaluate the derivative term we expand it as follows:
0.5 * ( d/dx(I(x))*d/dx(int(dy*K(x-y)*I(y)))
+ I(x)*d^2/dx^2(int(dy* K(x-y)*I(y))) )
Because we use the measured counts instead of the incident counts
we apply the correction iteratively to reconstruct the original
counts and the correction. We stop iterating when the summed
difference between the current corrected image and the one from
the previous iteration is below the threshold. We do not require
convergence because the number of iterations is too large a
computational cost. How we define the threshold still needs to be
evaluated, the current default was shown to work reasonably well
on a small set of images. For more information on the method see
DocuShare Document-19407.
The edges as defined by the kernel are not corrected because they
have spurious values due to the convolution.
Definition at line 472 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.darkCorrection |
( |
|
maskedImage, |
|
|
|
darkMaskedImage, |
|
|
|
expScale, |
|
|
|
darkScale, |
|
|
|
invert = False , |
|
|
|
trimToFit = False |
|
) |
| |
Apply dark correction in place.
Parameters
----------
maskedImage : `lsst.afw.image.MaskedImage`
Image to process. The image is modified by this method.
darkMaskedImage : `lsst.afw.image.MaskedImage`
Dark image of the same size as ``maskedImage``.
expScale : scalar
Dark exposure time for ``maskedImage``.
darkScale : scalar
Dark exposure time for ``darkMaskedImage``.
invert : `Bool`, optional
If True, re-add the dark to an already corrected image.
trimToFit : `Bool`, optional
If True, raw data is symmetrically trimmed to match
calibration size.
Raises
------
RuntimeError
Raised if ``maskedImage`` and ``darkMaskedImage`` do not have
the same size.
Notes
-----
The dark correction is applied by calculating:
maskedImage -= dark * expScaling / darkScaling
Definition at line 328 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.flatCorrection |
( |
|
maskedImage, |
|
|
|
flatMaskedImage, |
|
|
|
scalingType, |
|
|
|
userScale = 1.0 , |
|
|
|
invert = False , |
|
|
|
trimToFit = False |
|
) |
| |
Apply flat correction in place.
Parameters
----------
maskedImage : `lsst.afw.image.MaskedImage`
Image to process. The image is modified.
flatMaskedImage : `lsst.afw.image.MaskedImage`
Flat image of the same size as ``maskedImage``
scalingType : str
Flat scale computation method. Allowed values are 'MEAN',
'MEDIAN', or 'USER'.
userScale : scalar, optional
Scale to use if ``scalingType='USER'``.
invert : `Bool`, optional
If True, unflatten an already flattened image.
trimToFit : `Bool`, optional
If True, raw data is symmetrically trimmed to match
calibration size.
Raises
------
RuntimeError
Raised if ``maskedImage`` and ``flatMaskedImage`` do not have
the same size or if ``scalingType`` is not an allowed value.
Definition at line 390 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.fluxConservingBrighterFatterCorrection |
( |
|
exposure, |
|
|
|
kernel, |
|
|
|
maxIter, |
|
|
|
threshold, |
|
|
|
applyGain, |
|
|
|
gains = None , |
|
|
|
correctionMode = True |
|
) |
| |
Apply brighter fatter correction in place for the image.
This version presents a modified version of the algorithm
found in ``lsst.ip.isr.isrFunctions.brighterFatterCorrection``
which conserves the image flux, resulting in improved
correction of the cores of stars. The convolution has also been
modified to mitigate edge effects.
Parameters
----------
exposure : `lsst.afw.image.Exposure`
Exposure to have brighter-fatter correction applied. Modified
by this method.
kernel : `numpy.ndarray`
Brighter-fatter kernel to apply.
maxIter : scalar
Number of correction iterations to run.
threshold : scalar
Convergence threshold in terms of the sum of absolute
deviations between an iteration and the previous one.
applyGain : `Bool`
If True, then the exposure values are scaled by the gain prior
to correction.
gains : `dict` [`str`, `float`]
A dictionary, keyed by amplifier name, of the gains to use.
If gains is None, the nominal gains in the amplifier object are used.
correctionMode : `Bool`
If True (default) the function applies correction for BFE. If False,
the code can instead be used to generate a simulation of BFE (sign
change in the direction of the effect)
Returns
-------
diff : `float`
Final difference between iterations achieved in correction.
iteration : `int`
Number of iterations used to calculate correction.
Notes
-----
Modified version of ``lsst.ip.isr.isrFunctions.brighterFatterCorrection``.
This correction takes a kernel that has been derived from flat
field images to redistribute the charge. The gradient of the
kernel is the deflection field due to the accumulated charge.
Given the original image I(x) and the kernel K(x) we can compute
the corrected image Ic(x) using the following equation:
Ic(x) = I(x) + 0.5*d/dx(I(x)*d/dx(int( dy*K(x-y)*I(y))))
Improved algorithm at this step applies the divergence theorem to
obtain a pixelised correction.
Because we use the measured counts instead of the incident counts
we apply the correction iteratively to reconstruct the original
counts and the correction. We stop iterating when the summed
difference between the current corrected image and the one from
the previous iteration is below the threshold. We do not require
convergence because the number of iterations is too large a
computational cost. How we define the threshold still needs to be
evaluated, the current default was shown to work reasonably well
on a small set of images.
Edges are handled in the convolution by padding. This is still not
a physical model for the edge, but avoids discontinuity in the correction.
Author of modified version: Lance.Miller@physics.ox.ac.uk
(see DM-38555).
Definition at line 681 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.gainContext |
( |
|
exp, |
|
|
|
image, |
|
|
|
apply, |
|
|
|
gains = None |
|
) |
| |
Context manager that applies and removes gain.
Parameters
----------
exp : `lsst.afw.image.Exposure`
Exposure to apply/remove gain.
image : `lsst.afw.image.Image`
Image to apply/remove gain.
apply : `Bool`
If True, apply and remove the amplifier gain.
gains : `dict` [`str`, `float`]
A dictionary, keyed by amplifier name, of the gains to use.
If gains is None, the nominal gains in the amplifier object are used.
Yields
------
exp : `lsst.afw.image.Exposure`
Exposure with the gain applied.
Definition at line 831 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.saturationCorrection |
( |
|
maskedImage, |
|
|
|
saturation, |
|
|
|
fwhm, |
|
|
|
growFootprints = 1 , |
|
|
|
interpolate = True , |
|
|
|
maskName = 'SAT' , |
|
|
|
fallbackValue = None |
|
) |
| |
Mark saturated pixels and optionally interpolate over them
Parameters
----------
maskedImage : `lsst.afw.image.MaskedImage`
Image to process.
saturation : scalar
Saturation level used as the detection threshold.
fwhm : scalar
FWHM of double Gaussian smoothing kernel.
growFootprints : scalar, optional
Number of pixels to grow footprints of detected regions.
interpolate : Bool, optional
If True, saturated pixels are interpolated over.
maskName : str, optional
Mask plane name.
fallbackValue : scalar, optional
Value of last resort for interpolation.
Definition at line 218 of file isrFunctions.py.