LSST Applications g0603fd7c41+022847dfd1,g180d380827+84552d2356,g2079a07aa2+86d27d4dc4,g2305ad1205+696e5f3872,g2bbee38e9b+047b288a59,g337abbeb29+047b288a59,g33d1c0ed96+047b288a59,g3a166c0a6a+047b288a59,g3d1719c13e+f45185db35,g3de15ee5c7+21d867f780,g487adcacf7+777bbf561e,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+248b16177b,g63cd9335cc+585e252eca,g858d7b2824+f45185db35,g88963caddf+4b08a23952,g991b906543+f45185db35,g99cad8db69+1747e75aa3,g9b9dfce982+78139cbddb,g9ddcbc5298+9a081db1e4,ga1e77700b3+a912195c07,gae0086650b+585e252eca,gb0e22166c9+60f28cb32d,gb3a676b8dc+b4feba26a1,gb4b16eec92+f82f04eb54,gba4ed39666+c2a2e4ac27,gbb8dafda3b+7cdca563f4,gc120e1dc64+1a5de9e6d7,gc28159a63d+047b288a59,gc3e9b769f7+dcad4ace9a,gcf0d15dbbd+78139cbddb,gd040fa1545+f45185db35,gdaeeff99f8+f9a426f77a,ge79ae78c31+047b288a59,w.2024.19
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Static Protected Attributes | List of all members
lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateTask Class Reference
Inheritance diagram for lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateTask:

Public Member Functions

 run (self, maskedImage, badpix=None, goodpix=None)
 

Static Public Attributes

 ConfigClass = CloughTocher2DInterpolateConfig
 

Static Protected Attributes

str _DefaultName = "cloughTocher2DInterpolate"
 

Detailed Description

Interpolated over bad pixels using CloughTocher2DInterpolator.

Pixels with mask bits set to any of those listed ``badMaskPlanes`` config
are considered bad and are interpolated over. All good (non-bad) pixels
within ``interpLength`` pixels of a bad pixel in either direction are used
to construct the interpolant.  An extended streak of bad pixels at an edge,
longer than ``interpLength``, is set to `fillValue`` specified in config.

Definition at line 56 of file cloughTocher2DInterpolator.py.

Member Function Documentation

◆ run()

lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateTask.run ( self,
maskedImage,
badpix = None,
goodpix = None )
Interpolate over bad pixels in a masked image.

This modifies the ``image`` attribute of the ``maskedImage`` in place.
This method returns, and accepts, the coordinates of the bad pixels
that were interpolated over, and the coordinates and values of the
good pixels that were used to construct the interpolant. This avoids
having to search for the bad and the good pixels repeatedly when the
mask plane is shared among many images, as would be the case with
noise realizations.

Parameters
----------
maskedImage : `~lsst.afw.image.MaskedImageF`
    Image on which to perform interpolation (and modify in-place).
badpix: `numpy.ndarray`, optional
    N x 3 numpy array, where N is the number of bad pixels.
    The coordinates of the bad pixels to interpolate over in the first
    two columns, and the pixel values (unused) in the third column.
    If None, then the coordinates of the bad pixels are determined by
    an exhaustive search over the image. If ``goodpix`` is not
    provided, then this parameter is ignored.
goodpix: `numpy.ndarray`, optional
    M x 3 numpy array, where M is the number of good pixels.
    The first two columns are the coordinates of the good pixels around
    ``badpix`` that must be included when constructing the interpolant.
    the interpolant. The values are populated from the image plane of
    the ``maskedImage`` and returned (provided values will be ignored).
    If ``badpix`` is not provided, then this parameter is ignored.

Returns
-------
badpix: `numpy.ndarray`
    N x 3 numpy array, where N is the number of bad pixels.
    The coordinates of the bad pixels that were interpolated over are
    in the first two columns, and the corresponding pixel values in the
    third. If ``badpix`` was provided, this is the same as the input.
goodpix: `numpy.ndarray`
    M x 3 numpy array, where M is the number of bad pixels.
    The coordinates of the good pixels that were used to construct the
    interpolant arein the first two columns, and the corresponding
    pixel values in the third. If ``goodpix`` was provided, the first
    two columns are same as the input, with the third column updated
    with the pixel values from the image plane of the ``maskedImage``.

Definition at line 69 of file cloughTocher2DInterpolator.py.

74 ):
75 """Interpolate over bad pixels in a masked image.
76
77 This modifies the ``image`` attribute of the ``maskedImage`` in place.
78 This method returns, and accepts, the coordinates of the bad pixels
79 that were interpolated over, and the coordinates and values of the
80 good pixels that were used to construct the interpolant. This avoids
81 having to search for the bad and the good pixels repeatedly when the
82 mask plane is shared among many images, as would be the case with
83 noise realizations.
84
85 Parameters
86 ----------
87 maskedImage : `~lsst.afw.image.MaskedImageF`
88 Image on which to perform interpolation (and modify in-place).
89 badpix: `numpy.ndarray`, optional
90 N x 3 numpy array, where N is the number of bad pixels.
91 The coordinates of the bad pixels to interpolate over in the first
92 two columns, and the pixel values (unused) in the third column.
93 If None, then the coordinates of the bad pixels are determined by
94 an exhaustive search over the image. If ``goodpix`` is not
95 provided, then this parameter is ignored.
96 goodpix: `numpy.ndarray`, optional
97 M x 3 numpy array, where M is the number of good pixels.
98 The first two columns are the coordinates of the good pixels around
99 ``badpix`` that must be included when constructing the interpolant.
100 the interpolant. The values are populated from the image plane of
101 the ``maskedImage`` and returned (provided values will be ignored).
102 If ``badpix`` is not provided, then this parameter is ignored.
103
104 Returns
105 -------
106 badpix: `numpy.ndarray`
107 N x 3 numpy array, where N is the number of bad pixels.
108 The coordinates of the bad pixels that were interpolated over are
109 in the first two columns, and the corresponding pixel values in the
110 third. If ``badpix`` was provided, this is the same as the input.
111 goodpix: `numpy.ndarray`
112 M x 3 numpy array, where M is the number of bad pixels.
113 The coordinates of the good pixels that were used to construct the
114 interpolant arein the first two columns, and the corresponding
115 pixel values in the third. If ``goodpix`` was provided, the first
116 two columns are same as the input, with the third column updated
117 with the pixel values from the image plane of the ``maskedImage``.
118 """
119
120 if badpix is None or goodpix is None:
121 badpix, goodpix = ctUtils.findGoodPixelsAroundBadPixels(
122 maskedImage,
123 self.config.badMaskPlanes,
124 buffer=self.config.interpLength,
125 )
126 else:
127 # Even if badpix and goodpix is provided, make sure to update
128 # the values of goodpix.
129 ctUtils.updateArrayFromImage(goodpix, maskedImage.image)
130
131 # Construct the interpolant with goodpix.
132 interpolator = CloughTocher2DInterpolator(
133 list(zip(goodpix[:, 0], goodpix[:, 1])),
134 goodpix[:, 2],
135 fill_value=self.config.fillValue,
136 )
137
138 # Compute the interpolated values at bad pixel locations.
139 badpix[:, 2] = interpolator(badpix[:, :2])
140
141 # Fill in the bad pixels.
142 ctUtils.updateImageFromArray(maskedImage.image, badpix)
143
144 return badpix, goodpix

Member Data Documentation

◆ _DefaultName

str lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateTask._DefaultName = "cloughTocher2DInterpolate"
staticprotected

Definition at line 67 of file cloughTocher2DInterpolator.py.

◆ ConfigClass

lsst.meas.algorithms.cloughTocher2DInterpolator.CloughTocher2DInterpolateTask.ConfigClass = CloughTocher2DInterpolateConfig
static

Definition at line 66 of file cloughTocher2DInterpolator.py.


The documentation for this class was generated from the following file: