LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+0dd8ce4237,g1470d8bcf6+3ea6592b6f,g2079a07aa2+86d27d4dc4,g2305ad1205+5ca4c0b359,g295015adf3+d10818ec9d,g2a9a014e59+6f9be1b9cd,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+703ba97ebf,g487adcacf7+4fa16da234,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+ffa42b374e,g5a732f18d5+53520f316c,g64a986408d+0dd8ce4237,g858d7b2824+0dd8ce4237,g8a8a8dda67+585e252eca,g99cad8db69+d39438377f,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+f1d96605c8,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e5339d463f,gc120e1dc64+da31e9920e,gc28159a63d+0e5473021a,gcf0d15dbbd+703ba97ebf,gdaeeff99f8+f9a426f77a,ge6526c86ff+889fc9d533,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf18bd8381d+7268b93478,gff1a9f87cc+0dd8ce4237,w.2024.16
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

 fatalFailKey
 
 ooBoundsKey
 
 width_keys
 

Static Public Attributes

 ConfigClass = SingleFrameCompensatedGaussianFluxConfig
 

Protected Attributes

 _rads
 
 _flux_corrections
 
 _variance_corrections
 
 _t
 
 _max_rad
 

Detailed Description

Definition at line 62 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 69 of file _compensatedGaussian.py.

77 ):
78 super().__init__(config, name, schema, metadata, logName, **kwds)
79
80 # create generic failure key
81 self.fatalFailKey = schema.addField(
82 f"{name}_flag", type="Flag", doc="Set to 1 for any fatal failure."
83 )
84
85 # Out of bounds failure key
86 self.ooBoundsKey = schema.addField(
87 f"{name}_bounds_flag",
88 type="Flag",
89 doc="Flag set to 1 if not all filters fit within exposure.",
90 )
91
92 self.width_keys = {}
93 self._rads = {}
94 self._flux_corrections = {}
95 self._variance_corrections = {}
96 self._t = config.t
97 for width in config.kernel_widths:
98 base_key = f"{name}_{width}"
99
100 # flux
101 flux_str = f"{base_key}_instFlux"
102 flux_key = schema.addField(
103 flux_str,
104 type="D",
105 doc="Compensated Gaussian flux measurement.",
106 units="count",
107 )
108
109 # flux error
110 err_str = f"{base_key}_instFluxErr"
111 err_key = schema.addField(
112 err_str,
113 type="D",
114 doc="Compensated Gaussian flux error.",
115 units="count",
116 )
117
118 # mask bits
119 mask_str = f"{base_key}_mask_bits"
120 mask_key = schema.addField(mask_str, type=np.int32, doc="Mask bits set within aperture.")
121
122 self.width_keys[width] = (flux_key, err_key, mask_key)
123 self._rads[width] = math.ceil(sps.norm.ppf((0.995,), scale=width * config.t)[0])
124
125 self._max_rad = max(self._rads)
126
int max

Member Function Documentation

◆ fail()

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.fail ( self,
measRecord,
error = None )
Record a failure of the `measure` or `measureN` method.

Parameters
----------
measRecord : `lsst.afw.table.SourceRecord`
    Table record describing the source being measured.
error : `MeasurementError`, optional
    Only provided if the measurement failed due to a
    `MeasurementError` being raised; otherwise, will be `None`.

Notes
-----
When the plugin raises an exception, framework will call
`BasePlugin.fail` to allow the plugin to set its failure flag
field(s).  When `BasePlugin.measureN` raises an exception,
`BasePlugin.fail` will be called repeatedly with all the records that
were being measured.

If the exception is an `MeasurementError`, it will be passed as the
error argument; in all other cases the error argument will be `None`,
and the failure will be logged by the measurement framework as a
warning.

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

Definition at line 127 of file _compensatedGaussian.py.

127 def fail(self, measRecord, error=None):
128 if isinstance(error, OutOfBoundsError):
129 measRecord.set(self.ooBoundsKey, True)
130 measRecord.set(self.fatalFailKey, True)
131

◆ 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 66 of file _compensatedGaussian.py.

66 def getExecutionOrder(cls):
67 return cls.FLUX_ORDER
68

◆ 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 132 of file _compensatedGaussian.py.

132 def measure(self, measRecord, exposure):
133 center = measRecord.getCentroid()
134 bbox = exposure.getBBox()
135
136 if Point2I(center) not in exposure.getBBox().erodedBy(self._max_rad):
137 raise OutOfBoundsError("Not all the kernels for this source fit inside the exposure.")
138
139 y = center.getY() - bbox.beginY
140 x = center.getX() - bbox.beginX
141
142 y_floor = math.floor(y)
143 x_floor = math.floor(x)
144
145 for width, (flux_key, err_key, mask_key) in self.width_keys.items():
146 rad = self._rads[width]
147 y_slice = slice(y_floor - rad, y_floor + rad + 1, 1)
148 x_slice = slice(x_floor - rad, x_floor + rad + 1, 1)
149 y_mean = y - y_floor + rad
150 x_mean = x - x_floor + rad
151
152 flux, var = _compensatedGaussianFiltInnerProduct(
153 exposure.image.array[y_slice, x_slice],
154 exposure.variance.array[y_slice, x_slice],
155 x_mean,
156 y_mean,
157 width,
158 self._t,
159 )
160 measRecord.set(flux_key, flux)
161 measRecord.set(err_key, np.sqrt(var))
162 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 94 of file _compensatedGaussian.py.

◆ _max_rad

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

Definition at line 125 of file _compensatedGaussian.py.

◆ _rads

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

Definition at line 93 of file _compensatedGaussian.py.

◆ _t

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

Definition at line 96 of file _compensatedGaussian.py.

◆ _variance_corrections

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

Definition at line 95 of file _compensatedGaussian.py.

◆ ConfigClass

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

Definition at line 63 of file _compensatedGaussian.py.

◆ fatalFailKey

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.fatalFailKey

Definition at line 81 of file _compensatedGaussian.py.

◆ ooBoundsKey

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.ooBoundsKey

Definition at line 86 of file _compensatedGaussian.py.

◆ width_keys

lsst.meas.base.compensatedGaussian._compensatedGaussian.SingleFrameCompensatedGaussianFluxPlugin.width_keys

Definition at line 92 of file _compensatedGaussian.py.


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