LSSTApplications
17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
|
Functions | |
def | createPsf (fwhm) |
def | transposeMaskedImage (maskedImage) |
def | interpolateDefectList (maskedImage, defectList, fwhm, fallbackValue=None) |
def | defectListFromFootprintList (fpList) |
def | transposeDefectList (defectList) |
def | maskPixelsFromDefectList (maskedImage, defectList, maskName='BAD') |
def | getDefectListFromMask (maskedImage, maskName) |
def | makeThresholdMask (maskedImage, threshold, growFootprints=1, maskName='SAT') |
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) |
def | overscanCorrection (ampMaskedImage, overscanImage, fitType='MEDIAN', order=1, collapseRej=3.0, statControl=None, overscanIsInt=True) |
def | brighterFatterCorrection (exposure, kernel, maxIter, threshold, applyGain) |
def | gainContext (exp, image, apply) |
def | attachTransmissionCurve (exposure, opticsTransmission=None, filterTransmission=None, sensorTransmission=None, atmosphereTransmission=None) |
def | addDistortionModel (exposure, camera) |
Update the WCS in exposure with a distortion model based on camera geometry. More... | |
def | applyGains (exposure, normalizeGains=False) |
def | widenSaturationTrails (mask) |
def | setBadRegions (exposure, badStatistic="MEDIAN") |
def lsst.ip.isr.isrFunctions.addDistortionModel | ( | exposure, | |
camera | |||
) |
Update the WCS in exposure with a distortion model based on camera geometry.
exposure : lsst.afw.image.Exposure
Exposure to process. Must contain a Detector and WCS. The exposure is modified. camera : lsst.afw.cameraGeom.Camera
Camera geometry.
RuntimeError Raised if exposure
is lacking a Detector or WCS, or if camera
is None.
Add a model for optical distortion based on geometry found in camera
and the exposure
's detector. The raw input exposure is assumed have a TAN WCS that has no compensation for optical distortion. Two other possibilities are:
Definition at line 919 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.applyGains | ( | exposure, | |
normalizeGains = False |
|||
) |
Scale an exposure by the amplifier gains. Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure to process. The image is modified. normalizeGains : `Bool`, optional If True, then amplifiers are scaled to force the median of each amplifier to equal the median of those medians.
Definition at line 966 of file isrFunctions.py.
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 868 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.biasCorrection | ( | maskedImage, | |
biasMaskedImage, | |||
trimToFit = False |
|||
) |
Apply bias correction in place. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. The image is modified by this method. biasMaskedImage : `lsst.afw.image.MaskedImage` Bias image of the same size as ``maskedImage`` trimToFit : `Bool`, optional If True, raw data is symmetrically trimmed to match calibration size. Raises ------ RuntimeError Raised if ``maskedImage`` and ``biasMaskedImage`` do not have the same size.
Definition at line 327 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.brighterFatterCorrection | ( | exposure, | |
kernel, | |||
maxIter, | |||
threshold, | |||
applyGain | |||
) |
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. 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 718 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.createPsf | ( | fwhm | ) |
Make a double Gaussian PSF. Parameters ---------- fwhm : scalar FWHM of double Gaussian smoothing kernel. Returns ------- psf : `lsst.meas.algorithms.DoubleGaussianPsf` The created smoothing kernel.
Definition at line 41 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 356 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.defectListFromFootprintList | ( | fpList | ) |
Compute a defect list from a footprint list, optionally growing the footprints. Parameters ---------- fpList : `list` of `lsst.afw.detection.Footprint` Footprint list to process. Returns ------- defectList : `lsst.meas.algorithms.Defects` List of defects.
Definition at line 104 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 418 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.gainContext | ( | exp, | |
image, | |||
apply | |||
) |
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. Yields ------ exp : `lsst.afw.image.Exposure` Exposure with the gain applied.
Definition at line 834 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.getDefectListFromMask | ( | maskedImage, | |
maskName | |||
) |
Compute a defect list from a specified mask plane. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. maskName : `str` or `list` Mask plane name, or list of names to convert. Returns ------- defectList : `lsst.meas.algorithms.Defects` Defect list constructed from masked pixels.
Definition at line 158 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.illuminationCorrection | ( | maskedImage, | |
illumMaskedImage, | |||
illumScale | |||
) |
Apply illumination correction in place. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. The image is modified. illumMaskedImage : `lsst.afw.image.MaskedImage` Illumination correction image of the same size as ``maskedImage``. illumScale : scalar Scale factor for the illumination correction. Raises ------ RuntimeError Raised if ``maskedImage`` and ``illumMaskedImage`` do not have the same size.
Definition at line 468 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.interpolateDefectList | ( | maskedImage, | |
defectList, | |||
fwhm, | |||
fallbackValue = None |
|||
) |
Interpolate over defects specified in a defect list. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. defectList : `lsst.meas.algorithms.Defects` List of defects to interpolate over. fwhm : scalar FWHM of double Gaussian smoothing kernel. fallbackValue : scalar, optional Fallback value if an interpolated value cannot be determined. If None, then the clipped mean of the image is used.
Definition at line 78 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.interpolateFromMask | ( | maskedImage, | |
fwhm, | |||
growSaturatedFootprints = 1 , |
|||
maskNameList = ['SAT'] , |
|||
fallbackValue = None |
|||
) |
Interpolate over defects identified by a particular set of mask planes. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. fwhm : scalar FWHM of double Gaussian smoothing kernel. growSaturatedFootprints : scalar, optional Number of pixels to grow footprints for saturated pixels. maskNameList : `List` of `str`, optional Mask plane name. fallbackValue : scalar, optional Value of last resort for interpolation.
Definition at line 212 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.makeThresholdMask | ( | maskedImage, | |
threshold, | |||
growFootprints = 1 , |
|||
maskName = 'SAT' |
|||
) |
Mask pixels based on threshold detection. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. Only the mask plane is updated. threshold : scalar Detection threshold. growFootprints : scalar, optional Number of pixels to grow footprints of detected regions. maskName : str, optional Mask plane name, or list of names to convert Returns ------- defectList : `lsst.meas.algorithms.Defects` Defect list constructed from pixels above the threshold.
Definition at line 176 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.maskPixelsFromDefectList | ( | maskedImage, | |
defectList, | |||
maskName = 'BAD' |
|||
) |
Set mask plane based on a defect list. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. Only the mask plane is updated. defectList : `lsst.meas.algorithms.Defects` Defect list to mask. maskName : str, optional Mask plane name to use.
Definition at line 141 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.overscanCorrection | ( | ampMaskedImage, | |
overscanImage, | |||
fitType = 'MEDIAN' , |
|||
order = 1 , |
|||
collapseRej = 3.0 , |
|||
statControl = None , |
|||
overscanIsInt = True |
|||
) |
Apply overscan correction in place. Parameters ---------- ampMaskedImage : `lsst.afw.image.MaskedImage` Image of amplifier to correct; modified. overscanImage : `lsst.afw.image.Image` or `lsst.afw.image.MaskedImage` Image of overscan; modified. fitType : `str` Type of fit for overscan correction. May be one of: - ``MEAN``: use mean of overscan. - ``MEANCLIP``: use clipped mean of overscan. - ``MEDIAN``: use median of overscan. - ``POLY``: fit with ordinary polynomial. - ``CHEB``: fit with Chebyshev polynomial. - ``LEG``: fit with Legendre polynomial. - ``NATURAL_SPLINE``: fit with natural spline. - ``CUBIC_SPLINE``: fit with cubic spline. - ``AKIMA_SPLINE``: fit with Akima spline. order : `int` Polynomial order or number of spline knots; ignored unless ``fitType`` indicates a polynomial or spline. statControl : `lsst.afw.math.StatisticsControl` Statistics control object. In particular, we pay attention to numSigmaClip overscanIsInt : `bool` Treat the overscan region as consisting of integers, even if it's been converted to float. E.g. handle ties properly. Returns ------- result : `lsst.pipe.base.Struct` Result struct with components: - ``imageFit``: Value(s) removed from image (scalar or `lsst.afw.image.Image`) - ``overscanFit``: Value(s) removed from overscan (scalar or `lsst.afw.image.Image`) - ``overscanImage``: Overscan corrected overscan region (`lsst.afw.image.Image`) Raises ------ pexExcept.Exception Raised if ``fitType`` is not an allowed value. Notes ----- The ``ampMaskedImage`` and ``overscanImage`` are modified, with the fit subtracted. Note that the ``overscanImage`` should not be a subimage of the ``ampMaskedImage``, to avoid being subtracted twice. Debug plots are available for the SPLINE fitTypes by setting the `debug.display` for `name` == "lsst.ip.isr.isrFunctions". These plots show the scatter plot of the overscan data (collapsed along the perpendicular dimension) as a function of position on the CCD (normalized between +/-1).
Definition at line 494 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 248 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.setBadRegions | ( | exposure, | |
badStatistic = "MEDIAN" |
|||
) |
Set all BAD areas of the chip to the average of the rest of the exposure Parameters ---------- exposure : `lsst.afw.image.Exposure` Exposure to mask. The exposure mask is modified. badStatistic : `str`, optional Statistic to use to generate the replacement value from the image data. Allowed values are 'MEDIAN' or 'MEANCLIP'. Returns ------- badPixelCount : scalar Number of bad pixels masked. badPixelValue : scalar Value substituted for bad pixels. Raises ------ RuntimeError Raised if `badStatistic` is not an allowed value.
Definition at line 1043 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.transposeDefectList | ( | defectList | ) |
Make a transposed copy of a defect list. Parameters ---------- defectList : `lsst.meas.algorithms.Defects` Input list of defects. Returns ------- retDefectList : `lsst.meas.algorithms.Defects` Transposed list of defects.
Definition at line 121 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.transposeMaskedImage | ( | maskedImage | ) |
Make a transposed copy of a masked image. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. Returns ------- transposed : `lsst.afw.image.MaskedImage` The transposed copy of the input image.
Definition at line 58 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.trimToMatchCalibBBox | ( | rawMaskedImage, | |
calibMaskedImage | |||
) |
Compute number of edge trim pixels to match the calibration data. Use the dimension difference between the raw exposure and the calibration exposure to compute the edge trim pixels. This trim is applied symmetrically, with the same number of pixels masked on each side. Parameters ---------- rawMaskedImage : `lsst.afw.image.MaskedImage` Image to trim. calibMaskedImage : `lsst.afw.image.MaskedImage` Calibration image to draw new bounding box from. Returns ------- replacementMaskedImage : `lsst.afw.image.MaskedImage` ``rawMaskedImage`` trimmed to the appropriate size Raises ------ RuntimeError Rasied if ``rawMaskedImage`` cannot be symmetrically trimmed to match ``calibMaskedImage``.
Definition at line 280 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.updateVariance | ( | maskedImage, | |
gain, | |||
readNoise | |||
) |
Set the variance plane based on the image plane. Parameters ---------- maskedImage : `lsst.afw.image.MaskedImage` Image to process. The variance plane is modified. gain : scalar The amplifier gain in electrons/ADU. readNoise : scalar The amplifier read nmoise in ADU/pixel.
Definition at line 400 of file isrFunctions.py.
def lsst.ip.isr.isrFunctions.widenSaturationTrails | ( | mask | ) |
Grow the saturation trails by an amount dependent on the width of the trail. Parameters ---------- mask : `lsst.afw.image.Mask` Mask which will have the saturated areas grown.
Definition at line 996 of file isrFunctions.py.