42 _persistence_name =
'ExposureSummaryStats'
44 _factory = StorableHelperFactory(__name__, _persistence_name)
48 psfSigma: float = float(
'nan')
49 """PSF determinant radius (pixels)."""
51 psfArea: float = float(
'nan')
52 """PSF effective area (pixels**2)."""
54 psfIxx: float = float(
'nan')
55 """PSF shape Ixx (pixels**2)."""
57 psfIyy: float = float(
'nan')
58 """PSF shape Iyy (pixels**2)."""
60 psfIxy: float = float(
'nan')
61 """PSF shape Ixy (pixels**2)."""
63 ra: float = float(
'nan')
64 """Bounding box center Right Ascension (degrees)."""
66 dec: float = float(
'nan')
67 """Bounding box center Declination (degrees)."""
69 pixelScale: float = float(
'nan')
70 """Measured detector pixel scale (arcsec/pixel)."""
72 zenithDistance: float = float(
'nan')
73 """Bounding box center zenith distance (degrees)."""
75 expTime: float = float(
'nan')
76 """Exposure time of the exposure (seconds)."""
78 zeroPoint: float = float(
'nan')
79 """Mean zeropoint in detector (mag)."""
81 skyBg: float = float(
'nan')
82 """Average sky background (ADU)."""
84 skyNoise: float = float(
'nan')
85 """Average sky noise (ADU)."""
87 meanVar: float = float(
'nan')
88 """Mean variance of the weight plane (ADU**2)."""
90 raCorners: list[float] = dataclasses.field(default_factory=_default_corners)
91 """Right Ascension of bounding box corners (degrees)."""
93 decCorners: list[float] = dataclasses.field(default_factory=_default_corners)
94 """Declination of bounding box corners (degrees)."""
96 astromOffsetMean: float = float(
'nan')
97 """Astrometry match offset mean."""
99 astromOffsetStd: float = float(
'nan')
100 """Astrometry match offset stddev."""
103 """Number of stars used for psf model."""
105 psfStarDeltaE1Median: float = float(
'nan')
106 """Psf stars median E1 residual (starE1 - psfE1)."""
108 psfStarDeltaE2Median: float = float(
'nan')
109 """Psf stars median E2 residual (starE2 - psfE2)."""
111 psfStarDeltaE1Scatter: float = float(
'nan')
112 """Psf stars MAD E1 scatter (starE1 - psfE1)."""
114 psfStarDeltaE2Scatter: float = float(
'nan')
115 """Psf stars MAD E2 scatter (starE2 - psfE2)."""
117 psfStarDeltaSizeMedian: float = float(
'nan')
118 """Psf stars median size residual (starSize - psfSize)."""
120 psfStarDeltaSizeScatter: float = float(
'nan')
121 """Psf stars MAD size scatter (starSize - psfSize)."""
123 psfStarScaledDeltaSizeScatter: float = float(
'nan')
124 """Psf stars MAD size scatter scaled by psfSize**2."""
126 psfTraceRadiusDelta: float = float(
'nan')
127 """Delta (max - min) of the model psf trace radius values evaluated on a
128 grid of unmasked pixels (pixels).
131 psfApFluxDelta: float = float(
'nan')
132 """Delta (max - min) of the model psf aperture flux (with aperture radius of
133 max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.
136 psfApCorrSigmaScaledDelta: float = float(
'nan')
137 """Delta (max - min) of the psf flux aperture correction factors scaled (divided)
138 by the psfSigma evaluated on a grid of unmasked pixels.
141 maxDistToNearestPsf: float = float(
'nan')
142 """Maximum distance of an unmasked pixel to its nearest model psf star
146 starEMedian: float = float(
'nan')
147 """Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used
151 starUnNormalizedEMedian: float = float(
'nan')
152 """Median un-normalized ellipticity
153 (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0))
154 of the stars used in the PSF model.
157 starComa1Median: float = float(
'nan')
158 """Coma-like higher-order moment combination: median M30 + M12
159 of the stars used in the PSF model.
162 starComa2Median: float = float(
'nan')
163 """Coma-like higher-order moment combination: median M21 + M03
164 of the stars used in the PSF model.
167 starTrefoil1Median: float = float(
'nan')
168 """Trefoil-like higher-order moment combination: median M30 - 3*M12
169 of the stars used in the PSF model.
172 starTrefoil2Median: float = float(
'nan')
173 """Trefoil-like higher-order moment combination: median 3*M21 - M03
174 of the stars used in the PSF model.
177 starKurtosisMedian: float = float(
'nan')
178 """Kurtosis-like higher-order moment combination: median M40 + 2*M22 + M04
179 of the stars used in the PSF model.
182 starE41Median: float = float(
'nan')
183 """Fourth-order ellipticity-like higher-order moment combination: median M40 - M04
184 of the stars used in the PSF model.
187 starE42Median: float = float(
'nan')
188 """Fourth-order ellipticity-like higher-order moment combination: median 2*(M31 + M13)
189 of the stars used in the PSF model.
192 effTime: float = float(
'nan')
193 """Effective exposure time calculated from psfSigma, skyBg, and
197 effTimePsfSigmaScale: float = float(
'nan')
198 """PSF scaling of the effective exposure time."""
200 effTimeSkyBgScale: float = float(
'nan')
201 """Sky background scaling of the effective exposure time."""
203 effTimeZeroPointScale: float = float(
'nan')
204 """Zeropoint scaling of the effective exposure time."""
206 magLim: float = float(
'nan')
207 """Magnitude limit at fixed SNR (default SNR=5) calculated from psfSigma, skyBg,
208 zeroPoint, and readNoise.
212 Storable.__init__(self)
224 return yaml.dump(dataclasses.asdict(self), encoding=
'utf-8')
228 yamlDict = yaml.load(bytes, Loader=yaml.SafeLoader)
231 forwardFieldDict = {
"decl":
"dec"}
236 for _field
in list(yamlDict.keys()):
237 if _field
not in ExposureSummaryStats.__dataclass_fields__:
238 if _field
in forwardFieldDict
and forwardFieldDict[_field]
not in yamlDict:
239 yamlDict[forwardFieldDict[_field]] = yamlDict[_field]
241 droppedFields.append(_field)
243 if len(droppedFields) > 0:
244 droppedFieldString =
", ".join([str(f)
for f
in droppedFields])
245 plural =
"s" if len(droppedFields) != 1
else ""
246 them =
"them" if len(droppedFields) > 1
else "it"
248 f
"Summary field{plural} [{droppedFieldString}] not recognized by this software version;"
249 f
" ignoring {them}.",
257 """Update an schema to includes for all summary statistic fields.
261 schema : `lsst.afw.table.Schema`
262 Schema to add which fields will be added.
267 doc=
"PSF model second-moments determinant radius (center of chip) (pixel)",
273 doc=
"PSF model effective area (center of chip) (pixel**2)",
279 doc=
"PSF model Ixx (center of chip) (pixel**2)",
285 doc=
"PSF model Iyy (center of chip) (pixel**2)",
291 doc=
"PSF model Ixy (center of chip) (pixel**2)",
298 doc=
"Right Ascension of bounding box corners (degrees)",
305 doc=
"Declination of bounding box corners (degrees)",
311 doc=
"Right Ascension of bounding box center (degrees)",
317 doc=
"Declination of bounding box center (degrees)",
323 doc=
"Zenith distance of bounding box center (degrees)",
329 doc=
"Measured detector pixel scale (arcsec/pixel)",
330 units=
"arcsec/pixel",
335 doc=
"Exposure time of the exposure (seconds)",
341 doc=
"Mean zeropoint in detector (mag)",
347 doc=
"Average sky background (ADU)",
353 doc=
"Average sky noise (ADU)",
359 doc=
"Mean variance of the weight plane (ADU**2)",
365 doc=
"Mean offset of astrometric calibration matches (arcsec)",
371 doc=
"Standard deviation of offsets of astrometric calibration matches (arcsec)",
374 schema.addField(
"nPsfStar", type=
"I", doc=
"Number of stars used for PSF model")
376 "psfStarDeltaE1Median",
378 doc=
"Median E1 residual (starE1 - psfE1) for psf stars",
381 "psfStarDeltaE2Median",
383 doc=
"Median E2 residual (starE2 - psfE2) for psf stars",
386 "psfStarDeltaE1Scatter",
388 doc=
"Scatter (via MAD) of E1 residual (starE1 - psfE1) for psf stars",
391 "psfStarDeltaE2Scatter",
393 doc=
"Scatter (via MAD) of E2 residual (starE2 - psfE2) for psf stars",
396 "psfStarDeltaSizeMedian",
398 doc=
"Median size residual (starSize - psfSize) for psf stars (pixel)",
402 "psfStarDeltaSizeScatter",
404 doc=
"Scatter (via MAD) of size residual (starSize - psfSize) for psf stars (pixel)",
408 "psfStarScaledDeltaSizeScatter",
410 doc=
"Scatter (via MAD) of size residual scaled by median size squared",
413 "psfTraceRadiusDelta",
415 doc=
"Delta (max - min) of the model psf trace radius values evaluated on a grid of "
416 "unmasked pixels (pixel).",
422 doc=
"Delta (max - min) of the model psf aperture flux (with aperture radius of "
423 "max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.",
426 "psfApCorrSigmaScaledDelta",
428 doc=
"Delta (max - min) of the model psf aperture correction factors scaled (divided) "
429 "by the psfSigma evaluated on a grid of unmasked pixels.",
432 "maxDistToNearestPsf",
434 doc=
"Maximum distance of an unmasked pixel to its nearest model psf star (pixel).",
440 doc=
"Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used in "
444 "starUnNormalizedEMedian",
446 doc=
"Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) "
447 "of the stars used in the PSF model.",
452 doc=
"Coma-like higher-order moment combination: median M30 + M12 "
453 "of the stars used in the PSF model.",
458 doc=
"Coma-like higher-order moment combination: median M21 + M03 "
459 "of the stars used in the PSF model.",
462 "starTrefoil1Median",
464 doc=
"Trefoil-like higher-order moment combination: median M30 - 3*M12 "
465 "of the stars used in the PSF model.",
468 "starTrefoil2Median",
470 doc=
"Trefoil-like higher-order moment combination: median 3*M21 - M03 "
471 "of the stars used in the PSF model.",
474 "starKurtosisMedian",
476 doc=
"Kurtosis-like higher-order moment combination: median M40 + 2*M22 + M04 "
477 "of the stars used in the PSF model.",
482 doc=
"Fourth-order ellipticity-like higher-order moment combination: median M40 - M04 "
483 "of the stars used in the PSF model.",
488 doc=
"Fourth-order ellipticity-like higher-order moment combination: median 2*(M31 + M13) "
489 "of the stars used in the PSF model.",
494 doc=
"Effective exposure time calculated from psfSigma, skyBg, and "
495 "zeroPoint (seconds).",
499 "effTimePsfSigmaScale",
501 doc=
"PSF scaling of the effective exposure time."
506 doc=
"Sky background scaling of the effective exposure time."
509 "effTimeZeroPointScale",
511 doc=
"Zeropoint scaling of the effective exposure time."
516 doc=
"Magnitude limit at SNR=5 (M5) calculated from psfSigma, "
517 "skyBg, zeroPoint, and readNoise.",
522 """Write summary-statistic columns into a record.
526 record : `lsst.afw.table.BaseRecord`
527 Record to update. This is expected to frequently be an
528 `ExposureRecord` instance (with higher-level code adding other
529 columns and objects), but this method can work with any record
532 for field
in dataclasses.fields(self):
533 value = getattr(self, field.name)
534 if field.name ==
"version":
536 elif field.type.startswith(
"list"):
537 record[field.name][:] = value
539 record[field.name] = value
543 """Read summary-statistic columns from a record into ``self``.
547 record : `lsst.afw.table.BaseRecord`
548 Record to read from. This is expected to frequently be an
549 `ExposureRecord` instance (with higher-level code adding other
550 columns and objects), but this method can work with any record
551 type, ignoring any attributes or columns it doesn't recognize.
555 summary : `ExposureSummaryStats`
556 Summary statistics object created from the given record.
561 record[field.name]
if not field.type.startswith(
"list")
562 else [float(v)
for v
in record[field.name]]
564 for field
in dataclasses.fields(cls)
565 if field.name !=
"version"