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 zenithDistance: float = float(
'nan')
70 """Bounding box center zenith distance (degrees)."""
72 zeroPoint: float = float(
'nan')
73 """Mean zeropoint in detector (mag)."""
75 skyBg: float = float(
'nan')
76 """Average sky background (ADU)."""
78 skyNoise: float = float(
'nan')
79 """Average sky noise (ADU)."""
81 meanVar: float = float(
'nan')
82 """Mean variance of the weight plane (ADU**2)."""
84 raCorners: list[float] = dataclasses.field(default_factory=_default_corners)
85 """Right Ascension of bounding box corners (degrees)."""
87 decCorners: list[float] = dataclasses.field(default_factory=_default_corners)
88 """Declination of bounding box corners (degrees)."""
90 astromOffsetMean: float = float(
'nan')
91 """Astrometry match offset mean."""
93 astromOffsetStd: float = float(
'nan')
94 """Astrometry match offset stddev."""
97 """Number of stars used for psf model."""
99 psfStarDeltaE1Median: float = float(
'nan')
100 """Psf stars median E1 residual (starE1 - psfE1)."""
102 psfStarDeltaE2Median: float = float(
'nan')
103 """Psf stars median E2 residual (starE2 - psfE2)."""
105 psfStarDeltaE1Scatter: float = float(
'nan')
106 """Psf stars MAD E1 scatter (starE1 - psfE1)."""
108 psfStarDeltaE2Scatter: float = float(
'nan')
109 """Psf stars MAD E2 scatter (starE2 - psfE2)."""
111 psfStarDeltaSizeMedian: float = float(
'nan')
112 """Psf stars median size residual (starSize - psfSize)."""
114 psfStarDeltaSizeScatter: float = float(
'nan')
115 """Psf stars MAD size scatter (starSize - psfSize)."""
117 psfStarScaledDeltaSizeScatter: float = float(
'nan')
118 """Psf stars MAD size scatter scaled by psfSize**2."""
120 psfTraceRadiusDelta: float = float(
'nan')
121 """Delta (max - min) of the model psf trace radius values evaluated on a
122 grid of unmasked pixels (pixels).
125 maxDistToNearestPsf: float = float(
'nan')
126 """Maximum distance of an unmasked pixel to its nearest model psf star
130 effTime: float = float(
'nan')
131 """Effective exposure time calculated from psfSigma, skyBg, and
135 effTimePsfSigmaScale: float = float(
'nan')
136 """PSF scaling of the effective exposure time."""
138 effTimeSkyBgScale: float = float(
'nan')
139 """Sky background scaling of the effective exposure time."""
141 effTimeZeroPointScale: float = float(
'nan')
142 """Zeropoint scaling of the effective exposure time."""
145 Storable.__init__(self)
157 return yaml.dump(dataclasses.asdict(self), encoding=
'utf-8')
161 yamlDict = yaml.load(bytes, Loader=yaml.SafeLoader)
164 forwardFieldDict = {
"decl":
"dec"}
169 for _field
in list(yamlDict.keys()):
170 if _field
not in ExposureSummaryStats.__dataclass_fields__:
171 if _field
in forwardFieldDict
and forwardFieldDict[_field]
not in yamlDict:
172 yamlDict[forwardFieldDict[_field]] = yamlDict[_field]
174 droppedFields.append(_field)
176 if len(droppedFields) > 0:
177 droppedFieldString =
", ".join([str(f)
for f
in droppedFields])
178 plural =
"s" if len(droppedFields) != 1
else ""
179 them =
"them" if len(droppedFields) > 1
else "it"
181 f
"Summary field{plural} [{droppedFieldString}] not recognized by this software version;"
182 f
" ignoring {them}.",
190 """Update an schema to includes for all summary statistic fields.
194 schema : `lsst.afw.table.Schema`
195 Schema to add which fields will be added.
200 doc=
"PSF model second-moments determinant radius (center of chip) (pixel)",
206 doc=
"PSF model effective area (center of chip) (pixel**2)",
212 doc=
"PSF model Ixx (center of chip) (pixel**2)",
218 doc=
"PSF model Iyy (center of chip) (pixel**2)",
224 doc=
"PSF model Ixy (center of chip) (pixel**2)",
231 doc=
"Right Ascension of bounding box corners (degrees)",
238 doc=
"Declination of bounding box corners (degrees)",
244 doc=
"Right Ascension of bounding box center (degrees)",
250 doc=
"Declination of bounding box center (degrees)",
256 doc=
"Zenith distance of bounding box center (degrees)",
262 doc=
"Mean zeropoint in detector (mag)",
268 doc=
"Average sky background (ADU)",
274 doc=
"Average sky noise (ADU)",
280 doc=
"Mean variance of the weight plane (ADU**2)",
286 doc=
"Mean offset of astrometric calibration matches (arcsec)",
292 doc=
"Standard deviation of offsets of astrometric calibration matches (arcsec)",
295 schema.addField(
"nPsfStar", type=
"I", doc=
"Number of stars used for PSF model")
297 "psfStarDeltaE1Median",
299 doc=
"Median E1 residual (starE1 - psfE1) for psf stars",
302 "psfStarDeltaE2Median",
304 doc=
"Median E2 residual (starE2 - psfE2) for psf stars",
307 "psfStarDeltaE1Scatter",
309 doc=
"Scatter (via MAD) of E1 residual (starE1 - psfE1) for psf stars",
312 "psfStarDeltaE2Scatter",
314 doc=
"Scatter (via MAD) of E2 residual (starE2 - psfE2) for psf stars",
317 "psfStarDeltaSizeMedian",
319 doc=
"Median size residual (starSize - psfSize) for psf stars (pixel)",
323 "psfStarDeltaSizeScatter",
325 doc=
"Scatter (via MAD) of size residual (starSize - psfSize) for psf stars (pixel)",
329 "psfStarScaledDeltaSizeScatter",
331 doc=
"Scatter (via MAD) of size residual scaled by median size squared",
334 "psfTraceRadiusDelta",
336 doc=
"Delta (max - min) of the model psf trace radius values evaluated on a grid of "
337 "unmasked pixels (pixel).",
341 "maxDistToNearestPsf",
343 doc=
"Maximum distance of an unmasked pixel to its nearest model psf star (pixel).",
349 doc=
"Effective exposure time calculated from psfSigma, skyBg, and "
350 "zeroPoint (seconds).",
354 "effTimePsfSigmaScale",
356 doc=
"PSF scaling of the effective exposure time."
361 doc=
"Sky background scaling of the effective exposure time."
364 "effTimeZeroPointScale",
366 doc=
"Zeropoint scaling of the effective exposure time."
370 """Write summary-statistic columns into a record.
374 record : `lsst.afw.table.BaseRecord`
375 Record to update. This is expected to frequently be an
376 `ExposureRecord` instance (with higher-level code adding other
377 columns and objects), but this method can work with any record
380 for field
in dataclasses.fields(self):
381 value = getattr(self, field.name)
382 if field.name ==
"version":
384 elif field.type.startswith(
"list"):
385 record[field.name][:] = value
387 record[field.name] = value
391 """Read summary-statistic columns from a record into ``self``.
395 record : `lsst.afw.table.BaseRecord`
396 Record to read from. This is expected to frequently be an
397 `ExposureRecord` instance (with higher-level code adding other
398 columns and objects), but this method can work with any record
399 type, ignoring any attributes or columns it doesn't recognize.
403 summary : `ExposureSummaryStats`
404 Summary statistics object created from the given record.
409 record[field.name]
if not field.type.startswith(
"list")
410 else [float(v)
for v
in record[field.name]]
412 for field
in dataclasses.fields(cls)
413 if field.name !=
"version"