LSST Applications g0fba68d861+bb7a7cfa1f,g1ec0fe41b4+f536777771,g1fd858c14a+470a99fdf4,g216c3ac8a7+0d4d80193f,g35bb328faa+fcb1d3bbc8,g4d2262a081+23bd310d1b,g53246c7159+fcb1d3bbc8,g56a49b3a55+369644a549,g5a012ec0e7+3632fc3ff3,g60b5630c4e+3bfb9058a5,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8180f54f50+60bd39f3b6,g8352419a5c+fcb1d3bbc8,g87d29937c9+57a68d035f,g8852436030+4699110379,g89139ef638+ed4b5058f4,g9125e01d80+fcb1d3bbc8,g94187f82dc+3bfb9058a5,g989de1cb63+ed4b5058f4,g9ccd5d7f00+b7cae620c0,g9d31334357+3bfb9058a5,g9f33ca652e+00883ace41,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+27b24065a3,gb58c049af0+f03b321e39,gb89ab40317+ed4b5058f4,gc0af124501+708fe67c54,gcf25f946ba+4699110379,gd6cbbdb0b4+bb83cc51f8,gde0f65d7ad+acd5afb0eb,ge1ad929117+3bfb9058a5,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.17
LSST Data Management Base Package
Loading...
Searching...
No Matches
lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin Class Reference
Inheritance diagram for lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin:
lsst.meas.base.sfm.SingleFramePlugin lsst.meas.base.baseMeasurement.BaseMeasurementPlugin lsst.meas.base.pluginsBase.BasePlugin

Public Member Functions

 getExecutionOrder (cls)
 
 __init__ (self, SingleFrameCompensatedGaussianFluxConfig config, str name, schema, metadata, logName=None, **kwds)
 
 fail (self, measRecord, error=None)
 
 measure (self, measRecord, exposure)
 
 measureN (self, measCat, exposure)
 
 getLogName (self)
 

Static Public Member Functions

 getTransformClass ()
 

Public Attributes

dict width_keys = {}
 
 flagHandler = FlagHandler.addFields(schema, name, flagDefs)
 
 config = config
 
 name = name
 
 logName = logName
 

Static Public Attributes

 registry = PluginRegistry(SingleFramePluginConfig)
 
float CENTROID_ORDER = 0.0
 
float SHAPE_ORDER = 1.0
 
float FLUX_ORDER = 2.0
 
float APCORR_ORDER = 3.0
 
float DEFAULT_CATALOGCALCULATION = 4.0
 
 ConfigClass = BasePluginConfig
 

Protected Attributes

dict _rads = {}
 
dict _flux_corrections = {}
 
dict _variance_corrections = {}
 
 _t = config.t
 
 _max_rad = max(self._rads)
 

Detailed Description

Definition at line 58 of file _compensatedGaussian.py.

Constructor & Destructor Documentation

◆ __init__()

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.__init__ ( self,
SingleFrameCompensatedGaussianFluxConfig config,
str name,
schema,
metadata,
logName = None,
** kwds )

Definition at line 65 of file _compensatedGaussian.py.

73 ):
74 super().__init__(config, name, schema, metadata, logName, **kwds)
75
76 flagDefs = FlagDefinitionList()
77
78 self.width_keys = {}
79 self._rads = {}
80 self._flux_corrections = {}
81 self._variance_corrections = {}
82 self._t = config.t
83 for width in config.kernel_widths:
84 base_key = f"{name}_{width}"
85
86 # flux
87 flux_str = f"{base_key}_instFlux"
88 flux_key = schema.addField(
89 flux_str,
90 type="D",
91 doc="Compensated Gaussian flux measurement.",
92 units="count",
93 )
94
95 # flux error
96 err_str = f"{base_key}_instFluxErr"
97 err_key = schema.addField(
98 err_str,
99 type="D",
100 doc="Compensated Gaussian flux error.",
101 units="count",
102 )
103
104 # mask bits
105 mask_str = f"{base_key}_mask_bits"
106 mask_key = schema.addField(mask_str, type=np.int32, doc="Mask bits set within aperture.")
107
108 # failure flags
109 failure_flag = flagDefs.add(f"{width}_flag", "Compensated Gaussian measurement failed")
110 oob_flag = flagDefs.add(f"{width}_flag_bounds", "Compensated Gaussian out-of-bounds")
111
112 self.width_keys[width] = (flux_key, err_key, mask_key, failure_flag, oob_flag)
113 self._rads[width] = math.ceil(sps.norm.ppf((0.995,), scale=width * config.t)[0])
114
115 self.flagHandler = FlagHandler.addFields(schema, name, flagDefs)
116 self._max_rad = max(self._rads)
117

Member Function Documentation

◆ fail()

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.fail ( self,
measRecord,
error = None )
Record failure

See also
--------
lsst.meas.base.SingleFramePlugin.fail

Reimplemented from lsst.meas.base.pluginsBase.BasePlugin.

Definition at line 118 of file _compensatedGaussian.py.

118 def fail(self, measRecord, error=None):
119 """Record failure
120
121 See also
122 --------
123 lsst.meas.base.SingleFramePlugin.fail
124 """
125 if error is None:
126 self.flagHandler.handleFailure(measRecord)
127 else:
128 self.flagHandler.handleFailure(measRecord, error.cpp)
129

◆ getExecutionOrder()

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.getExecutionOrder ( cls)
Get the relative execution order of this plugin.

Must be reimplemented as a class method by concrete derived classes.

Reimplemented from lsst.meas.base.pluginsBase.BasePlugin.

Definition at line 62 of file _compensatedGaussian.py.

62 def getExecutionOrder(cls):
63 return cls.FLUX_ORDER
64

◆ getLogName()

lsst.meas.base.pluginsBase.BasePlugin.getLogName ( self)
inherited

Definition at line 134 of file pluginsBase.py.

134 def getLogName(self):
135 return self.logName
136

◆ getTransformClass()

lsst.meas.base.pluginsBase.BasePlugin.getTransformClass ( )
staticinherited
Get the measurement transformation appropriate to this plugin.

This returns a subclass of `transforms.MeasurementTransform`, which
may be instantiated with details of the algorithm configuration and
then called with information about calibration and WCS to convert from
raw measurement quantities to calibrated units. Calibrated data is
then provided in a separate output table.

Notes
-----
By default, we copy everything from the input to the output without
transformation.

Reimplemented in lsst.meas.base.plugins.ForcedPeakCentroidPlugin, and lsst.meas.base.plugins.SingleFramePeakCentroidPlugin.

Definition at line 169 of file pluginsBase.py.

169 def getTransformClass():
170 """Get the measurement transformation appropriate to this plugin.
171
172 This returns a subclass of `transforms.MeasurementTransform`, which
173 may be instantiated with details of the algorithm configuration and
174 then called with information about calibration and WCS to convert from
175 raw measurement quantities to calibrated units. Calibrated data is
176 then provided in a separate output table.
177
178 Notes
179 -----
180 By default, we copy everything from the input to the output without
181 transformation.
182 """
183 return PassThroughTransform

◆ measure()

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.measure ( self,
measRecord,
exposure )
Measure the properties of a source on a single image.

The image may be from a single epoch, or it may be a coadd.

Parameters
----------
measRecord : `lsst.afw.table.SourceRecord`
    Record describing the object being measured. Previously-measured
    quantities may be retrieved from here, and it will be updated
    in-place tih the outputs of this plugin.
exposure : `lsst.afw.image.ExposureF`
    The pixel data to be measured, together with the associated PSF,
    WCS, etc. All other sources in the image should have been replaced
    by noise according to deblender outputs.

Reimplemented from lsst.meas.base.sfm.SingleFramePlugin.

Definition at line 130 of file _compensatedGaussian.py.

130 def measure(self, measRecord, exposure):
131 center = measRecord.getCentroid()
132 bbox = exposure.getBBox()
133
134 y = center.getY() - bbox.beginY
135 x = center.getX() - bbox.beginX
136
137 y_floor = math.floor(y)
138 x_floor = math.floor(x)
139
140 for width, (flux_key, err_key, mask_key, failure_flag, oob_flag) in self.width_keys.items():
141 rad = self._rads[width]
142
143 if Point2I(center) not in exposure.getBBox().erodedBy(rad):
144 self.flagHandler.setValue(measRecord, failure_flag.number, True)
145 self.flagHandler.setValue(measRecord, oob_flag.number, True)
146 continue
147
148 y_slice = slice(y_floor - rad, y_floor + rad + 1, 1)
149 x_slice = slice(x_floor - rad, x_floor + rad + 1, 1)
150 y_mean = y - y_floor + rad
151 x_mean = x - x_floor + rad
152
153 sub_im = exposure.image.array[y_slice, x_slice]
154 sub_var = exposure.variance.array[y_slice, x_slice]
155
156 if sub_im.size == 0 or sub_im.shape[0] != sub_im.shape[1] or (sub_im.shape[0] % 2) == 0:
157 self.flagHandler.setValue(measRecord, failure_flag.number, True)
158 self.flagHandler.setValue(measRecord, oob_flag.number, True)
159 continue
160
161 flux, var = _compensatedGaussianFiltInnerProduct(
162 sub_im,
163 sub_var,
164 x_mean,
165 y_mean,
166 width,
167 self._t,
168 )
169
170 measRecord.set(flux_key, flux)
171 measRecord.set(err_key, np.sqrt(var))
172 measRecord.set(mask_key, np.bitwise_or.reduce(exposure.mask.array[y_slice, x_slice], axis=None))

◆ measureN()

lsst.meas.base.sfm.SingleFramePlugin.measureN ( self,
measCat,
exposure )
inherited
Measure the properties of blended sources on a single image.

This operates on all members of a blend family at once. The image may
be from a single epoch, or it may be a coadd.

Parameters
----------
measCat : `lsst.afw.table.SourceCatalog`
    Catalog describing the objects (and only those objects) being
    measured. Previously-measured quantities will be retrieved from
    here, and it will be updated in-place with the outputs of this
    plugin.
exposure : `lsst.afw.image.ExposureF`
    The pixel data to be measured, together with the associated PSF,
    WCS, etc. All other sources in the image should have been replaced
    by noise according to deblender outputs.

Notes
-----
Derived classes that do not implement ``measureN`` should just inherit
this disabled version.  Derived classes that do implement ``measureN``
should additionally add a bool doMeasureN config field to their config
class to signal that measureN-mode is available.

Reimplemented in lsst.meas.base.wrappers.WrappedSingleFramePlugin.

Definition at line 104 of file sfm.py.

104 def measureN(self, measCat, exposure):
105 """Measure the properties of blended sources on a single image.
106
107 This operates on all members of a blend family at once. The image may
108 be from a single epoch, or it may be a coadd.
109
110 Parameters
111 ----------
112 measCat : `lsst.afw.table.SourceCatalog`
113 Catalog describing the objects (and only those objects) being
114 measured. Previously-measured quantities will be retrieved from
115 here, and it will be updated in-place with the outputs of this
116 plugin.
117 exposure : `lsst.afw.image.ExposureF`
118 The pixel data to be measured, together with the associated PSF,
119 WCS, etc. All other sources in the image should have been replaced
120 by noise according to deblender outputs.
121
122 Notes
123 -----
124 Derived classes that do not implement ``measureN`` should just inherit
125 this disabled version. Derived classes that do implement ``measureN``
126 should additionally add a bool doMeasureN config field to their config
127 class to signal that measureN-mode is available.
128 """
129 raise NotImplementedError()
130
131

Member Data Documentation

◆ _flux_corrections

dict lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._flux_corrections = {}
protected

Definition at line 80 of file _compensatedGaussian.py.

◆ _max_rad

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._max_rad = max(self._rads)
protected

Definition at line 116 of file _compensatedGaussian.py.

◆ _rads

dict lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._rads = {}
protected

Definition at line 79 of file _compensatedGaussian.py.

◆ _t

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._t = config.t
protected

Definition at line 82 of file _compensatedGaussian.py.

◆ _variance_corrections

dict lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._variance_corrections = {}
protected

Definition at line 81 of file _compensatedGaussian.py.

◆ APCORR_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.APCORR_ORDER = 3.0
staticinherited

Definition at line 98 of file pluginsBase.py.

◆ CENTROID_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.CENTROID_ORDER = 0.0
staticinherited

Definition at line 72 of file pluginsBase.py.

◆ config

lsst.meas.base.pluginsBase.BasePlugin.config = config
inherited

Definition at line 130 of file pluginsBase.py.

◆ ConfigClass

lsst.meas.base.pluginsBase.BasePlugin.ConfigClass = BasePluginConfig
staticinherited

Definition at line 116 of file pluginsBase.py.

◆ DEFAULT_CATALOGCALCULATION

float lsst.meas.base.pluginsBase.BasePlugin.DEFAULT_CATALOGCALCULATION = 4.0
staticinherited

Definition at line 108 of file pluginsBase.py.

◆ flagHandler

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.flagHandler = FlagHandler.addFields(schema, name, flagDefs)

Definition at line 115 of file _compensatedGaussian.py.

◆ FLUX_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.FLUX_ORDER = 2.0
staticinherited

Definition at line 89 of file pluginsBase.py.

◆ logName

lsst.meas.base.pluginsBase.BasePlugin.logName = logName
inherited

Definition at line 132 of file pluginsBase.py.

◆ name

lsst.meas.base.pluginsBase.BasePlugin.name = name
inherited

Definition at line 131 of file pluginsBase.py.

◆ registry

lsst.meas.base.sfm.SingleFramePlugin.registry = PluginRegistry(SingleFramePluginConfig)
staticinherited

Definition at line 77 of file sfm.py.

◆ SHAPE_ORDER

float lsst.meas.base.pluginsBase.BasePlugin.SHAPE_ORDER = 1.0
staticinherited

Definition at line 80 of file pluginsBase.py.

◆ width_keys

dict lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.width_keys = {}

Definition at line 78 of file _compensatedGaussian.py.


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