LSST Applications g063fba187b+66a50001ff,g0f08755f38+1a22dc2551,g1653933729+a8ce1bb630,g168dd56ebc+a8ce1bb630,g217e2c1bcf+12e87a5bd8,g246886dfd9+466c7b6c06,g28da252d5a+858b171e04,g2bbee38e9b+404b60ec9b,g2bc492864f+404b60ec9b,g3156d2b45e+6e55a43351,g347aa1857d+404b60ec9b,g35bb328faa+a8ce1bb630,g3a166c0a6a+404b60ec9b,g3e281a1b8c+c5dd892a6c,g414038480c+6b9177ef31,g41af890bb2+70bea58702,g599934f4f4+b8c5400ca5,g781aacb6e4+a8ce1bb630,g7af13505b9+b5b9cefdb8,g80478fca09+c2997882f3,g82479be7b0+8974e6af0f,g858d7b2824+1a22dc2551,g89c8672015+f4add4ffd5,g8f1c07a47a+de51c9b0a5,g9125e01d80+a8ce1bb630,ga5288a1d22+b66f8cf76b,gb58c049af0+d64f4d3760,gc28159a63d+404b60ec9b,gcab2d0539d+66cf1de5d4,gcf0d15dbbd+12cb7e2563,gda6a2b7d83+12cb7e2563,gdaeeff99f8+1711a396fd,ge79ae78c31+404b60ec9b,gef2f8181fd+414189b318,gf0baf85859+c1f95f4921,gf0c06eb49c+1a22dc2551,gfa517265be+1a22dc2551,gfa999e8aa5+17cd334064,v28.0.0.rc2
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | List of all members
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)
 

Public Attributes

 width_keys
 
 flagHandler
 

Static Public Attributes

 ConfigClass = SingleFrameCompensatedGaussianFluxConfig
 

Protected Attributes

 _rads
 
 _flux_corrections
 
 _variance_corrections
 
 _t
 
 _max_rad
 

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 )

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

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
int max

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

◆ 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))
std::vector< SchemaItem< Flag > > * items

Member Data Documentation

◆ _flux_corrections

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
protected

Definition at line 116 of file _compensatedGaussian.py.

◆ _rads

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._rads
protected

Definition at line 79 of file _compensatedGaussian.py.

◆ _t

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._t
protected

Definition at line 82 of file _compensatedGaussian.py.

◆ _variance_corrections

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin._variance_corrections
protected

Definition at line 81 of file _compensatedGaussian.py.

◆ ConfigClass

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.ConfigClass = SingleFrameCompensatedGaussianFluxConfig
static

Definition at line 59 of file _compensatedGaussian.py.

◆ flagHandler

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.flagHandler

Definition at line 115 of file _compensatedGaussian.py.

◆ width_keys

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: