dkist-processing-cryonirsp 1.4.20__py3-none-any.whl → 1.14.9rc1__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/232.misc.rst +1 -0
- dkist_processing_cryonirsp/__init__.py +1 -0
- dkist_processing_cryonirsp/codecs/fits.py +1 -0
- dkist_processing_cryonirsp/config.py +5 -1
- dkist_processing_cryonirsp/models/beam_boundaries.py +1 -0
- dkist_processing_cryonirsp/models/constants.py +31 -30
- dkist_processing_cryonirsp/models/exposure_conditions.py +6 -5
- dkist_processing_cryonirsp/models/fits_access.py +40 -0
- dkist_processing_cryonirsp/models/parameters.py +14 -26
- dkist_processing_cryonirsp/models/tags.py +1 -0
- dkist_processing_cryonirsp/models/task_name.py +1 -0
- dkist_processing_cryonirsp/parsers/check_for_gains.py +1 -0
- dkist_processing_cryonirsp/parsers/cryonirsp_l0_fits_access.py +40 -47
- dkist_processing_cryonirsp/parsers/cryonirsp_l1_fits_access.py +1 -0
- dkist_processing_cryonirsp/parsers/exposure_conditions.py +14 -13
- dkist_processing_cryonirsp/parsers/map_repeats.py +1 -0
- dkist_processing_cryonirsp/parsers/measurements.py +29 -16
- dkist_processing_cryonirsp/parsers/modstates.py +5 -1
- dkist_processing_cryonirsp/parsers/optical_density_filters.py +1 -0
- dkist_processing_cryonirsp/parsers/polarimetric_check.py +18 -7
- dkist_processing_cryonirsp/parsers/scan_step.py +12 -4
- dkist_processing_cryonirsp/parsers/time.py +7 -7
- dkist_processing_cryonirsp/parsers/wavelength.py +6 -1
- dkist_processing_cryonirsp/tasks/__init__.py +2 -1
- dkist_processing_cryonirsp/tasks/assemble_movie.py +1 -0
- dkist_processing_cryonirsp/tasks/bad_pixel_map.py +6 -5
- dkist_processing_cryonirsp/tasks/beam_boundaries_base.py +12 -11
- dkist_processing_cryonirsp/tasks/ci_beam_boundaries.py +1 -0
- dkist_processing_cryonirsp/tasks/ci_science.py +1 -0
- dkist_processing_cryonirsp/tasks/cryonirsp_base.py +2 -3
- dkist_processing_cryonirsp/tasks/dark.py +5 -4
- dkist_processing_cryonirsp/tasks/gain.py +7 -6
- dkist_processing_cryonirsp/tasks/instrument_polarization.py +17 -16
- dkist_processing_cryonirsp/tasks/l1_output_data.py +1 -0
- dkist_processing_cryonirsp/tasks/linearity_correction.py +1 -0
- dkist_processing_cryonirsp/tasks/make_movie_frames.py +3 -2
- dkist_processing_cryonirsp/tasks/mixin/corrections.py +1 -0
- dkist_processing_cryonirsp/tasks/mixin/shift_measurements.py +9 -2
- dkist_processing_cryonirsp/tasks/parse.py +70 -52
- dkist_processing_cryonirsp/tasks/quality_metrics.py +15 -14
- dkist_processing_cryonirsp/tasks/science_base.py +8 -6
- dkist_processing_cryonirsp/tasks/sp_beam_boundaries.py +2 -1
- dkist_processing_cryonirsp/tasks/sp_geometric.py +11 -10
- dkist_processing_cryonirsp/tasks/sp_science.py +1 -0
- dkist_processing_cryonirsp/tasks/sp_solar_gain.py +15 -12
- dkist_processing_cryonirsp/tasks/sp_wavelength_calibration.py +300 -0
- dkist_processing_cryonirsp/tasks/write_l1.py +59 -38
- dkist_processing_cryonirsp/tests/conftest.py +75 -53
- dkist_processing_cryonirsp/tests/header_models.py +62 -11
- dkist_processing_cryonirsp/tests/local_trial_workflows/l0_cals_only.py +26 -46
- dkist_processing_cryonirsp/tests/local_trial_workflows/l0_to_l1.py +26 -47
- dkist_processing_cryonirsp/tests/local_trial_workflows/linearize_only.py +3 -3
- dkist_processing_cryonirsp/tests/local_trial_workflows/local_trial_helpers.py +57 -26
- dkist_processing_cryonirsp/tests/test_assemble_movie.py +4 -5
- dkist_processing_cryonirsp/tests/test_assemble_qualilty.py +5 -1
- dkist_processing_cryonirsp/tests/test_bad_pixel_maps.py +4 -5
- dkist_processing_cryonirsp/tests/test_ci_beam_boundaries.py +4 -5
- dkist_processing_cryonirsp/tests/test_ci_science.py +4 -5
- dkist_processing_cryonirsp/tests/test_corrections.py +5 -6
- dkist_processing_cryonirsp/tests/test_cryo_base.py +4 -6
- dkist_processing_cryonirsp/tests/test_cryo_constants.py +7 -3
- dkist_processing_cryonirsp/tests/test_dark.py +7 -8
- dkist_processing_cryonirsp/tests/test_fits_access.py +44 -0
- dkist_processing_cryonirsp/tests/test_gain.py +7 -8
- dkist_processing_cryonirsp/tests/test_instrument_polarization.py +19 -10
- dkist_processing_cryonirsp/tests/test_linearity_correction.py +5 -4
- dkist_processing_cryonirsp/tests/test_make_movie_frames.py +2 -3
- dkist_processing_cryonirsp/tests/test_parameters.py +23 -28
- dkist_processing_cryonirsp/tests/test_parse.py +48 -12
- dkist_processing_cryonirsp/tests/test_quality.py +2 -3
- dkist_processing_cryonirsp/tests/test_sp_beam_boundaries.py +5 -5
- dkist_processing_cryonirsp/tests/test_sp_geometric.py +5 -6
- dkist_processing_cryonirsp/tests/test_sp_make_movie_frames.py +2 -3
- dkist_processing_cryonirsp/tests/test_sp_science.py +4 -5
- dkist_processing_cryonirsp/tests/test_sp_solar.py +6 -5
- dkist_processing_cryonirsp/tests/{test_sp_dispersion_axis_correction.py → test_sp_wavelength_calibration.py} +11 -29
- dkist_processing_cryonirsp/tests/test_trial_create_quality_report.py +1 -1
- dkist_processing_cryonirsp/tests/test_workflows.py +1 -0
- dkist_processing_cryonirsp/tests/test_write_l1.py +29 -31
- dkist_processing_cryonirsp/workflows/__init__.py +1 -0
- dkist_processing_cryonirsp/workflows/ci_l0_processing.py +9 -5
- dkist_processing_cryonirsp/workflows/sp_l0_processing.py +12 -8
- dkist_processing_cryonirsp/workflows/trial_workflows.py +12 -11
- dkist_processing_cryonirsp-1.14.9rc1.dist-info/METADATA +552 -0
- dkist_processing_cryonirsp-1.14.9rc1.dist-info/RECORD +115 -0
- {dkist_processing_cryonirsp-1.4.20.dist-info → dkist_processing_cryonirsp-1.14.9rc1.dist-info}/WHEEL +1 -1
- docs/ci_science_calibration.rst +10 -0
- docs/conf.py +1 -0
- docs/index.rst +1 -0
- docs/sp_science_calibration.rst +7 -0
- docs/wavelength_calibration.rst +62 -0
- dkist_processing_cryonirsp/tasks/sp_dispersion_axis_correction.py +0 -492
- dkist_processing_cryonirsp-1.4.20.dist-info/METADATA +0 -452
- dkist_processing_cryonirsp-1.4.20.dist-info/RECORD +0 -111
- {dkist_processing_cryonirsp-1.4.20.dist-info → dkist_processing_cryonirsp-1.14.9rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
"""Parse CryoNIRSP data."""
|
|
2
|
+
|
|
2
3
|
from typing import TypeVar
|
|
3
4
|
|
|
5
|
+
from dkist_processing_common.models.fits_access import MetadataKey
|
|
4
6
|
from dkist_processing_common.models.flower_pot import Stem
|
|
5
7
|
from dkist_processing_common.models.tags import Tag
|
|
6
8
|
from dkist_processing_common.models.task_name import TaskName
|
|
7
9
|
from dkist_processing_common.parsers.cs_step import CSStepFlower
|
|
8
10
|
from dkist_processing_common.parsers.cs_step import NumCSStepBud
|
|
9
11
|
from dkist_processing_common.parsers.near_bud import TaskNearFloatBud
|
|
12
|
+
from dkist_processing_common.parsers.retarder import RetarderNameBud
|
|
10
13
|
from dkist_processing_common.parsers.single_value_single_key_flower import (
|
|
11
14
|
SingleValueSingleKeyFlower,
|
|
12
15
|
)
|
|
13
|
-
from dkist_processing_common.parsers.task import parse_header_ip_task_with_gains
|
|
14
16
|
from dkist_processing_common.parsers.task import PolcalTaskFlower
|
|
15
17
|
from dkist_processing_common.parsers.task import TaskTypeFlower
|
|
18
|
+
from dkist_processing_common.parsers.task import parse_header_ip_task_with_gains
|
|
16
19
|
from dkist_processing_common.parsers.time import ObsIpStartTimeBud
|
|
17
20
|
from dkist_processing_common.parsers.unique_bud import TaskUniqueBud
|
|
18
21
|
from dkist_processing_common.parsers.unique_bud import UniqueBud
|
|
22
|
+
from dkist_processing_common.tasks import ParseDataBase
|
|
19
23
|
from dkist_processing_common.tasks import default_constant_bud_factory
|
|
20
24
|
from dkist_processing_common.tasks import default_tag_flower_factory
|
|
21
|
-
from dkist_processing_common.tasks import ParseDataBase
|
|
22
|
-
from dkist_processing_common.tasks.mixin.input_dataset import InputDatasetMixin
|
|
23
25
|
|
|
24
26
|
from dkist_processing_cryonirsp.models.constants import CryonirspBudName
|
|
27
|
+
from dkist_processing_cryonirsp.models.fits_access import CryonirspMetadataKey
|
|
25
28
|
from dkist_processing_cryonirsp.models.parameters import CryonirspParsingParameters
|
|
26
29
|
from dkist_processing_cryonirsp.models.tags import CryonirspStemName
|
|
27
30
|
from dkist_processing_cryonirsp.models.tags import CryonirspTag
|
|
@@ -53,11 +56,10 @@ from dkist_processing_cryonirsp.parsers.optical_density_filters import OpticalDe
|
|
|
53
56
|
from dkist_processing_cryonirsp.parsers.polarimetric_check import PolarimetricCheckingUniqueBud
|
|
54
57
|
from dkist_processing_cryonirsp.parsers.scan_step import NumberOfScanStepsBud
|
|
55
58
|
from dkist_processing_cryonirsp.parsers.scan_step import ScanStepNumberFlower
|
|
56
|
-
from dkist_processing_cryonirsp.parsers.time import
|
|
59
|
+
from dkist_processing_cryonirsp.parsers.time import CryonirspSolarGainTimeObsBud
|
|
57
60
|
from dkist_processing_cryonirsp.parsers.time import CryonirspTimeObsBud
|
|
58
61
|
from dkist_processing_cryonirsp.parsers.wavelength import ObserveWavelengthBud
|
|
59
62
|
|
|
60
|
-
|
|
61
63
|
__all__ = [
|
|
62
64
|
"ParseL0CryonirspRampData",
|
|
63
65
|
"ParseL0CryonirspLinearizedData",
|
|
@@ -92,13 +94,15 @@ class ParseL0CryonirspRampData(ParseDataBase):
|
|
|
92
94
|
"""Add CryoNIRSP specific constants to common constants."""
|
|
93
95
|
return [
|
|
94
96
|
UniqueBud(
|
|
95
|
-
constant_name=CryonirspBudName.camera_readout_mode
|
|
96
|
-
metadata_key=
|
|
97
|
+
constant_name=CryonirspBudName.camera_readout_mode,
|
|
98
|
+
metadata_key=CryonirspMetadataKey.camera_readout_mode,
|
|
97
99
|
),
|
|
98
100
|
# Time Obs is the unique identifier for each ramp in the data set
|
|
99
101
|
CryonirspTimeObsBud(),
|
|
100
102
|
# This is used to determine which set of linearity correction tables to use.
|
|
101
|
-
UniqueBud(
|
|
103
|
+
UniqueBud(
|
|
104
|
+
constant_name=CryonirspBudName.arm_id, metadata_key=CryonirspMetadataKey.arm_id
|
|
105
|
+
),
|
|
102
106
|
# Need wavelength to do filter compensation
|
|
103
107
|
ObserveWavelengthBud(),
|
|
104
108
|
# Need the optical density filter name for early failure detection
|
|
@@ -107,16 +111,20 @@ class ParseL0CryonirspRampData(ParseDataBase):
|
|
|
107
111
|
ObsIpStartTimeBud(),
|
|
108
112
|
# Get the ROI 1 size and origin
|
|
109
113
|
UniqueBud(
|
|
110
|
-
constant_name=CryonirspBudName.roi_1_origin_x
|
|
114
|
+
constant_name=CryonirspBudName.roi_1_origin_x,
|
|
115
|
+
metadata_key=CryonirspMetadataKey.roi_1_origin_x,
|
|
111
116
|
),
|
|
112
117
|
UniqueBud(
|
|
113
|
-
constant_name=CryonirspBudName.roi_1_origin_y
|
|
118
|
+
constant_name=CryonirspBudName.roi_1_origin_y,
|
|
119
|
+
metadata_key=CryonirspMetadataKey.roi_1_origin_y,
|
|
114
120
|
),
|
|
115
121
|
UniqueBud(
|
|
116
|
-
constant_name=CryonirspBudName.roi_1_size_x
|
|
122
|
+
constant_name=CryonirspBudName.roi_1_size_x,
|
|
123
|
+
metadata_key=CryonirspMetadataKey.roi_1_size_x,
|
|
117
124
|
),
|
|
118
125
|
UniqueBud(
|
|
119
|
-
constant_name=CryonirspBudName.roi_1_size_y
|
|
126
|
+
constant_name=CryonirspBudName.roi_1_size_y,
|
|
127
|
+
metadata_key=CryonirspMetadataKey.roi_1_size_y,
|
|
120
128
|
),
|
|
121
129
|
]
|
|
122
130
|
|
|
@@ -125,13 +133,13 @@ class ParseL0CryonirspRampData(ParseDataBase):
|
|
|
125
133
|
"""Add CryoNIRSP specific tags to common tags."""
|
|
126
134
|
return [
|
|
127
135
|
SingleValueSingleKeyFlower(
|
|
128
|
-
tag_stem_name=CryonirspStemName.curr_frame_in_ramp
|
|
129
|
-
metadata_key=
|
|
136
|
+
tag_stem_name=CryonirspStemName.curr_frame_in_ramp,
|
|
137
|
+
metadata_key=CryonirspMetadataKey.curr_frame_in_ramp,
|
|
130
138
|
),
|
|
131
139
|
# time_obs is a unique identifier for all raw frames in a single ramp
|
|
132
140
|
SingleValueSingleKeyFlower(
|
|
133
|
-
tag_stem_name=CryonirspStemName.time_obs
|
|
134
|
-
metadata_key=
|
|
141
|
+
tag_stem_name=CryonirspStemName.time_obs,
|
|
142
|
+
metadata_key=MetadataKey.time_obs,
|
|
135
143
|
),
|
|
136
144
|
]
|
|
137
145
|
|
|
@@ -141,7 +149,7 @@ class ParseL0CryonirspRampData(ParseDataBase):
|
|
|
141
149
|
return [Tag.input(), Tag.frame()]
|
|
142
150
|
|
|
143
151
|
|
|
144
|
-
class ParseL0CryonirspLinearizedData(ParseDataBase
|
|
152
|
+
class ParseL0CryonirspLinearizedData(ParseDataBase):
|
|
145
153
|
"""
|
|
146
154
|
Parse linearity corrected CryoNIRSP input data to add common and Cryonirsp specific constants.
|
|
147
155
|
|
|
@@ -167,7 +175,7 @@ class ParseL0CryonirspLinearizedData(ParseDataBase, InputDatasetMixin):
|
|
|
167
175
|
workflow_name=workflow_name,
|
|
168
176
|
workflow_version=workflow_version,
|
|
169
177
|
)
|
|
170
|
-
self.parameters = CryonirspParsingParameters(self.
|
|
178
|
+
self.parameters = CryonirspParsingParameters(scratch=self.scratch)
|
|
171
179
|
|
|
172
180
|
@property
|
|
173
181
|
def fits_parsing_class(self):
|
|
@@ -186,36 +194,46 @@ class ParseL0CryonirspLinearizedData(ParseDataBase, InputDatasetMixin):
|
|
|
186
194
|
NumMapScansBud(),
|
|
187
195
|
NumberOfScanStepsBud(),
|
|
188
196
|
NumberOfMeasurementsBud(),
|
|
189
|
-
|
|
197
|
+
CryonirspSolarGainTimeObsBud(),
|
|
190
198
|
CheckSolarGainFramesPickyBud(),
|
|
191
199
|
NumCSStepBud(self.parameters.max_cs_step_time_sec),
|
|
192
200
|
CryonirspTaskExposureConditionsBud(
|
|
193
|
-
stem_name=CryonirspBudName.dark_frame_exposure_conditions_list
|
|
194
|
-
ip_task_type=TaskName.dark
|
|
201
|
+
stem_name=CryonirspBudName.dark_frame_exposure_conditions_list,
|
|
202
|
+
ip_task_type=TaskName.dark,
|
|
195
203
|
),
|
|
196
204
|
CryonirspTaskExposureConditionsBud(
|
|
197
|
-
stem_name=CryonirspBudName.solar_gain_exposure_conditions_list
|
|
198
|
-
ip_task_type=TaskName.solar_gain
|
|
205
|
+
stem_name=CryonirspBudName.solar_gain_exposure_conditions_list,
|
|
206
|
+
ip_task_type=TaskName.solar_gain,
|
|
199
207
|
),
|
|
200
208
|
CryonirspTaskExposureConditionsBud(
|
|
201
|
-
stem_name=CryonirspBudName.observe_exposure_conditions_list
|
|
202
|
-
ip_task_type=TaskName.observe
|
|
209
|
+
stem_name=CryonirspBudName.observe_exposure_conditions_list,
|
|
210
|
+
ip_task_type=TaskName.observe,
|
|
203
211
|
),
|
|
204
212
|
CryonirspTaskExposureConditionsBud(
|
|
205
|
-
stem_name=CryonirspBudName.polcal_exposure_conditions_list
|
|
206
|
-
ip_task_type=TaskName.polcal
|
|
213
|
+
stem_name=CryonirspBudName.polcal_exposure_conditions_list,
|
|
214
|
+
ip_task_type=TaskName.polcal,
|
|
215
|
+
),
|
|
216
|
+
UniqueBud(
|
|
217
|
+
constant_name=CryonirspBudName.axis_1_type,
|
|
218
|
+
metadata_key=CryonirspMetadataKey.axis_1_type,
|
|
219
|
+
),
|
|
220
|
+
UniqueBud(
|
|
221
|
+
constant_name=CryonirspBudName.axis_2_type,
|
|
222
|
+
metadata_key=CryonirspMetadataKey.axis_2_type,
|
|
223
|
+
),
|
|
224
|
+
UniqueBud(
|
|
225
|
+
constant_name=CryonirspBudName.axis_3_type,
|
|
226
|
+
metadata_key=CryonirspMetadataKey.axis_3_type,
|
|
207
227
|
),
|
|
208
|
-
UniqueBud(constant_name=CryonirspBudName.axis_1_type.value, metadata_key="axis_1_type"),
|
|
209
|
-
UniqueBud(constant_name=CryonirspBudName.axis_2_type.value, metadata_key="axis_2_type"),
|
|
210
|
-
UniqueBud(constant_name=CryonirspBudName.axis_3_type.value, metadata_key="axis_3_type"),
|
|
211
228
|
PolarimetricCheckingUniqueBud(
|
|
212
|
-
constant_name=CryonirspBudName.num_modstates
|
|
213
|
-
metadata_key=
|
|
229
|
+
constant_name=CryonirspBudName.num_modstates,
|
|
230
|
+
metadata_key=CryonirspMetadataKey.number_of_modulator_states,
|
|
214
231
|
),
|
|
215
232
|
PolarimetricCheckingUniqueBud(
|
|
216
|
-
constant_name=CryonirspBudName.modulator_spin_mode
|
|
217
|
-
metadata_key=
|
|
233
|
+
constant_name=CryonirspBudName.modulator_spin_mode,
|
|
234
|
+
metadata_key=CryonirspMetadataKey.modulator_spin_mode,
|
|
218
235
|
),
|
|
236
|
+
RetarderNameBud(),
|
|
219
237
|
]
|
|
220
238
|
|
|
221
239
|
@property
|
|
@@ -230,7 +248,7 @@ class ParseL0CryonirspLinearizedData(ParseDataBase, InputDatasetMixin):
|
|
|
230
248
|
ScanStepNumberFlower(),
|
|
231
249
|
MeasurementNumberFlower(),
|
|
232
250
|
SingleValueSingleKeyFlower(
|
|
233
|
-
tag_stem_name=CryonirspStemName.exposure_conditions
|
|
251
|
+
tag_stem_name=CryonirspStemName.exposure_conditions,
|
|
234
252
|
metadata_key="exposure_conditions",
|
|
235
253
|
),
|
|
236
254
|
]
|
|
@@ -244,41 +262,41 @@ class ParseL0CryonirspSPLinearizedData(ParseL0CryonirspLinearizedData):
|
|
|
244
262
|
"""Add CryoNIRSP-SP specific constants to common constants."""
|
|
245
263
|
return super().constant_buds + [
|
|
246
264
|
TaskNearFloatBud(
|
|
247
|
-
constant_name=CryonirspBudName.grating_position_deg
|
|
248
|
-
metadata_key=
|
|
249
|
-
|
|
265
|
+
constant_name=CryonirspBudName.grating_position_deg,
|
|
266
|
+
metadata_key=CryonirspMetadataKey.grating_position_deg,
|
|
267
|
+
ip_task_types=[TaskName.observe, TaskName.solar_gain],
|
|
250
268
|
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
251
269
|
tolerance=0.01,
|
|
252
270
|
),
|
|
253
271
|
TaskNearFloatBud(
|
|
254
|
-
constant_name=CryonirspBudName.grating_littrow_angle_deg
|
|
255
|
-
metadata_key=
|
|
256
|
-
|
|
272
|
+
constant_name=CryonirspBudName.grating_littrow_angle_deg,
|
|
273
|
+
metadata_key=CryonirspMetadataKey.grating_littrow_angle_deg,
|
|
274
|
+
ip_task_types=[TaskName.observe, TaskName.solar_gain],
|
|
257
275
|
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
258
276
|
tolerance=0.01,
|
|
259
277
|
),
|
|
260
278
|
TaskUniqueBud(
|
|
261
|
-
constant_name=CryonirspBudName.grating_constant
|
|
262
|
-
metadata_key=
|
|
263
|
-
|
|
279
|
+
constant_name=CryonirspBudName.grating_constant,
|
|
280
|
+
metadata_key=CryonirspMetadataKey.grating_constant,
|
|
281
|
+
ip_task_types=[TaskName.observe, TaskName.solar_gain],
|
|
264
282
|
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
265
283
|
),
|
|
266
284
|
TaskUniqueBud(
|
|
267
|
-
constant_name=CryonirspBudName.
|
|
268
|
-
metadata_key=
|
|
269
|
-
|
|
285
|
+
constant_name=CryonirspBudName.center_wavelength,
|
|
286
|
+
metadata_key=CryonirspMetadataKey.center_wavelength,
|
|
287
|
+
ip_task_types=[TaskName.observe, TaskName.solar_gain],
|
|
270
288
|
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
271
289
|
),
|
|
272
290
|
TaskUniqueBud(
|
|
273
|
-
constant_name=CryonirspBudName.
|
|
274
|
-
metadata_key=
|
|
275
|
-
|
|
291
|
+
constant_name=CryonirspBudName.slit_width,
|
|
292
|
+
metadata_key=CryonirspMetadataKey.slit_width,
|
|
293
|
+
ip_task_types=[TaskName.observe, TaskName.solar_gain],
|
|
276
294
|
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
277
295
|
),
|
|
278
296
|
CheckLampGainFramesPickyBud(),
|
|
279
297
|
CryonirspTaskExposureConditionsBud(
|
|
280
|
-
stem_name=CryonirspBudName.lamp_gain_exposure_conditions_list
|
|
281
|
-
ip_task_type=TaskName.lamp_gain
|
|
298
|
+
stem_name=CryonirspBudName.lamp_gain_exposure_conditions_list,
|
|
299
|
+
ip_task_type=TaskName.lamp_gain,
|
|
282
300
|
),
|
|
283
301
|
CryonirspSPConditionalTaskExposureConditionsBud(),
|
|
284
302
|
CryonirspSPPickyDarkExposureConditionsBud(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Cryonirsp quality metrics task."""
|
|
2
|
+
|
|
2
3
|
from dataclasses import dataclass
|
|
3
4
|
from dataclasses import field
|
|
4
5
|
from typing import Generator
|
|
@@ -107,26 +108,26 @@ class CryonirspL1QualityMetrics(CryonirspTaskBase, QualityMixin):
|
|
|
107
108
|
def run(self) -> None:
|
|
108
109
|
"""Calculate sensitivity and noise quality metrics."""
|
|
109
110
|
if self.constants.correct_for_polarization:
|
|
110
|
-
with self.
|
|
111
|
-
"Calculating L1 Sensitivity metrics for all stokes states"
|
|
112
|
-
):
|
|
111
|
+
with self.telemetry_span("Calculating L1 Sensitivity metrics for all stokes states"):
|
|
113
112
|
self.compute_full_stokes_sensitivity()
|
|
114
|
-
with self.
|
|
113
|
+
with self.telemetry_span(
|
|
114
|
+
"Calculating L1 Cryonirsp noise metrics for all stokes states"
|
|
115
|
+
):
|
|
115
116
|
self.compute_full_stokes_noise()
|
|
116
117
|
else:
|
|
117
|
-
with self.
|
|
118
|
+
with self.telemetry_span("Calculating L1 Sensitivity metrics for intensity only"):
|
|
118
119
|
self.compute_intensity_only_sensitivity()
|
|
119
|
-
with self.
|
|
120
|
+
with self.telemetry_span("Calculating L1 Cryonirsp noise metrics for intensity only"):
|
|
120
121
|
self.compute_intensity_only_noise()
|
|
121
122
|
|
|
122
123
|
def compute_full_stokes_sensitivity(self):
|
|
123
124
|
"""Compute the sensitivities of each map scan for each stokes state."""
|
|
124
125
|
for stokes_state in self.constants.stokes_params:
|
|
125
|
-
with self.
|
|
126
|
+
with self.telemetry_span(f"Calculating sensitivity for stokes = {stokes_state}"):
|
|
126
127
|
quality_data = self.calculate_sensitivity_for_stokes_state(
|
|
127
128
|
stokes_state=stokes_state
|
|
128
129
|
)
|
|
129
|
-
with self.
|
|
130
|
+
with self.telemetry_span(f"Writing sensitivity data for stokes = {stokes_state}"):
|
|
130
131
|
self.quality_store_sensitivity(
|
|
131
132
|
stokes=stokes_state,
|
|
132
133
|
datetimes=quality_data.datetimes,
|
|
@@ -135,9 +136,9 @@ class CryonirspL1QualityMetrics(CryonirspTaskBase, QualityMixin):
|
|
|
135
136
|
|
|
136
137
|
def compute_intensity_only_sensitivity(self):
|
|
137
138
|
"""Compute the sensitivities of each map scan for the intensity stokes state only."""
|
|
138
|
-
with self.
|
|
139
|
+
with self.telemetry_span(f"Calculating sensitivity for intensity only"):
|
|
139
140
|
quality_data = self.calculate_sensitivity_for_stokes_state(stokes_state="I")
|
|
140
|
-
with self.
|
|
141
|
+
with self.telemetry_span("Writing sensitivity data for intensity only"):
|
|
141
142
|
self.quality_store_sensitivity(
|
|
142
143
|
stokes="I", datetimes=quality_data.datetimes, values=quality_data.values
|
|
143
144
|
)
|
|
@@ -145,9 +146,9 @@ class CryonirspL1QualityMetrics(CryonirspTaskBase, QualityMixin):
|
|
|
145
146
|
def compute_full_stokes_noise(self):
|
|
146
147
|
"""Compute noise in data broken down by each stokes state."""
|
|
147
148
|
for stokes in self.constants.stokes_params:
|
|
148
|
-
with self.
|
|
149
|
+
with self.telemetry_span(f"Compile noise values for {stokes=}"):
|
|
149
150
|
noise_data = self.compile_noise_data(stokes=stokes)
|
|
150
|
-
with self.
|
|
151
|
+
with self.telemetry_span(f"Write noise values for {stokes=}"):
|
|
151
152
|
self.quality_store_noise(
|
|
152
153
|
datetimes=noise_data.datetimes, values=noise_data.values, stokes=stokes
|
|
153
154
|
)
|
|
@@ -155,9 +156,9 @@ class CryonirspL1QualityMetrics(CryonirspTaskBase, QualityMixin):
|
|
|
155
156
|
def compute_intensity_only_noise(self):
|
|
156
157
|
"""Compute noise in data for the intensity stokes state only."""
|
|
157
158
|
stokes = "I"
|
|
158
|
-
with self.
|
|
159
|
+
with self.telemetry_span(f"Compile noise values for {stokes=}"):
|
|
159
160
|
noise_data = self.compile_noise_data(stokes=stokes)
|
|
160
|
-
with self.
|
|
161
|
+
with self.telemetry_span(f"Write noise values for {stokes=}"):
|
|
161
162
|
self.quality_store_noise(
|
|
162
163
|
datetimes=noise_data.datetimes, values=noise_data.values, stokes=stokes
|
|
163
164
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Base frameworks for Cryonirsp science calibration."""
|
|
2
|
+
|
|
2
3
|
from abc import ABC
|
|
3
4
|
from abc import abstractmethod
|
|
4
5
|
from collections.abc import Iterable
|
|
@@ -9,6 +10,7 @@ from astropy.io import fits
|
|
|
9
10
|
from astropy.time import Time
|
|
10
11
|
from astropy.time import TimeDelta
|
|
11
12
|
from dkist_processing_common.codecs.fits import fits_hdulist_encoder
|
|
13
|
+
from dkist_processing_common.models.fits_access import MetadataKey
|
|
12
14
|
from dkist_processing_common.models.task_name import TaskName
|
|
13
15
|
from dkist_processing_math.arithmetic import divide_arrays_by_array
|
|
14
16
|
from dkist_processing_math.arithmetic import subtract_array_from_arrays
|
|
@@ -69,17 +71,17 @@ class ScienceCalibrationBase(CryonirspTaskBase, ABC):
|
|
|
69
71
|
None
|
|
70
72
|
|
|
71
73
|
"""
|
|
72
|
-
with self.
|
|
74
|
+
with self.telemetry_span("Loading calibration objects"):
|
|
73
75
|
calibrations = self.collect_calibration_objects()
|
|
74
76
|
|
|
75
|
-
with self.
|
|
77
|
+
with self.telemetry_span(
|
|
76
78
|
f"Calibrating Science Frames for "
|
|
77
79
|
f"{self.constants.num_map_scans} map scans and "
|
|
78
80
|
f"{self.constants.num_scan_steps} scan steps"
|
|
79
81
|
):
|
|
80
82
|
self.calibrate_and_write_frames(calibrations=calibrations)
|
|
81
83
|
|
|
82
|
-
with self.
|
|
84
|
+
with self.telemetry_span("Computing and logging quality metrics"):
|
|
83
85
|
no_of_raw_science_frames: int = self.scratch.count_all(
|
|
84
86
|
tags=[
|
|
85
87
|
CryonirspTag.linearized_frame(),
|
|
@@ -226,7 +228,7 @@ class ScienceCalibrationBase(CryonirspTaskBase, ABC):
|
|
|
226
228
|
array_stack = np.zeros(array_shape + (self.constants.num_modstates,))
|
|
227
229
|
header_stack = []
|
|
228
230
|
|
|
229
|
-
with self.
|
|
231
|
+
with self.telemetry_span(f"Correcting {self.constants.num_modstates} modstates"):
|
|
230
232
|
for modstate in range(1, self.constants.num_modstates + 1):
|
|
231
233
|
# Correct the arrays
|
|
232
234
|
corrected_array, corrected_header = self.apply_basic_corrections(
|
|
@@ -242,7 +244,7 @@ class ScienceCalibrationBase(CryonirspTaskBase, ABC):
|
|
|
242
244
|
array_stack[:, :, modstate - 1] = corrected_array
|
|
243
245
|
header_stack.append(corrected_header)
|
|
244
246
|
|
|
245
|
-
with self.
|
|
247
|
+
with self.telemetry_span("Applying instrument polarization correction"):
|
|
246
248
|
intermediate_array = self.polarization_correction(
|
|
247
249
|
array_stack, calibrations.demod_matrices[CryonirspTag.beam(beam)]
|
|
248
250
|
)
|
|
@@ -395,7 +397,7 @@ class ScienceCalibrationBase(CryonirspTaskBase, ABC):
|
|
|
395
397
|
date_end = (Time(sorted_obj_list[-1].time_obs) + exp_time).isot
|
|
396
398
|
|
|
397
399
|
header = sorted_obj_list[0].header
|
|
398
|
-
header[
|
|
400
|
+
header[MetadataKey.time_obs] = date_beg
|
|
399
401
|
header["DATE-END"] = date_end
|
|
400
402
|
|
|
401
403
|
return header
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Cryonirsp SP beam boundaries task."""
|
|
2
|
+
|
|
2
3
|
import math
|
|
3
4
|
|
|
4
5
|
import numpy as np
|
|
@@ -6,9 +7,9 @@ from dkist_service_configuration.logging import logger
|
|
|
6
7
|
|
|
7
8
|
from dkist_processing_cryonirsp.models.beam_boundaries import BeamBoundary
|
|
8
9
|
from dkist_processing_cryonirsp.tasks.beam_boundaries_base import BeamBoundariesCalibrationBase
|
|
9
|
-
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import ShiftMeasurementsMixin
|
|
10
10
|
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import SPATIAL
|
|
11
11
|
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import SPECTRAL
|
|
12
|
+
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import ShiftMeasurementsMixin
|
|
12
13
|
|
|
13
14
|
__all__ = ["SPBeamBoundariesCalibration"]
|
|
14
15
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Cryo SP geometric task."""
|
|
2
|
+
|
|
2
3
|
import math
|
|
3
4
|
|
|
4
5
|
import numpy as np
|
|
@@ -19,9 +20,9 @@ from dkist_processing_cryonirsp.parsers.cryonirsp_l0_fits_access import (
|
|
|
19
20
|
CryonirspLinearizedFitsAccess,
|
|
20
21
|
)
|
|
21
22
|
from dkist_processing_cryonirsp.tasks.cryonirsp_base import CryonirspTaskBase
|
|
22
|
-
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import ShiftMeasurementsMixin
|
|
23
23
|
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import SPATIAL
|
|
24
24
|
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import SPECTRAL
|
|
25
|
+
from dkist_processing_cryonirsp.tasks.mixin.shift_measurements import ShiftMeasurementsMixin
|
|
25
26
|
|
|
26
27
|
__all__ = ["SPGeometricCalibration"]
|
|
27
28
|
|
|
@@ -70,39 +71,39 @@ class SPGeometricCalibration(CryonirspTaskBase, ShiftMeasurementsMixin):
|
|
|
70
71
|
"""
|
|
71
72
|
# The basic corrections are done outside the loop structure below as it makes these loops much
|
|
72
73
|
# simpler than they would be otherwise. See the comments in do_basic_corrections for more details.
|
|
73
|
-
with self.
|
|
74
|
+
with self.telemetry_span("Basic corrections"):
|
|
74
75
|
self.do_basic_corrections()
|
|
75
76
|
|
|
76
77
|
for beam in range(1, self.constants.num_beams + 1):
|
|
77
|
-
with self.
|
|
78
|
-
with self.
|
|
78
|
+
with self.telemetry_span(f"Generating geometric calibrations for {beam = }"):
|
|
79
|
+
with self.telemetry_span(f"Computing and writing angle for {beam = }"):
|
|
79
80
|
angle = self.compute_beam_angle(beam=beam)
|
|
80
81
|
self.write_angle(angle=angle, beam=beam)
|
|
81
82
|
|
|
82
|
-
with self.
|
|
83
|
+
with self.telemetry_span(f"Removing angle from {beam = }"):
|
|
83
84
|
angle_corr_array = self.remove_beam_angle(angle=angle, beam=beam)
|
|
84
85
|
|
|
85
|
-
with self.
|
|
86
|
+
with self.telemetry_span(f"Computing offset for {beam = }"):
|
|
86
87
|
beam_offset = self.compute_offset(
|
|
87
88
|
array=angle_corr_array,
|
|
88
89
|
beam=beam,
|
|
89
90
|
)
|
|
90
91
|
self.write_beam_offset(offset=beam_offset, beam=beam)
|
|
91
92
|
|
|
92
|
-
with self.
|
|
93
|
+
with self.telemetry_span(f"Removing offset for {beam = }"):
|
|
93
94
|
self.remove_beam_offset(
|
|
94
95
|
array=angle_corr_array,
|
|
95
96
|
offset=beam_offset,
|
|
96
97
|
beam=beam,
|
|
97
98
|
)
|
|
98
99
|
|
|
99
|
-
with self.
|
|
100
|
+
with self.telemetry_span(f"Computing spectral shifts for {beam = }"):
|
|
100
101
|
spec_shifts = self.compute_spectral_shifts(beam=beam)
|
|
101
102
|
|
|
102
|
-
with self.
|
|
103
|
+
with self.telemetry_span(f"Writing spectral shifts for {beam = }"):
|
|
103
104
|
self.write_spectral_shifts(shifts=spec_shifts, beam=beam)
|
|
104
105
|
|
|
105
|
-
with self.
|
|
106
|
+
with self.telemetry_span("Computing and logging quality metrics"):
|
|
106
107
|
no_of_raw_geo_frames: int = self.scratch.count_all(
|
|
107
108
|
tags=[
|
|
108
109
|
CryonirspTag.linearized_frame(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Cryo SP solar gain task."""
|
|
2
|
+
|
|
2
3
|
import numpy as np
|
|
3
4
|
import scipy.ndimage as spnd
|
|
4
5
|
from dkist_processing_common.codecs.fits import fits_array_encoder
|
|
@@ -59,29 +60,31 @@ class SPSolarGainCalibration(CryonirspTaskBase):
|
|
|
59
60
|
"""
|
|
60
61
|
target_exposure_conditions = self.constants.solar_gain_exposure_conditions_list
|
|
61
62
|
|
|
62
|
-
with self.
|
|
63
|
+
with self.telemetry_span(
|
|
64
|
+
f"Computing SP gain calibrations for {target_exposure_conditions=}"
|
|
65
|
+
):
|
|
63
66
|
for exposure_conditions in target_exposure_conditions:
|
|
64
67
|
for beam in range(1, self.constants.num_beams + 1):
|
|
65
|
-
with self.
|
|
68
|
+
with self.telemetry_span(
|
|
66
69
|
f"Perform initial corrections for {beam = } and {exposure_conditions = }"
|
|
67
70
|
):
|
|
68
71
|
spectral_corrected_solar_array = self.do_initial_corrections(
|
|
69
72
|
beam=beam, exposure_conditions=exposure_conditions
|
|
70
73
|
)
|
|
71
74
|
|
|
72
|
-
with self.
|
|
75
|
+
with self.telemetry_span(
|
|
73
76
|
f"Compute the characteristic spectrum for {beam = } and {exposure_conditions = }"
|
|
74
77
|
):
|
|
75
78
|
char_spectrum = self.compute_char_spectrum(
|
|
76
79
|
array=spectral_corrected_solar_array, beam=beam
|
|
77
80
|
)
|
|
78
81
|
|
|
79
|
-
with self.
|
|
82
|
+
with self.telemetry_span(
|
|
80
83
|
f"Re-apply the spectral and geometric distortions for {beam = } and {exposure_conditions = }"
|
|
81
84
|
):
|
|
82
85
|
distorted_char_spectrum = self.distort_char_spectrum(char_spectrum)
|
|
83
86
|
|
|
84
|
-
with self.
|
|
87
|
+
with self.telemetry_span(
|
|
85
88
|
f"Remove the solar spectrum for {beam = } and {exposure_conditions = }"
|
|
86
89
|
):
|
|
87
90
|
# This is the final gain image, as we do not normalize
|
|
@@ -92,7 +95,7 @@ class SPSolarGainCalibration(CryonirspTaskBase):
|
|
|
92
95
|
)
|
|
93
96
|
|
|
94
97
|
if self.parameters.fringe_correction_on:
|
|
95
|
-
with self.
|
|
98
|
+
with self.telemetry_span(
|
|
96
99
|
f"Computing final solar gain based on fringe-corrected flux-scaled lamp gain for {beam = } and {exposure_conditions = }"
|
|
97
100
|
):
|
|
98
101
|
# Compute a solar gain based on a fringe-corrected lamp gain
|
|
@@ -100,7 +103,7 @@ class SPSolarGainCalibration(CryonirspTaskBase):
|
|
|
100
103
|
beam, exposure_conditions
|
|
101
104
|
)
|
|
102
105
|
|
|
103
|
-
with self.
|
|
106
|
+
with self.telemetry_span(
|
|
104
107
|
f"Writing the final solar gain array for {beam = } and {exposure_conditions = }"
|
|
105
108
|
):
|
|
106
109
|
self.write_solar_gain_calibration(
|
|
@@ -108,7 +111,7 @@ class SPSolarGainCalibration(CryonirspTaskBase):
|
|
|
108
111
|
beam=beam,
|
|
109
112
|
)
|
|
110
113
|
|
|
111
|
-
with self.
|
|
114
|
+
with self.telemetry_span("Computing and logging quality metrics"):
|
|
112
115
|
no_of_raw_solar_frames: int = self.scratch.count_all(
|
|
113
116
|
tags=[
|
|
114
117
|
CryonirspTag.linearized_frame(),
|
|
@@ -448,18 +451,18 @@ class SPSolarGainCalibration(CryonirspTaskBase):
|
|
|
448
451
|
"""
|
|
449
452
|
apm_str = f"{beam = } and {exposure_conditions = }"
|
|
450
453
|
|
|
451
|
-
with self.
|
|
454
|
+
with self.telemetry_span(f"Perform initial corrections for {apm_str}"):
|
|
452
455
|
corrected_solar_array = self.do_dark_and_bad_pixel_corrections(
|
|
453
456
|
beam=beam, exposure_conditions=exposure_conditions
|
|
454
457
|
)
|
|
455
458
|
|
|
456
|
-
with self.
|
|
459
|
+
with self.telemetry_span(f"Compute the flux-scaled lamp gain for {apm_str}"):
|
|
457
460
|
scaled_lamp_array = self.compute_flux_scaled_lamp_gain(corrected_solar_array, beam)
|
|
458
461
|
|
|
459
|
-
with self.
|
|
462
|
+
with self.telemetry_span(f"Apply spectral filtering for {apm_str}"):
|
|
460
463
|
filtered_lamp_array = self.apply_spectral_and_spatial_filtering(scaled_lamp_array)
|
|
461
464
|
|
|
462
|
-
with self.
|
|
465
|
+
with self.telemetry_span(f"Isolate and remove fringes for {apm_str}"):
|
|
463
466
|
final_gain_array = self.isolate_and_remove_fringes(
|
|
464
467
|
filtered_lamp_array, scaled_lamp_array
|
|
465
468
|
)
|