44 _persistence_name =
'ExposureSummaryStats'
46 _factory = StorableHelperFactory(__name__, _persistence_name)
50 psfSigma: float = float(
'nan')
51 """PSF determinant radius (pixels)."""
53 psfArea: float = float(
'nan')
54 """PSF effective area (pixels**2)."""
56 psfIxx: float = float(
'nan')
57 """PSF shape Ixx (pixels**2)."""
59 psfIyy: float = float(
'nan')
60 """PSF shape Iyy (pixels**2)."""
62 psfIxy: float = float(
'nan')
63 """PSF shape Ixy (pixels**2)."""
65 ra: float = float(
'nan')
66 """Bounding box center Right Ascension (degrees)."""
68 dec: float = float(
'nan')
69 """Bounding box center Declination (degrees)."""
71 pixelScale: float = float(
'nan')
72 """Measured detector pixel scale (arcsec/pixel)."""
74 zenithDistance: float = float(
'nan')
75 """Bounding box center zenith distance (degrees)."""
77 expTime: float = float(
'nan')
78 """Exposure time of the exposure (seconds)."""
80 zeroPoint: float = float(
'nan')
81 """Mean zeropoint in detector (mag)."""
83 skyBg: float = float(
'nan')
84 """Average sky background (ADU)."""
86 skyNoise: float = float(
'nan')
87 """Average sky noise (ADU)."""
89 meanVar: float = float(
'nan')
90 """Mean variance of the weight plane (ADU**2)."""
92 raCorners: list[float] = dataclasses.field(default_factory=_default_corners)
93 """Right Ascension of bounding box corners (degrees)."""
95 decCorners: list[float] = dataclasses.field(default_factory=_default_corners)
96 """Declination of bounding box corners (degrees)."""
98 psfAdaptiveThresholdValue: float = float(
'nan')
99 """Threshold value used in the adaptive threshold detection pass for PSF modelling."""
101 psfAdaptiveIncludeThresholdMultiplier: float = float(
'nan')
102 """Threshold multiplier used in the adaptive threshold detection pass for PSF modelling."""
104 nShapeletsStar: int = 0
105 """Number of sources used in the shapelet decomposition."""
107 shapeletsOnlyIqScore: float = float(
'nan')
108 """The dimensionless image quality score as determined from the shapelets decomposition
109 that includes power only from the non-atmospheric decomposition coefficients. The
110 score spans the range [0.0, 1.0] with lower values indicating better image quality.
113 shapeletsIqScore: float = float(
'nan')
114 """The dimensionless image quality score as determined from the shapelets decomposition
115 that includes power from the median centroid offset between those used in the decomposition
116 and those of the centroid slot in addition to non-atmospheric decomposition coefficients.
117 The score spans the range [0.0, 1.0] with lower values indicating better image quality.
120 shapeletsCoeffs: list[float] = dataclasses.field(default_factory=list)
121 """List of coefficients from the PSF star shapelet decomposition."""
123 centroidDiffShapeletsVsSlotMedian: float = float(
'nan')
124 """Median centroid difference (sqrt((slot_x - shapelet_x)**2 + (slot_y - shapelet_y)**2)) for
125 sources used in the shapelet decomposition (pixels).
128 shapeletsStarEMedian: float = float(
'nan')
129 """Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the sources used in the
130 shapelet decomposition.
133 shapeletsStarUnNormalizedEMedian: float = float(
'nan')
134 """Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0))
135 of the sources used in the shapelet decomposition (pixels**2).
138 refCatSourceDensity: float = float(
'nan')
139 """Source density for the detector region as computed from the loaded reference catalog
140 (number per degrees**2).
143 astromOffsetMean: float = float(
'nan')
144 """Astrometry match offset mean."""
146 astromOffsetStd: float = float(
'nan')
147 """Astrometry match offset stddev."""
150 """Number of stars used for psf model."""
152 psfStarDeltaE1Median: float = float(
'nan')
153 """Psf stars median E1 residual (starE1 - psfE1)."""
155 psfStarDeltaE2Median: float = float(
'nan')
156 """Psf stars median E2 residual (starE2 - psfE2)."""
158 psfStarDeltaE1Scatter: float = float(
'nan')
159 """Psf stars MAD E1 scatter (starE1 - psfE1)."""
161 psfStarDeltaE2Scatter: float = float(
'nan')
162 """Psf stars MAD E2 scatter (starE2 - psfE2)."""
164 psfStarDeltaSizeMedian: float = float(
'nan')
165 """Psf stars median size residual (starSize - psfSize)."""
167 psfStarDeltaSizeScatter: float = float(
'nan')
168 """Psf stars MAD size scatter (starSize - psfSize)."""
170 psfStarScaledDeltaSizeScatter: float = float(
'nan')
171 """Psf stars MAD size scatter scaled by psfSize**2."""
173 psfTraceRadiusDelta: float = float(
'nan')
174 """Delta (max - min) of the model psf trace radius values evaluated on a
175 grid of unmasked pixels (pixels).
178 psfApFluxDelta: float = float(
'nan')
179 """Delta (max - min) of the model psf aperture flux (with aperture radius of
180 max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.
183 psfApCorrSigmaScaledDelta: float = float(
'nan')
184 """Delta (max - min) of the psf flux aperture correction factors scaled (divided)
185 by the psfSigma evaluated on a grid of unmasked pixels.
188 maxDistToNearestPsf: float = float(
'nan')
189 """Maximum distance of an unmasked pixel to its nearest model psf star
193 starEMedian: float = float(
'nan')
194 """Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used
198 starUnNormalizedEMedian: float = float(
'nan')
199 """Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0))
200 of the stars used in the PSF model (pixel**2).
203 starComa1Median: float = float(
'nan')
204 """Coma-like higher-order moment combination: median M30 + M12
205 of the stars used in the PSF model.
208 starComa2Median: float = float(
'nan')
209 """Coma-like higher-order moment combination: median M21 + M03
210 of the stars used in the PSF model.
213 starTrefoil1Median: float = float(
'nan')
214 """Trefoil-like higher-order moment combination: median M30 - 3*M12
215 of the stars used in the PSF model.
218 starTrefoil2Median: float = float(
'nan')
219 """Trefoil-like higher-order moment combination: median 3*M21 - M03
220 of the stars used in the PSF model.
223 starKurtosisMedian: float = float(
'nan')
224 """Kurtosis-like higher-order moment combination: median M40 + 2*M22 + M04
225 of the stars used in the PSF model.
228 starE41Median: float = float(
'nan')
229 """Fourth-order ellipticity-like higher-order moment combination: median M40 - M04
230 of the stars used in the PSF model.
233 starE42Median: float = float(
'nan')
234 """Fourth-order ellipticity-like higher-order moment combination: median 2*(M31 + M13)
235 of the stars used in the PSF model.
238 effTime: float = float(
'nan')
239 """Effective exposure time calculated from psfSigma, skyBg, and
243 effTimePsfSigmaScale: float = float(
'nan')
244 """PSF scaling of the effective exposure time."""
246 effTimeSkyBgScale: float = float(
'nan')
247 """Sky background scaling of the effective exposure time."""
249 effTimeZeroPointScale: float = float(
'nan')
250 """Zeropoint scaling of the effective exposure time."""
252 magLim: float = float(
'nan')
253 """Magnitude limit at fixed SNR (default SNR=5) calculated from psfSigma, skyBg,
254 zeroPoint, and readNoise.
258 Storable.__init__(self)
270 return yaml.dump(dataclasses.asdict(self), encoding=
'utf-8')
274 yamlDict = yaml.load(bytes, Loader=yaml.SafeLoader)
277 forwardFieldDict = {
"decl":
"dec"}
282 for _field
in list(yamlDict.keys()):
283 if _field
not in ExposureSummaryStats.__dataclass_fields__:
284 if _field
in forwardFieldDict
and forwardFieldDict[_field]
not in yamlDict:
285 yamlDict[forwardFieldDict[_field]] = yamlDict[_field]
287 droppedFields.append(_field)
289 if len(droppedFields) > 0:
290 droppedFieldString =
", ".join([str(f)
for f
in droppedFields])
291 plural =
"s" if len(droppedFields) != 1
else ""
292 them =
"them" if len(droppedFields) > 1
else "it"
294 f
"Summary field{plural} [{droppedFieldString}] not recognized by this software version;"
295 f
" ignoring {them}.",
303 """Update an schema to includes for all summary statistic fields.
307 schema : `lsst.afw.table.Schema`
308 Schema to add which fields will be added.
313 doc=
"PSF model second-moments determinant radius (center of chip) (pixel)",
319 doc=
"PSF model effective area (center of chip) (pixel**2)",
325 doc=
"PSF model Ixx (center of chip) (pixel**2)",
331 doc=
"PSF model Iyy (center of chip) (pixel**2)",
337 doc=
"PSF model Ixy (center of chip) (pixel**2)",
344 doc=
"Right Ascension of bounding box corners (degrees)",
351 doc=
"Declination of bounding box corners (degrees)",
357 doc=
"Right Ascension of bounding box center (degrees)",
363 doc=
"Declination of bounding box center (degrees)",
369 doc=
"Zenith distance of bounding box center (degrees)",
375 doc=
"Measured detector pixel scale (arcsec/pixel)",
376 units=
"arcsec/pixel",
381 doc=
"Exposure time of the exposure (seconds)",
387 doc=
"Mean zeropoint in detector (mag)",
393 doc=
"Average sky background (ADU)",
399 doc=
"Average sky noise (ADU)",
405 doc=
"Mean variance of the weight plane (ADU**2)",
409 "psfAdaptiveThresholdValue",
411 doc=
"Threshold value used in the adaptive threshold detection pass for PSF modelling.",
415 "psfAdaptiveIncludeThresholdMultiplier",
417 doc=
"Threshold multiplier used in the adaptive threshold detection pass for PSF modelling.",
423 doc=
"Number of sources used in the shapelet decomposition.",
427 "shapeletsOnlyIqScore",
429 doc=
"The dimensionless image quality score as determined from the shapelets "
430 "decomposition that includes power only from the non-atmospheric decomposition "
431 "coefficients. The score spans the range [0.0, 1.0] with lower values indicating "
432 "better image quality.",
438 doc=
"The dimensionless image quality score as determined from the shapelets "
439 "decomposition that includes power from the median centroid offset between those "
440 "used in the decomposition and those of the centroid slot in addition to "
441 "non-atmospheric decomposition coefficients. The score spans the range [0.0, 1.0] "
442 "with lower values indicating better image quality.",
449 doc=
"List of coefficients from the PSF star shapelet decomposition.",
453 "centroidDiffShapeletsVsSlotMedian",
455 doc=
"Median centroid difference (sqrt((slot_x - shapelet_x)**2 + (slot_y - shapelet_y)**2)) "
456 "for sources used in the shapelet decomposition.",
460 "shapeletsStarEMedian",
462 doc=
"Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used in the "
463 "shapelet decomposition.",
467 "shapeletsStarUnNormalizedEMedian",
469 doc=
"Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) "
470 "of the stars used in the shapelet decomposition.",
474 "refCatSourceDensity",
476 doc=
"Source density for the detector region as computed from the loaded reference catalog "
477 "(number per degrees**2)",
483 doc=
"Mean offset of astrometric calibration matches (arcsec)",
489 doc=
"Standard deviation of offsets of astrometric calibration matches (arcsec)",
492 schema.addField(
"nPsfStar", type=
"I", doc=
"Number of stars used for PSF model")
494 "psfStarDeltaE1Median",
496 doc=
"Median E1 residual (starE1 - psfE1) for psf stars",
499 "psfStarDeltaE2Median",
501 doc=
"Median E2 residual (starE2 - psfE2) for psf stars",
504 "psfStarDeltaE1Scatter",
506 doc=
"Scatter (via MAD) of E1 residual (starE1 - psfE1) for psf stars",
509 "psfStarDeltaE2Scatter",
511 doc=
"Scatter (via MAD) of E2 residual (starE2 - psfE2) for psf stars",
514 "psfStarDeltaSizeMedian",
516 doc=
"Median size residual (starSize - psfSize) for psf stars (pixel)",
520 "psfStarDeltaSizeScatter",
522 doc=
"Scatter (via MAD) of size residual (starSize - psfSize) for psf stars (pixel)",
526 "psfStarScaledDeltaSizeScatter",
528 doc=
"Scatter (via MAD) of size residual scaled by median size squared",
531 "psfTraceRadiusDelta",
533 doc=
"Delta (max - min) of the model psf trace radius values evaluated on a grid of "
534 "unmasked pixels (pixel).",
540 doc=
"Delta (max - min) of the model psf aperture flux (with aperture radius of "
541 "max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.",
544 "psfApCorrSigmaScaledDelta",
546 doc=
"Delta (max - min) of the model psf aperture correction factors scaled (divided) "
547 "by the psfSigma evaluated on a grid of unmasked pixels.",
550 "maxDistToNearestPsf",
552 doc=
"Maximum distance of an unmasked pixel to its nearest model psf star (pixel).",
558 doc=
"Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used in "
562 "starUnNormalizedEMedian",
564 doc=
"Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) "
565 "of the stars used in the PSF model.",
570 doc=
"Coma-like higher-order moment combination: median M30 + M12 "
571 "of the stars used in the PSF model.",
576 doc=
"Coma-like higher-order moment combination: median M21 + M03 "
577 "of the stars used in the PSF model.",
580 "starTrefoil1Median",
582 doc=
"Trefoil-like higher-order moment combination: median M30 - 3*M12 "
583 "of the stars used in the PSF model.",
586 "starTrefoil2Median",
588 doc=
"Trefoil-like higher-order moment combination: median 3*M21 - M03 "
589 "of the stars used in the PSF model.",
592 "starKurtosisMedian",
594 doc=
"Kurtosis-like higher-order moment combination: median M40 + 2*M22 + M04 "
595 "of the stars used in the PSF model.",
600 doc=
"Fourth-order ellipticity-like higher-order moment combination: median M40 - M04 "
601 "of the stars used in the PSF model.",
606 doc=
"Fourth-order ellipticity-like higher-order moment combination: median 2*(M31 + M13) "
607 "of the stars used in the PSF model.",
612 doc=
"Effective exposure time calculated from psfSigma, skyBg, and "
613 "zeroPoint (seconds).",
617 "effTimePsfSigmaScale",
619 doc=
"PSF scaling of the effective exposure time."
624 doc=
"Sky background scaling of the effective exposure time."
627 "effTimeZeroPointScale",
629 doc=
"Zeropoint scaling of the effective exposure time."
634 doc=
"Magnitude limit at SNR=5 (M5) calculated from psfSigma, "
635 "skyBg, zeroPoint, and readNoise.",
640 """Write summary-statistic columns into a record.
644 record : `lsst.afw.table.BaseRecord`
645 Record to update. This is expected to frequently be an
646 `ExposureRecord` instance (with higher-level code adding other
647 columns and objects), but this method can work with any record
650 for field
in dataclasses.fields(self):
651 value = getattr(self, field.name)
652 if field.name ==
"version":
654 elif field.type.startswith(
"list"):
655 record[field.name] = np.array(value, dtype=record[field.name].dtype)
657 record[field.name] = value
661 """Read summary-statistic columns from a record into ``self``.
665 record : `lsst.afw.table.BaseRecord`
666 Record to read from. This is expected to frequently be an
667 `ExposureRecord` instance (with higher-level code adding other
668 columns and objects), but this method can work with any record
669 type, ignoring any attributes or columns it doesn't recognize.
673 summary : `ExposureSummaryStats`
674 Summary statistics object created from the given record.
679 record[field.name]
if not field.type.startswith(
"list")
680 else [float(v)
for v
in record[field.name]]
682 for field
in dataclasses.fields(cls)
683 if field.name !=
"version"