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 effTime: float = float(
'nan')
158 """Effective exposure time calculated from psfSigma, skyBg, and
162 effTimePsfSigmaScale: float = float(
'nan')
163 """PSF scaling of the effective exposure time."""
165 effTimeSkyBgScale: float = float(
'nan')
166 """Sky background scaling of the effective exposure time."""
168 effTimeZeroPointScale: float = float(
'nan')
169 """Zeropoint scaling of the effective exposure time."""
171 magLim: float = float(
'nan')
172 """Magnitude limit at fixed SNR (default SNR=5) calculated from psfSigma, skyBg,
173 zeroPoint, and readNoise.
177 Storable.__init__(self)
189 return yaml.dump(dataclasses.asdict(self), encoding=
'utf-8')
193 yamlDict = yaml.load(bytes, Loader=yaml.SafeLoader)
196 forwardFieldDict = {
"decl":
"dec"}
201 for _field
in list(yamlDict.keys()):
202 if _field
not in ExposureSummaryStats.__dataclass_fields__:
203 if _field
in forwardFieldDict
and forwardFieldDict[_field]
not in yamlDict:
204 yamlDict[forwardFieldDict[_field]] = yamlDict[_field]
206 droppedFields.append(_field)
208 if len(droppedFields) > 0:
209 droppedFieldString =
", ".join([str(f)
for f
in droppedFields])
210 plural =
"s" if len(droppedFields) != 1
else ""
211 them =
"them" if len(droppedFields) > 1
else "it"
213 f
"Summary field{plural} [{droppedFieldString}] not recognized by this software version;"
214 f
" ignoring {them}.",
222 """Update an schema to includes for all summary statistic fields.
226 schema : `lsst.afw.table.Schema`
227 Schema to add which fields will be added.
232 doc=
"PSF model second-moments determinant radius (center of chip) (pixel)",
238 doc=
"PSF model effective area (center of chip) (pixel**2)",
244 doc=
"PSF model Ixx (center of chip) (pixel**2)",
250 doc=
"PSF model Iyy (center of chip) (pixel**2)",
256 doc=
"PSF model Ixy (center of chip) (pixel**2)",
263 doc=
"Right Ascension of bounding box corners (degrees)",
270 doc=
"Declination of bounding box corners (degrees)",
276 doc=
"Right Ascension of bounding box center (degrees)",
282 doc=
"Declination of bounding box center (degrees)",
288 doc=
"Zenith distance of bounding box center (degrees)",
294 doc=
"Measured detector pixel scale (arcsec/pixel)",
295 units=
"arcsec/pixel",
300 doc=
"Exposure time of the exposure (seconds)",
306 doc=
"Mean zeropoint in detector (mag)",
312 doc=
"Average sky background (ADU)",
318 doc=
"Average sky noise (ADU)",
324 doc=
"Mean variance of the weight plane (ADU**2)",
330 doc=
"Mean offset of astrometric calibration matches (arcsec)",
336 doc=
"Standard deviation of offsets of astrometric calibration matches (arcsec)",
339 schema.addField(
"nPsfStar", type=
"I", doc=
"Number of stars used for PSF model")
341 "psfStarDeltaE1Median",
343 doc=
"Median E1 residual (starE1 - psfE1) for psf stars",
346 "psfStarDeltaE2Median",
348 doc=
"Median E2 residual (starE2 - psfE2) for psf stars",
351 "psfStarDeltaE1Scatter",
353 doc=
"Scatter (via MAD) of E1 residual (starE1 - psfE1) for psf stars",
356 "psfStarDeltaE2Scatter",
358 doc=
"Scatter (via MAD) of E2 residual (starE2 - psfE2) for psf stars",
361 "psfStarDeltaSizeMedian",
363 doc=
"Median size residual (starSize - psfSize) for psf stars (pixel)",
367 "psfStarDeltaSizeScatter",
369 doc=
"Scatter (via MAD) of size residual (starSize - psfSize) for psf stars (pixel)",
373 "psfStarScaledDeltaSizeScatter",
375 doc=
"Scatter (via MAD) of size residual scaled by median size squared",
378 "psfTraceRadiusDelta",
380 doc=
"Delta (max - min) of the model psf trace radius values evaluated on a grid of "
381 "unmasked pixels (pixel).",
387 doc=
"Delta (max - min) of the model psf aperture flux (with aperture radius of "
388 "max(2, 3*psfSigma)) values evaluated on a grid of unmasked pixels.",
391 "psfApCorrSigmaScaledDelta",
393 doc=
"Delta (max - min) of the model psf aperture correction factors scaled (divided) "
394 "by the psfSigma evaluated on a grid of unmasked pixels.",
397 "maxDistToNearestPsf",
399 doc=
"Maximum distance of an unmasked pixel to its nearest model psf star (pixel).",
405 doc=
"Median ellipticity (sqrt(starE1**2.0 + starE2**2.0)) of the stars used in "
409 "starUnNormalizedEMedian",
411 doc=
"Median un-normalized ellipticity (sqrt((starXX - starYY)**2.0 + (2.0*starXY)**2.0)) "
412 "of the stars used in the PSF model.",
417 doc=
"Effective exposure time calculated from psfSigma, skyBg, and "
418 "zeroPoint (seconds).",
422 "effTimePsfSigmaScale",
424 doc=
"PSF scaling of the effective exposure time."
429 doc=
"Sky background scaling of the effective exposure time."
432 "effTimeZeroPointScale",
434 doc=
"Zeropoint scaling of the effective exposure time."
439 doc=
"Magnitude limit at SNR=5 (M5) calculated from psfSigma, "
440 "skyBg, zeroPoint, and readNoise.",
445 """Write summary-statistic columns into a record.
449 record : `lsst.afw.table.BaseRecord`
450 Record to update. This is expected to frequently be an
451 `ExposureRecord` instance (with higher-level code adding other
452 columns and objects), but this method can work with any record
455 for field
in dataclasses.fields(self):
456 value = getattr(self, field.name)
457 if field.name ==
"version":
459 elif field.type.startswith(
"list"):
460 record[field.name][:] = value
462 record[field.name] = value
466 """Read summary-statistic columns from a record into ``self``.
470 record : `lsst.afw.table.BaseRecord`
471 Record to read from. This is expected to frequently be an
472 `ExposureRecord` instance (with higher-level code adding other
473 columns and objects), but this method can work with any record
474 type, ignoring any attributes or columns it doesn't recognize.
478 summary : `ExposureSummaryStats`
479 Summary statistics object created from the given record.
484 record[field.name]
if not field.type.startswith(
"list")
485 else [float(v)
for v
in record[field.name]]
487 for field
in dataclasses.fields(cls)
488 if field.name !=
"version"