dkist-processing-common 11.7.1rc1__py3-none-any.whl → 11.8.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- changelog/245.feature.1.rst +1 -0
- dkist_processing_common/models/constants.py +333 -21
- dkist_processing_common/models/fits_access.py +16 -25
- dkist_processing_common/parsers/average_bud.py +48 -0
- dkist_processing_common/parsers/experiment_id_bud.py +8 -4
- dkist_processing_common/parsers/id_bud.py +35 -19
- dkist_processing_common/parsers/l0_fits_access.py +3 -3
- dkist_processing_common/parsers/l1_fits_access.py +47 -21
- dkist_processing_common/parsers/near_bud.py +4 -4
- dkist_processing_common/parsers/observing_program_id_bud.py +24 -0
- dkist_processing_common/parsers/proposal_id_bud.py +11 -5
- dkist_processing_common/parsers/single_value_single_key_flower.py +0 -1
- dkist_processing_common/parsers/time.py +147 -27
- dkist_processing_common/tasks/mixin/quality/_metrics.py +6 -4
- dkist_processing_common/tasks/parse_l0_input_data.py +246 -1
- dkist_processing_common/tasks/trial_catalog.py +38 -0
- dkist_processing_common/tests/mock_metadata_store.py +39 -0
- dkist_processing_common/tests/test_fits_access.py +19 -44
- dkist_processing_common/tests/test_input_dataset.py +1 -37
- dkist_processing_common/tests/test_parse_l0_input_data.py +45 -5
- dkist_processing_common/tests/test_quality_mixin.py +3 -11
- dkist_processing_common/tests/test_stems.py +162 -10
- dkist_processing_common/tests/test_task_parsing.py +6 -6
- dkist_processing_common/tests/test_trial_catalog.py +72 -2
- {dkist_processing_common-11.7.1rc1.dist-info → dkist_processing_common-11.8.0rc1.dist-info}/METADATA +5 -5
- {dkist_processing_common-11.7.1rc1.dist-info → dkist_processing_common-11.8.0rc1.dist-info}/RECORD +28 -26
- changelog/271.misc.rst +0 -1
- {dkist_processing_common-11.7.1rc1.dist-info → dkist_processing_common-11.8.0rc1.dist-info}/WHEEL +0 -0
- {dkist_processing_common-11.7.1rc1.dist-info → dkist_processing_common-11.8.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Add parameters and their associated values relevant to a particular processing pipeline run to the metadata ASDF file generated in trial workflows.
|
|
@@ -6,6 +6,7 @@ accessing the database (tab completion, etc.)
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
from enum import StrEnum
|
|
9
|
+
from enum import unique
|
|
9
10
|
from string import ascii_uppercase
|
|
10
11
|
|
|
11
12
|
from sqids import Sqids
|
|
@@ -13,6 +14,7 @@ from sqids import Sqids
|
|
|
13
14
|
from dkist_processing_common._util.constants import ConstantsDb
|
|
14
15
|
|
|
15
16
|
|
|
17
|
+
@unique
|
|
16
18
|
class BudName(StrEnum):
|
|
17
19
|
"""Controlled list of names for constant stems (buds)."""
|
|
18
20
|
|
|
@@ -33,6 +35,58 @@ class BudName(StrEnum):
|
|
|
33
35
|
dark_exposure_times = "DARK_EXPOSURE_TIMES"
|
|
34
36
|
dark_readout_exp_times = "DARK_READOUT_EXP_TIMES"
|
|
35
37
|
wavelength = "WAVELENGTH"
|
|
38
|
+
camera_id = "CAMERA_ID"
|
|
39
|
+
camera_name = "CAMERA_NAME"
|
|
40
|
+
camera_bit_depth = "CAMERA_BIT_DEPTH"
|
|
41
|
+
hardware_binning_x = "HARDWARE_BINNING_X"
|
|
42
|
+
hardware_binning_y = "HARDWARE_BINNING_Y"
|
|
43
|
+
software_binning_x = "SOFTWARE_BINNING_X"
|
|
44
|
+
software_binning_y = "SOFTWARE_BINNING_Y"
|
|
45
|
+
hls_version = "HLS_VERSION"
|
|
46
|
+
# Multi-task buds start here:
|
|
47
|
+
dark_observing_program_execution_ids = "DARK_OBSERVING_PROGRAM_EXECUTION_IDS"
|
|
48
|
+
solar_gain_observing_program_execution_ids = "SOLAR_GAIN_OBSERVING_PROGRAM_EXECUTION_IDS"
|
|
49
|
+
polcal_observing_program_execution_ids = "POLCAL_OBSERVING_PROGRAM_EXECUTION_IDS"
|
|
50
|
+
dark_date_begin = "DARK_DATE_BEGIN"
|
|
51
|
+
solar_gain_date_begin = "SOLAR_GAIN_DATE_BEGIN"
|
|
52
|
+
polcal_date_begin = "POLCAL_DATE_BEGIN"
|
|
53
|
+
dark_date_end = "DARK_DATE_END"
|
|
54
|
+
solar_gain_date_end = "SOLAR_GAIN_DATE_END"
|
|
55
|
+
polcal_date_end = "POLCAL_DATE_END"
|
|
56
|
+
solar_gain_num_raw_frames_per_fpa = "SOLAR_GAIN_NUM_RAW_FRAMES_PER_FPA"
|
|
57
|
+
polcal_num_raw_frames_per_fpa = "POLCAL_NUM_RAW_FRAMES_PER_FPA"
|
|
58
|
+
solar_gain_telescope_tracking_mode = "SOLAR_GAIN_TELESCOPE_TRACKING_MODE"
|
|
59
|
+
polcal_telescope_tracking_mode = "POLCAL_TELESCOPE_TRACKING_MODE"
|
|
60
|
+
solar_gain_coude_table_tracking_mode = "SOLAR_GAIN_COUDE_TABLE_TRACKING_MODE"
|
|
61
|
+
polcal_coude_table_tracking_mode = "POLCAL_COUDE_TABLE_TRACKING_MODE"
|
|
62
|
+
solar_gain_telescope_scanning_mode = "SOLAR_GAIN_TELESCOPE_SCANNING_MODE"
|
|
63
|
+
polcal_telescope_scanning_mode = "POLCAL_TELESCOPE_SCANNING_MODE"
|
|
64
|
+
dark_average_light_level = "DARK_AVERAGE_LIGHT_LEVEL"
|
|
65
|
+
solar_gain_average_light_level = "SOLAR_GAIN_AVERAGE_LIGHT_LEVEL"
|
|
66
|
+
polcal_average_light_level = "POLCAL_AVERAGE_LIGHT_LEVEL"
|
|
67
|
+
dark_average_telescope_elevation = "DARK_AVERAGE_TELESCOPE_ELEVATION"
|
|
68
|
+
solar_gain_average_telescope_elevation = "SOLAR_GAIN_AVERAGE_TELESCOPE_ELEVATION"
|
|
69
|
+
polcal_average_telescope_elevation = "POLCAL_AVERAGE_TELESCOPE_ELEVATION"
|
|
70
|
+
dark_average_coude_table_angle = "DARK_AVERAGE_COUDE_TABLE_ANGLE"
|
|
71
|
+
solar_gain_average_coude_table_angle = "SOLAR_GAIN_AVERAGE_COUDE_TABLE_ANGLE"
|
|
72
|
+
polcal_average_coude_table_angle = "POLCAL_AVERAGE_COUDE_TABLE_ANGLE"
|
|
73
|
+
dark_average_telescope_azimuth = "DARK_AVERAGE_TELESCOPE_AZIMUTH"
|
|
74
|
+
solar_gain_average_telescope_azimuth = "SOLAR_GAIN_AVERAGE_TELESCOPE_AZIMUTH"
|
|
75
|
+
polcal_average_telescope_azimuth = "POLCAL_AVERAGE_TELESCOPE_AZIMUTH"
|
|
76
|
+
dark_gos_level3_status = "DARK_GOS_LEVEL3_STATUS"
|
|
77
|
+
solar_gain_gos_level3_status = "SOLAR_GAIN_GOS_LEVEL3_STATUS"
|
|
78
|
+
dark_gos_level3_lamp_status = "DARK_GOS_LEVEL3_LAMP_STATUS"
|
|
79
|
+
solar_gain_gos_level3_lamp_status = "SOLAR_GAIN_GOS_LEVEL3_LAMP_STATUS"
|
|
80
|
+
dark_gos_polarizer_status = "DARK_GOS_POLARIZER_STATUS"
|
|
81
|
+
solar_gain_gos_polarizer_status = "SOLAR_GAIN_GOS_POLARIZER_STATUS"
|
|
82
|
+
dark_gos_polarizer_angle = "DARK_GOS_POLARIZER_ANGLE"
|
|
83
|
+
solar_gain_gos_polarizer_angle = "SOLAR_GAIN_GOS_POLARIZER_ANGLE"
|
|
84
|
+
dark_gos_retarder_status = "DARK_GOS_RETARDER_STATUS"
|
|
85
|
+
solar_gain_gos_retarder_status = "SOLAR_GAIN_GOS_RETARDER_STATUS"
|
|
86
|
+
dark_gos_retarder_angle = "DARK_GOS_RETARDER_ANGLE"
|
|
87
|
+
solar_gain_gos_retarder_angle = "SOLAR_GAIN_GOS_RETARDER_ANGLE"
|
|
88
|
+
dark_gos_level0_status = "DARK_GOS_LEVEL0_STATUS"
|
|
89
|
+
solar_gain_gos_level0_status = "SOLAR_GAIN_GOS_LEVEL0_STATUS"
|
|
36
90
|
|
|
37
91
|
|
|
38
92
|
class ConstantsBase:
|
|
@@ -87,11 +141,11 @@ class ConstantsBase:
|
|
|
87
141
|
|
|
88
142
|
@property
|
|
89
143
|
def dataset_id(self) -> str:
|
|
90
|
-
"""Define the
|
|
144
|
+
"""Define the dataset id constant."""
|
|
91
145
|
return Sqids(min_length=6, alphabet=ascii_uppercase).encode([self._recipe_run_id])
|
|
92
146
|
|
|
93
147
|
@property
|
|
94
|
-
def stokes_params(self) -> [str]:
|
|
148
|
+
def stokes_params(self) -> list[str]:
|
|
95
149
|
"""Return the list of stokes parameter names."""
|
|
96
150
|
return ["I", "Q", "U", "V"]
|
|
97
151
|
|
|
@@ -101,45 +155,41 @@ class ConstantsBase:
|
|
|
101
155
|
return self._db_dict[BudName.instrument]
|
|
102
156
|
|
|
103
157
|
@property
|
|
104
|
-
def num_cs_steps(self):
|
|
158
|
+
def num_cs_steps(self) -> int:
|
|
105
159
|
"""Get the number of calibration sequence steps."""
|
|
106
160
|
return self._db_dict[BudName.num_cs_steps]
|
|
107
161
|
|
|
108
162
|
@property
|
|
109
|
-
def num_modstates(self):
|
|
163
|
+
def num_modstates(self) -> int:
|
|
110
164
|
"""Get the number of modulation states."""
|
|
111
165
|
return self._db_dict[BudName.num_modstates]
|
|
112
166
|
|
|
113
167
|
@property
|
|
114
|
-
def retarder_name(self):
|
|
168
|
+
def retarder_name(self) -> str:
|
|
115
169
|
"""Get the retarder name."""
|
|
116
170
|
return self._db_dict[BudName.retarder_name]
|
|
117
171
|
|
|
118
172
|
@property
|
|
119
173
|
def proposal_id(self) -> str:
|
|
120
|
-
"""Get the
|
|
174
|
+
"""Get the proposal ID constant."""
|
|
121
175
|
return self._db_dict[BudName.proposal_id]
|
|
122
176
|
|
|
123
177
|
@property
|
|
124
|
-
def contributing_proposal_ids(self) -> [str]:
|
|
178
|
+
def contributing_proposal_ids(self) -> list[str]:
|
|
125
179
|
"""Return the list of contributing proposal IDs."""
|
|
126
180
|
proposal_ids = self._db_dict[BudName.contributing_proposal_ids]
|
|
127
|
-
|
|
128
|
-
return [proposal_ids]
|
|
129
|
-
return proposal_ids
|
|
181
|
+
return list(proposal_ids)
|
|
130
182
|
|
|
131
183
|
@property
|
|
132
184
|
def experiment_id(self) -> str:
|
|
133
|
-
"""Get the
|
|
185
|
+
"""Get the experiment ID constant."""
|
|
134
186
|
return self._db_dict[BudName.experiment_id]
|
|
135
187
|
|
|
136
188
|
@property
|
|
137
|
-
def contributing_experiment_ids(self) -> [str]:
|
|
189
|
+
def contributing_experiment_ids(self) -> list[str]:
|
|
138
190
|
"""Return the list of contributing experiment IDs."""
|
|
139
191
|
experiment_ids = self._db_dict[BudName.contributing_experiment_ids]
|
|
140
|
-
|
|
141
|
-
return [experiment_ids]
|
|
142
|
-
return experiment_ids
|
|
192
|
+
return list(experiment_ids)
|
|
143
193
|
|
|
144
194
|
@property
|
|
145
195
|
def obs_ip_start_time(self) -> str:
|
|
@@ -148,7 +198,7 @@ class ConstantsBase:
|
|
|
148
198
|
|
|
149
199
|
@property
|
|
150
200
|
def average_cadence(self) -> float:
|
|
151
|
-
"""Get the
|
|
201
|
+
"""Get the average cadence constant."""
|
|
152
202
|
return self._db_dict[BudName.average_cadence]
|
|
153
203
|
|
|
154
204
|
@property
|
|
@@ -172,16 +222,278 @@ class ConstantsBase:
|
|
|
172
222
|
return self._db_dict[BudName.num_dsps_repeats]
|
|
173
223
|
|
|
174
224
|
@property
|
|
175
|
-
def dark_exposure_times(self) -> [float]:
|
|
225
|
+
def dark_exposure_times(self) -> list[float]:
|
|
176
226
|
"""Get a list of exposure times used in the dark calibration."""
|
|
177
|
-
|
|
227
|
+
exposure_times = self._db_dict[BudName.dark_exposure_times]
|
|
228
|
+
return list(exposure_times)
|
|
178
229
|
|
|
179
230
|
@property
|
|
180
|
-
def dark_readout_exp_times(self) -> [float]:
|
|
181
|
-
"""Get a list of readout exp times for all
|
|
182
|
-
|
|
231
|
+
def dark_readout_exp_times(self) -> list[float]:
|
|
232
|
+
"""Get a list of readout exp times for all dark frames."""
|
|
233
|
+
readout_times = self._db_dict[BudName.dark_readout_exp_times]
|
|
234
|
+
return list(readout_times)
|
|
183
235
|
|
|
184
236
|
@property
|
|
185
237
|
def wavelength(self) -> float:
|
|
186
238
|
"""Wavelength."""
|
|
187
239
|
return self._db_dict[BudName.wavelength]
|
|
240
|
+
|
|
241
|
+
@property
|
|
242
|
+
def camera_id(self) -> str:
|
|
243
|
+
"""Return the camera ID constant."""
|
|
244
|
+
return self._db_dict[BudName.camera_id]
|
|
245
|
+
|
|
246
|
+
@property
|
|
247
|
+
def camera_name(self) -> str:
|
|
248
|
+
"""Return the camera name for humans constant."""
|
|
249
|
+
return self._db_dict[BudName.camera_name]
|
|
250
|
+
|
|
251
|
+
@property
|
|
252
|
+
def camera_bit_depth(self) -> int:
|
|
253
|
+
"""Return the camera bit depth constant."""
|
|
254
|
+
return self._db_dict[BudName.camera_bit_depth]
|
|
255
|
+
|
|
256
|
+
@property
|
|
257
|
+
def hardware_binning_x(self) -> int:
|
|
258
|
+
"""Return the x-direction hardware binning constant."""
|
|
259
|
+
return self._db_dict[BudName.hardware_binning_x]
|
|
260
|
+
|
|
261
|
+
@property
|
|
262
|
+
def hardware_binning_y(self) -> int:
|
|
263
|
+
"""Return the y-direction hardware binning constant."""
|
|
264
|
+
return self._db_dict[BudName.hardware_binning_y]
|
|
265
|
+
|
|
266
|
+
@property
|
|
267
|
+
def software_binning_x(self) -> int:
|
|
268
|
+
"""Return the x-direction software binning constant."""
|
|
269
|
+
return self._db_dict[BudName.software_binning_x]
|
|
270
|
+
|
|
271
|
+
@property
|
|
272
|
+
def software_binning_y(self) -> int:
|
|
273
|
+
"""Return the y-direction software binning constant."""
|
|
274
|
+
return self._db_dict[BudName.software_binning_y]
|
|
275
|
+
|
|
276
|
+
@property
|
|
277
|
+
def hls_version(self) -> str:
|
|
278
|
+
"""Return the High-Level Software version."""
|
|
279
|
+
return self._db_dict[BudName.hls_version]
|
|
280
|
+
|
|
281
|
+
# Multi-task constants start here:
|
|
282
|
+
|
|
283
|
+
@property
|
|
284
|
+
def dark_observing_program_execution_ids(self) -> list[str]:
|
|
285
|
+
"""Return the observing program execution ids constant for the dark task."""
|
|
286
|
+
observing_programs = self._db_dict[BudName.dark_observing_program_execution_ids]
|
|
287
|
+
return list(observing_programs)
|
|
288
|
+
|
|
289
|
+
@property
|
|
290
|
+
def solar_gain_observing_program_execution_ids(self) -> list[str]:
|
|
291
|
+
"""Return the observing program execution ids constant for the solar_gain task."""
|
|
292
|
+
observing_programs = self._db_dict[BudName.solar_gain_observing_program_execution_ids]
|
|
293
|
+
return list(observing_programs)
|
|
294
|
+
|
|
295
|
+
@property
|
|
296
|
+
def polcal_observing_program_execution_ids(self) -> list[str]:
|
|
297
|
+
"""Return the observing program execution ids constant."""
|
|
298
|
+
observing_programs = self._db_dict[BudName.polcal_observing_program_execution_ids]
|
|
299
|
+
return list(observing_programs)
|
|
300
|
+
|
|
301
|
+
@property
|
|
302
|
+
def dark_date_begin(self) -> str:
|
|
303
|
+
"""Return the date begin header constant for the dark task."""
|
|
304
|
+
return self._db_dict[BudName.dark_date_begin]
|
|
305
|
+
|
|
306
|
+
@property
|
|
307
|
+
def solar_gain_date_begin(self) -> str:
|
|
308
|
+
"""Return the date begin header constant for the solar gain task."""
|
|
309
|
+
return self._db_dict[BudName.solar_gain_date_begin]
|
|
310
|
+
|
|
311
|
+
@property
|
|
312
|
+
def polcal_date_begin(self) -> str:
|
|
313
|
+
"""Return the time obs header constant for the polcal task."""
|
|
314
|
+
return self._db_dict[BudName.polcal_date_begin]
|
|
315
|
+
|
|
316
|
+
@property
|
|
317
|
+
def dark_date_end(self) -> str:
|
|
318
|
+
"""Return the date end constant for the dark task."""
|
|
319
|
+
return self._db_dict[BudName.dark_date_end]
|
|
320
|
+
|
|
321
|
+
@property
|
|
322
|
+
def solar_gain_date_end(self) -> str:
|
|
323
|
+
"""Return the date end constant for the solar gain task."""
|
|
324
|
+
return self._db_dict[BudName.solar_gain_date_end]
|
|
325
|
+
|
|
326
|
+
@property
|
|
327
|
+
def polcal_date_end(self) -> str:
|
|
328
|
+
"""Return the date end constant for the polcal task."""
|
|
329
|
+
return self._db_dict[BudName.polcal_date_end]
|
|
330
|
+
|
|
331
|
+
@property
|
|
332
|
+
def solar_gain_num_raw_frames_per_fpa(self) -> int:
|
|
333
|
+
"""Return the number of raw frames per fpa constant for the solar gain task."""
|
|
334
|
+
return self._db_dict[BudName.solar_gain_num_raw_frames_per_fpa]
|
|
335
|
+
|
|
336
|
+
@property
|
|
337
|
+
def polcal_num_raw_frames_per_fpa(self) -> int:
|
|
338
|
+
"""Return the num raw frames per fpa constant for the polcal task."""
|
|
339
|
+
return self._db_dict[BudName.polcal_num_raw_frames_per_fpa]
|
|
340
|
+
|
|
341
|
+
@property
|
|
342
|
+
def solar_gain_telescope_tracking_mode(self) -> str:
|
|
343
|
+
"""Return the telescope tracking mode constant for the solar gain task."""
|
|
344
|
+
return self._db_dict[BudName.solar_gain_telescope_tracking_mode]
|
|
345
|
+
|
|
346
|
+
@property
|
|
347
|
+
def polcal_telescope_tracking_mode(self) -> str:
|
|
348
|
+
"""Return the telescope tracking mode constant for the polcal task."""
|
|
349
|
+
return self._db_dict[BudName.polcal_telescope_tracking_mode]
|
|
350
|
+
|
|
351
|
+
@property
|
|
352
|
+
def solar_gain_coude_table_tracking_mode(self) -> str:
|
|
353
|
+
"""Return the coude table tracking mode constant for the solar gain task."""
|
|
354
|
+
return self._db_dict[BudName.solar_gain_coude_table_tracking_mode]
|
|
355
|
+
|
|
356
|
+
@property
|
|
357
|
+
def polcal_coude_table_tracking_mode(self) -> str:
|
|
358
|
+
"""Return the coude table tracking mode constant for the polcal task."""
|
|
359
|
+
return self._db_dict[BudName.polcal_coude_table_tracking_mode]
|
|
360
|
+
|
|
361
|
+
@property
|
|
362
|
+
def solar_gain_telescope_scanning_mode(self) -> str:
|
|
363
|
+
"""Return the telescope scanning mode constant for the solar gain task."""
|
|
364
|
+
return self._db_dict[BudName.solar_gain_telescope_scanning_mode]
|
|
365
|
+
|
|
366
|
+
@property
|
|
367
|
+
def polcal_telescope_scanning_mode(self) -> str:
|
|
368
|
+
"""Return the telescope scanning mode constant for the polcal task."""
|
|
369
|
+
return self._db_dict[BudName.polcal_telescope_scanning_mode]
|
|
370
|
+
|
|
371
|
+
@property
|
|
372
|
+
def dark_average_light_level(self) -> float:
|
|
373
|
+
"""Return the average light level constant for the dark task."""
|
|
374
|
+
return self._db_dict[BudName.dark_average_light_level]
|
|
375
|
+
|
|
376
|
+
@property
|
|
377
|
+
def solar_gain_average_light_level(self) -> float:
|
|
378
|
+
"""Return the average light level constant for the solar gain task."""
|
|
379
|
+
return self._db_dict[BudName.solar_gain_average_light_level]
|
|
380
|
+
|
|
381
|
+
@property
|
|
382
|
+
def polcal_average_light_level(self) -> float:
|
|
383
|
+
"""Return the average light level constant for the polcal task."""
|
|
384
|
+
return self._db_dict[BudName.polcal_average_light_level]
|
|
385
|
+
|
|
386
|
+
@property
|
|
387
|
+
def dark_average_telescope_elevation(self) -> float:
|
|
388
|
+
"""Return the average telescope elevation constant for the dark task."""
|
|
389
|
+
return self._db_dict[BudName.dark_average_telescope_elevation]
|
|
390
|
+
|
|
391
|
+
@property
|
|
392
|
+
def solar_gain_average_telescope_elevation(self) -> float:
|
|
393
|
+
"""Return the average telescope elevation constant for the solar gain task."""
|
|
394
|
+
return self._db_dict[BudName.solar_gain_average_telescope_elevation]
|
|
395
|
+
|
|
396
|
+
@property
|
|
397
|
+
def polcal_average_telescope_elevation(self) -> float:
|
|
398
|
+
"""Return the average telescope elevation constant for the polcal task."""
|
|
399
|
+
return self._db_dict[BudName.polcal_average_telescope_elevation]
|
|
400
|
+
|
|
401
|
+
@property
|
|
402
|
+
def dark_average_coude_table_angle(self) -> float:
|
|
403
|
+
"""Return the average coude table angle constant for the dark task."""
|
|
404
|
+
return self._db_dict[BudName.dark_average_coude_table_angle]
|
|
405
|
+
|
|
406
|
+
@property
|
|
407
|
+
def solar_gain_average_coude_table_angle(self) -> float:
|
|
408
|
+
"""Return the average coude table angle constant for the solar gain task."""
|
|
409
|
+
return self._db_dict[BudName.solar_gain_average_coude_table_angle]
|
|
410
|
+
|
|
411
|
+
@property
|
|
412
|
+
def polcal_average_coude_table_angle(self) -> float:
|
|
413
|
+
"""Return the average coude table angle constant for the polcal task."""
|
|
414
|
+
return self._db_dict[BudName.polcal_average_coude_table_angle]
|
|
415
|
+
|
|
416
|
+
@property
|
|
417
|
+
def dark_average_telescope_azimuth(self) -> float:
|
|
418
|
+
"""Return the average telescope azimuth constant for the dark task."""
|
|
419
|
+
return self._db_dict[BudName.dark_average_telescope_azimuth]
|
|
420
|
+
|
|
421
|
+
@property
|
|
422
|
+
def solar_gain_average_telescope_azimuth(self) -> float:
|
|
423
|
+
"""Return the average telescope azimuth constant for the solar gain task."""
|
|
424
|
+
return self._db_dict[BudName.solar_gain_average_telescope_azimuth]
|
|
425
|
+
|
|
426
|
+
@property
|
|
427
|
+
def polcal_average_telescope_azimuth(self) -> float:
|
|
428
|
+
"""Return the average telescope azimuth constant for the polcal task."""
|
|
429
|
+
return self._db_dict[BudName.polcal_average_telescope_azimuth]
|
|
430
|
+
|
|
431
|
+
@property
|
|
432
|
+
def dark_gos_level3_status(self) -> str:
|
|
433
|
+
"""Return the gos level3 status constant for the dark task."""
|
|
434
|
+
return self._db_dict[BudName.dark_gos_level3_status]
|
|
435
|
+
|
|
436
|
+
@property
|
|
437
|
+
def solar_gain_gos_level3_status(self) -> str:
|
|
438
|
+
"""Return the gos level3 status constant for the solar gain task."""
|
|
439
|
+
return self._db_dict[BudName.solar_gain_gos_level3_status]
|
|
440
|
+
|
|
441
|
+
@property
|
|
442
|
+
def dark_gos_level3_lamp_status(self) -> str:
|
|
443
|
+
"""Return the gos level3 lamp status constant for the dark task."""
|
|
444
|
+
return self._db_dict[BudName.dark_gos_level3_lamp_status]
|
|
445
|
+
|
|
446
|
+
@property
|
|
447
|
+
def solar_gain_gos_level3_lamp_status(self) -> str:
|
|
448
|
+
"""Return the gos level3 lamp status constant for the solar gain task."""
|
|
449
|
+
return self._db_dict[BudName.solar_gain_gos_level3_lamp_status]
|
|
450
|
+
|
|
451
|
+
@property
|
|
452
|
+
def dark_gos_polarizer_status(self) -> str:
|
|
453
|
+
"""Return the gos polarizer status constant for the dark task."""
|
|
454
|
+
return self._db_dict[BudName.dark_gos_polarizer_status]
|
|
455
|
+
|
|
456
|
+
@property
|
|
457
|
+
def solar_gain_gos_polarizer_status(self) -> str:
|
|
458
|
+
"""Return the gos polarizer status constant for the solar gain task."""
|
|
459
|
+
return self._db_dict[BudName.solar_gain_gos_polarizer_status]
|
|
460
|
+
|
|
461
|
+
@property
|
|
462
|
+
def dark_gos_polarizer_angle(self) -> float:
|
|
463
|
+
"""Return the gos polarizer angle constant for the dark task."""
|
|
464
|
+
return self._db_dict[BudName.dark_gos_polarizer_angle]
|
|
465
|
+
|
|
466
|
+
@property
|
|
467
|
+
def solar_gain_gos_polarizer_angle(self) -> float:
|
|
468
|
+
"""Return the gos polarizer angle constant for the solar gain task."""
|
|
469
|
+
return self._db_dict[BudName.solar_gain_gos_polarizer_angle]
|
|
470
|
+
|
|
471
|
+
@property
|
|
472
|
+
def dark_gos_retarder_status(self) -> str:
|
|
473
|
+
"""Return the gos retarder status constant for the dark task."""
|
|
474
|
+
return self._db_dict[BudName.dark_gos_retarder_status]
|
|
475
|
+
|
|
476
|
+
@property
|
|
477
|
+
def solar_gain_gos_retarder_status(self) -> str:
|
|
478
|
+
"""Return the gos retarder status constant for the solar gain task."""
|
|
479
|
+
return self._db_dict[BudName.solar_gain_gos_retarder_status]
|
|
480
|
+
|
|
481
|
+
@property
|
|
482
|
+
def dark_gos_retarder_angle(self) -> float:
|
|
483
|
+
"""Return the gos retarder angle constant for the dark task."""
|
|
484
|
+
return self._db_dict[BudName.dark_gos_retarder_angle]
|
|
485
|
+
|
|
486
|
+
@property
|
|
487
|
+
def solar_gain_gos_retarder_angle(self) -> float:
|
|
488
|
+
"""Return the gos retarder angle constant for the solar gain task."""
|
|
489
|
+
return self._db_dict[BudName.solar_gain_gos_retarder_angle]
|
|
490
|
+
|
|
491
|
+
@property
|
|
492
|
+
def dark_gos_level0_status(self) -> str:
|
|
493
|
+
"""Return the gos level0 status constant for the dark task."""
|
|
494
|
+
return self._db_dict[BudName.dark_gos_level0_status]
|
|
495
|
+
|
|
496
|
+
@property
|
|
497
|
+
def solar_gain_gos_level0_status(self) -> str:
|
|
498
|
+
"""Return the gos level0 status constant for the solar gain task."""
|
|
499
|
+
return self._db_dict[BudName.solar_gain_gos_level0_status]
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from enum import StrEnum
|
|
6
|
+
from enum import unique
|
|
6
7
|
from pathlib import Path
|
|
7
|
-
from typing import Any
|
|
8
8
|
|
|
9
9
|
import numpy as np
|
|
10
10
|
from astropy.io import fits
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
HEADER_KEY_NOT_FOUND = "HEADER_KEY_NOT_FOUND"
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
@unique
|
|
15
16
|
class MetadataKey(StrEnum):
|
|
16
17
|
"""Controlled list of names for FITS metadata header keys."""
|
|
17
18
|
|
|
@@ -39,6 +40,19 @@ class MetadataKey(StrEnum):
|
|
|
39
40
|
fpa_exposure_time_ms = "XPOSURE"
|
|
40
41
|
sensor_readout_exposure_time_ms = "TEXPOSUR"
|
|
41
42
|
num_raw_frames_per_fpa = "NSUMEXP"
|
|
43
|
+
camera_id = "CAM_ID"
|
|
44
|
+
camera_name = "CAMERA"
|
|
45
|
+
camera_bit_depth = "BITDEPTH"
|
|
46
|
+
hardware_binning_x = "HWBIN1"
|
|
47
|
+
hardware_binning_y = "HWBIN2"
|
|
48
|
+
software_binning_x = "SWBIN1"
|
|
49
|
+
software_binning_y = "SWBIN2"
|
|
50
|
+
observing_program_execution_id = "OBSPR_ID"
|
|
51
|
+
telescope_tracking_mode = "TELTRACK"
|
|
52
|
+
coude_table_tracking_mode = "TTBLTRCK"
|
|
53
|
+
telescope_scanning_mode = "TELSCAN"
|
|
54
|
+
light_level = "LIGHTLVL"
|
|
55
|
+
hls_version = "HLSVERS"
|
|
42
56
|
|
|
43
57
|
|
|
44
58
|
class FitsAccessBase:
|
|
@@ -68,29 +82,6 @@ class FitsAccessBase:
|
|
|
68
82
|
def __repr__(self):
|
|
69
83
|
return f"{self.__class__.__name__}(hdu={self._hdu!r}, name={self.name!r}, auto_squeeze={self.auto_squeeze})"
|
|
70
84
|
|
|
71
|
-
def _set_metadata_key_value(
|
|
72
|
-
self, key: StrEnum, optional: bool = False, default: Any = NOT_FOUND_MESSAGE
|
|
73
|
-
) -> None:
|
|
74
|
-
"""
|
|
75
|
-
Get the header value and assign it as a metadata key name attribute.
|
|
76
|
-
|
|
77
|
-
Parameters
|
|
78
|
-
----------
|
|
79
|
-
key
|
|
80
|
-
The StrEnum member in attribute_name = fits_keyword structure
|
|
81
|
-
optional
|
|
82
|
-
If the keyword is optional
|
|
83
|
-
default
|
|
84
|
-
Value for the attribute if the key is not found
|
|
85
|
-
"""
|
|
86
|
-
if optional:
|
|
87
|
-
if default != NOT_FOUND_MESSAGE:
|
|
88
|
-
setattr(self, key.name, self.header.get(key, default))
|
|
89
|
-
else:
|
|
90
|
-
setattr(self, key.name, self.header.get(key, key + NOT_FOUND_MESSAGE))
|
|
91
|
-
else:
|
|
92
|
-
setattr(self, key.name, self.header[key])
|
|
93
|
-
|
|
94
85
|
@property
|
|
95
86
|
def data(self) -> np.ndarray:
|
|
96
87
|
"""
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Pre-made flower that reads a single header key from all files with specific task types and returns the average."""
|
|
2
|
+
|
|
3
|
+
from enum import StrEnum
|
|
4
|
+
from statistics import mean
|
|
5
|
+
from typing import Callable
|
|
6
|
+
from typing import Hashable
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
from dkist_processing_common.parsers.near_bud import TaskNearFloatBud
|
|
11
|
+
from dkist_processing_common.parsers.task import passthrough_header_ip_task
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TaskAverageBud(TaskNearFloatBud):
|
|
15
|
+
"""
|
|
16
|
+
Pre-made bud that returns the average of a single header key from all files with specific task types.
|
|
17
|
+
|
|
18
|
+
Parameters
|
|
19
|
+
----------
|
|
20
|
+
constant_name
|
|
21
|
+
The name for the constant to be defined
|
|
22
|
+
|
|
23
|
+
metadata_key
|
|
24
|
+
The metadata key associated with the constant
|
|
25
|
+
|
|
26
|
+
ip_task_types
|
|
27
|
+
Only consider objects whose parsed header IP task type matches a string in this list
|
|
28
|
+
|
|
29
|
+
task_type_parsing_function
|
|
30
|
+
The function used to convert a header into an IP task type
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
key_to_petal_dict: dict[str, float]
|
|
34
|
+
|
|
35
|
+
def __init__(
|
|
36
|
+
self,
|
|
37
|
+
constant_name: str,
|
|
38
|
+
metadata_key: str | StrEnum,
|
|
39
|
+
ip_task_types: str | list[str],
|
|
40
|
+
task_type_parsing_function: Callable = passthrough_header_ip_task,
|
|
41
|
+
):
|
|
42
|
+
super().__init__(
|
|
43
|
+
constant_name=constant_name,
|
|
44
|
+
metadata_key=metadata_key,
|
|
45
|
+
ip_task_types=ip_task_types,
|
|
46
|
+
tolerance=np.inf,
|
|
47
|
+
task_type_parsing_function=task_type_parsing_function,
|
|
48
|
+
)
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
from dkist_processing_common.models.constants import BudName
|
|
4
4
|
from dkist_processing_common.models.fits_access import MetadataKey
|
|
5
|
+
from dkist_processing_common.models.task_name import TaskName
|
|
5
6
|
from dkist_processing_common.parsers.id_bud import ContributingIdsBud
|
|
6
|
-
from dkist_processing_common.parsers.
|
|
7
|
+
from dkist_processing_common.parsers.unique_bud import TaskUniqueBud
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
class ExperimentIdBud(
|
|
10
|
+
class ExperimentIdBud(TaskUniqueBud):
|
|
10
11
|
"""Class to create a Bud for the experiment_id."""
|
|
11
12
|
|
|
12
13
|
def __init__(self):
|
|
13
14
|
super().__init__(
|
|
14
|
-
constant_name=BudName.experiment_id,
|
|
15
|
+
constant_name=BudName.experiment_id,
|
|
16
|
+
metadata_key=MetadataKey.experiment_id,
|
|
17
|
+
ip_task_types=TaskName.observe,
|
|
15
18
|
)
|
|
16
19
|
|
|
17
20
|
|
|
@@ -20,5 +23,6 @@ class ContributingExperimentIdsBud(ContributingIdsBud):
|
|
|
20
23
|
|
|
21
24
|
def __init__(self):
|
|
22
25
|
super().__init__(
|
|
23
|
-
|
|
26
|
+
constant_name=BudName.contributing_experiment_ids,
|
|
27
|
+
metadata_key=MetadataKey.experiment_id,
|
|
24
28
|
)
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
"""Base classes for ID bud parsing."""
|
|
2
2
|
|
|
3
3
|
from enum import StrEnum
|
|
4
|
+
from typing import Callable
|
|
4
5
|
from typing import Type
|
|
5
6
|
|
|
6
7
|
from dkist_processing_common.models.flower_pot import SpilledDirt
|
|
7
8
|
from dkist_processing_common.models.flower_pot import Stem
|
|
8
|
-
from dkist_processing_common.models.task_name import TaskName
|
|
9
9
|
from dkist_processing_common.parsers.l0_fits_access import L0FitsAccess
|
|
10
|
-
from dkist_processing_common.parsers.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class IdBud(TaskUniqueBud):
|
|
14
|
-
"""Base class for ID buds."""
|
|
15
|
-
|
|
16
|
-
def __init__(self, constant_name: str, metadata_key: str | StrEnum):
|
|
17
|
-
super().__init__(
|
|
18
|
-
constant_name=constant_name,
|
|
19
|
-
metadata_key=metadata_key,
|
|
20
|
-
ip_task_types=TaskName.observe,
|
|
21
|
-
)
|
|
10
|
+
from dkist_processing_common.parsers.task import passthrough_header_ip_task
|
|
22
11
|
|
|
23
12
|
|
|
24
13
|
class ContributingIdsBud(Stem):
|
|
25
14
|
"""Base class for contributing ID buds."""
|
|
26
15
|
|
|
27
|
-
def __init__(self,
|
|
28
|
-
super().__init__(stem_name=
|
|
16
|
+
def __init__(self, constant_name: str, metadata_key: str | StrEnum):
|
|
17
|
+
super().__init__(stem_name=constant_name)
|
|
29
18
|
if isinstance(metadata_key, StrEnum):
|
|
30
19
|
metadata_key = metadata_key.name
|
|
31
20
|
self.metadata_key = metadata_key
|
|
32
21
|
|
|
33
|
-
def setter(self, fits_obj: L0FitsAccess) -> str
|
|
22
|
+
def setter(self, fits_obj: L0FitsAccess) -> str:
|
|
34
23
|
"""
|
|
35
24
|
Set the id for any type of frame.
|
|
36
25
|
|
|
@@ -44,9 +33,9 @@ class ContributingIdsBud(Stem):
|
|
|
44
33
|
"""
|
|
45
34
|
return getattr(fits_obj, self.metadata_key)
|
|
46
35
|
|
|
47
|
-
def getter(self, key) -> tuple:
|
|
36
|
+
def getter(self, key) -> tuple[str, ...]:
|
|
48
37
|
"""
|
|
49
|
-
Get all ids seen
|
|
38
|
+
Get all ids seen for any type of frame.
|
|
50
39
|
|
|
51
40
|
Parameters
|
|
52
41
|
----------
|
|
@@ -55,6 +44,33 @@ class ContributingIdsBud(Stem):
|
|
|
55
44
|
|
|
56
45
|
Returns
|
|
57
46
|
-------
|
|
58
|
-
IDs from
|
|
47
|
+
IDs from all types of frames
|
|
59
48
|
"""
|
|
60
49
|
return tuple(set(self.key_to_petal_dict.values()))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class TaskContributingIdsBud(ContributingIdsBud):
|
|
53
|
+
"""Base class for contributing ID buds for a particular task type."""
|
|
54
|
+
|
|
55
|
+
def __init__(
|
|
56
|
+
self,
|
|
57
|
+
constant_name: str,
|
|
58
|
+
metadata_key: str | StrEnum,
|
|
59
|
+
ip_task_types: str | list[str],
|
|
60
|
+
task_type_parsing_function: Callable = passthrough_header_ip_task,
|
|
61
|
+
):
|
|
62
|
+
super().__init__(constant_name=constant_name, metadata_key=metadata_key)
|
|
63
|
+
|
|
64
|
+
if isinstance(ip_task_types, str):
|
|
65
|
+
ip_task_types = [ip_task_types]
|
|
66
|
+
self.ip_task_types = [task.casefold() for task in ip_task_types]
|
|
67
|
+
self.parsing_function = task_type_parsing_function
|
|
68
|
+
|
|
69
|
+
def setter(self, fits_obj: L0FitsAccess) -> str | Type[SpilledDirt]:
|
|
70
|
+
"""Ingest an object only if its parsed IP task type matches what's desired."""
|
|
71
|
+
task = self.parsing_function(fits_obj)
|
|
72
|
+
|
|
73
|
+
if task.casefold() in self.ip_task_types:
|
|
74
|
+
return super().setter(fits_obj)
|
|
75
|
+
|
|
76
|
+
return SpilledDirt
|