|
lsst.meas.base
tickets.DM-23835-g914efbff1e
|
Public Member Functions | |
| def | __init__ (self, config, exposure, footprints, noiseImage=None, exposureId=None, log=None) |
| def | insertSource (self, id) |
| def | removeSource (self, id) |
| def | end (self) |
| def | getNoiseGenerator (self, exposure, noiseImage, noiseMeanVar, exposureId=None) |
Public Attributes | |
| noiseSource | |
| noiseOffset | |
| noiseSeedMultiplier | |
| noiseGenMean | |
| noiseGenStd | |
| removeplanes | |
| otherbitmask | |
| heavies | |
| heavyNoise | |
Static Public Attributes | |
| ConfigClass | |
| exposure | |
| footprints | |
| log | |
Replace sources with noise during measurement.
Parameters
----------
config : `NoiseReplacerConfig`
Configuration.
exposure : `lsst.afw.image.Exposure`
Image in which sources will be replaced by noise. During operation,
the image will be modified in-place to replace all sources. At the end
of the measurment procedure, the original sources will be replaced.
footprints : `dict`
Mapping of ``id`` to a tuple of ``(parent, Footprint)``. When used in
single-frame measurement, ``id`` is the source ID, but in forced
photometry this is the reference ID (as that is used to determine
deblend families).
noiseImage : `lsst.afw.image.ImageF`
An image used as a predictable noise replacement source. Used during
testing only.
log : `lsst.log.log.log.Log`, optional
Logger to use for status messages; no status messages will be recorded
if `None`.
Notes
-----
When measuring a source (or the children associated with a parent source),
this class is used to replace its neighbors with noise, using the
deblender's definition of the sources as stored in
`~lsst.afw.detection.heavyFootprint.HeavyFootprint`\ s attached to the
`~lsst.afw.table.SourceRecord`\ s. The algorithm works as follows:
#. All pixels in the source `~lsst.afw.detection.Footprint`\ s are replaced
with artificially generated noise (in `NoiseReplacer.__init__`).
#. Before each source is measured, we restore the original pixel data by
inserting that source's
`~lsst.afw.detection.heavyFootprint.HeavyFootprint` (from the deblender)
into the image.
#. After measurement, we again replace the source pixels with (the same)
artificial noise.
#. After measuring all sources, the image is returned to its original
state.
This is a functional copy of the code in the older
``ReplaceWithNoiseTask``, but with a slightly different API needed for the
new measurement framework; note that it is not an `~lsst.pipe.base.Task`,
as the lifetime of a ``NoiseReplacer`` now corresponds to a single
exposure, not an entire processing run.
When processing the ``footprints`` parameter, this routine should create
`~lsst.afw.detection.heavyFootprint.HeavyFootprint`\ s for any non-Heavy
`~lsst.afw.detection.Footprint`\ s, and replace them in the dictionary. It
should then create a dict of
`~lsst.afw.detection.heavyFootprint.HeavyFootprint`\ s containing noise,
but only for parent objects, then replace all sources with noise. This
should ignore any footprints that lay outside the bounding box of the
exposure, and clip those that lie on the border.
As the code currently stands, the heavy footprint for a deblended object
must be available from the input catalog. If it is not, it cannot be
reproduced here. In that case, the topmost parent in the objects parent
chain must be used. The heavy footprint for that source is created in
this class from the masked image.
Definition at line 57 of file noiseReplacer.py.
| def lsst.meas.base.noiseReplacer.NoiseReplacer.__init__ | ( | self, | |
| config, | |||
| exposure, | |||
| footprints, | |||
noiseImage = None, |
|||
exposureId = None, |
|||
log = None |
|||
| ) |
Definition at line 135 of file noiseReplacer.py.
| def lsst.meas.base.noiseReplacer.NoiseReplacer.end | ( | self | ) |
End the NoiseReplacer. Restores original data to the exposure from the heavies dictionary and the mask planes to their original state.
Definition at line 274 of file noiseReplacer.py.
| def lsst.meas.base.noiseReplacer.NoiseReplacer.getNoiseGenerator | ( | self, | |
| exposure, | |||
| noiseImage, | |||
| noiseMeanVar, | |||
exposureId = None |
|||
| ) |
Return a generator of artificial noise. Returns ------- noiseGenerator : `lsst.afw.image.noiseReplacer.NoiseGenerator`
Definition at line 298 of file noiseReplacer.py.
| def lsst.meas.base.noiseReplacer.NoiseReplacer.insertSource | ( | self, | |
| id | |||
| ) |
Insert the heavy footprint of a given source into the exposure.
Parameters
----------
id : `int`
ID of the source to insert from original dictionary of footprints.
Notes
-----
Also adjusts the mask plane to show the source of this footprint.
Definition at line 214 of file noiseReplacer.py.
| def lsst.meas.base.noiseReplacer.NoiseReplacer.removeSource | ( | self, | |
| id | |||
| ) |
Replace the heavy footprint of a given source with noise.
The same artificial noise is used as in the original replacement.
Parameters
----------
id : `int`
ID of the source to replace from original dictionary of footprints.
Notes
-----
Also restores the mask plane.
Definition at line 241 of file noiseReplacer.py.
|
static |
Definition at line 121 of file noiseReplacer.py.
|
static |
Definition at line 123 of file noiseReplacer.py.
|
static |
Definition at line 127 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.heavies |
Definition at line 172 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.heavyNoise |
Definition at line 196 of file noiseReplacer.py.
|
static |
Definition at line 131 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.noiseGenMean |
Definition at line 140 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.noiseGenStd |
Definition at line 141 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.noiseOffset |
Definition at line 138 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.noiseSeedMultiplier |
Definition at line 139 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.noiseSource |
Definition at line 137 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.otherbitmask |
Definition at line 170 of file noiseReplacer.py.
| lsst.meas.base.noiseReplacer.NoiseReplacer.removeplanes |
Definition at line 152 of file noiseReplacer.py.
1.8.16