dkist-processing-dlnirsp 0.32.9__py3-none-any.whl → 0.33.0__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.
- dkist_processing_dlnirsp/models/constants.py +6 -0
- dkist_processing_dlnirsp/models/parameters.py +33 -3
- dkist_processing_dlnirsp/parsers/task.py +2 -25
- dkist_processing_dlnirsp/parsers/time.py +2 -2
- dkist_processing_dlnirsp/tasks/__init__.py +1 -2
- dkist_processing_dlnirsp/tasks/movie.py +1121 -0
- dkist_processing_dlnirsp/tasks/parse.py +13 -8
- dkist_processing_dlnirsp/tasks/solar.py +129 -30
- dkist_processing_dlnirsp/tests/conftest.py +45 -6
- dkist_processing_dlnirsp/tests/local_trial_workflows/l0_polcals_as_science.py +21 -18
- dkist_processing_dlnirsp/tests/local_trial_workflows/l0_solar_gain_as_science.py +21 -18
- dkist_processing_dlnirsp/tests/local_trial_workflows/l0_to_l1.py +21 -18
- dkist_processing_dlnirsp/tests/local_trial_workflows/local_trial_dev_mockers.py +1 -1
- dkist_processing_dlnirsp/tests/test_dlnirsp_constants.py +2 -0
- dkist_processing_dlnirsp/tests/test_movie.py +141 -0
- dkist_processing_dlnirsp/tests/test_parameters.py +8 -0
- dkist_processing_dlnirsp/tests/test_parse.py +10 -0
- dkist_processing_dlnirsp/tests/test_science.py +0 -9
- dkist_processing_dlnirsp/tests/test_solar.py +114 -17
- dkist_processing_dlnirsp/workflows/l0_processing.py +6 -8
- dkist_processing_dlnirsp/workflows/trial_workflow.py +7 -7
- {dkist_processing_dlnirsp-0.32.9.dist-info → dkist_processing_dlnirsp-0.33.0.dist-info}/METADATA +41 -24
- {dkist_processing_dlnirsp-0.32.9.dist-info → dkist_processing_dlnirsp-0.33.0.dist-info}/RECORD +27 -29
- docs/gain.rst +7 -3
- dkist_processing_dlnirsp/tasks/assemble_movie.py +0 -150
- dkist_processing_dlnirsp/tasks/make_movie_frames.py +0 -156
- dkist_processing_dlnirsp/tests/test_assemble_movie.py +0 -169
- dkist_processing_dlnirsp/tests/test_make_movie_frames.py +0 -98
- {dkist_processing_dlnirsp-0.32.9.dist-info → dkist_processing_dlnirsp-0.33.0.dist-info}/WHEEL +0 -0
- {dkist_processing_dlnirsp-0.32.9.dist-info → dkist_processing_dlnirsp-0.33.0.dist-info}/entry_points.txt +0 -0
- {dkist_processing_dlnirsp-0.32.9.dist-info → dkist_processing_dlnirsp-0.33.0.dist-info}/top_level.txt +0 -0
|
@@ -30,6 +30,7 @@ class DlnirspBudName(Enum):
|
|
|
30
30
|
grating_constant_inverse_mm = "GRATING_CONSTANT_INVERSE_MM"
|
|
31
31
|
grating_position_deg = "GRATING_POSITION_DEG"
|
|
32
32
|
solar_gain_ip_start_time = "SOLAR_GAIN_IP_START_TIME"
|
|
33
|
+
obs_ip_end_time = "OBS_IP_END_TIME"
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
VIS_ARM_NAMES = ["VIS".casefold()]
|
|
@@ -170,3 +171,8 @@ class DlnirspConstants(ConstantsBase):
|
|
|
170
171
|
def grating_position_deg(self) -> u.Quantity:
|
|
171
172
|
"""Grating position angle (deg)."""
|
|
172
173
|
return self._db_dict[DlnirspBudName.grating_position_deg.value] * u.deg
|
|
174
|
+
|
|
175
|
+
@property
|
|
176
|
+
def obs_ip_end_time(self) -> str:
|
|
177
|
+
"""Return the IP end time of the observe OP."""
|
|
178
|
+
return self._db_dict[DlnirspBudName.obs_ip_end_time.value]
|
|
@@ -114,7 +114,7 @@ class DlnirspParameters(ParameterBase, ParameterArmIdMixin):
|
|
|
114
114
|
return self._load_param_value_from_fits(param_obj)
|
|
115
115
|
|
|
116
116
|
@property
|
|
117
|
-
def bad_pixel_gain_median_smooth_size(self) ->
|
|
117
|
+
def bad_pixel_gain_median_smooth_size(self) -> list[int]:
|
|
118
118
|
"""
|
|
119
119
|
Define the size of the median window used when smoothing lamp gain data to identify bad pixels.
|
|
120
120
|
|
|
@@ -123,7 +123,7 @@ class DlnirspParameters(ParameterBase, ParameterArmIdMixin):
|
|
|
123
123
|
return self._find_most_recent_past_value("dlnirsp_bad_pixel_gain_median_smooth_size")
|
|
124
124
|
|
|
125
125
|
@property
|
|
126
|
-
def bad_pixel_dark_median_smooth_size(self) ->
|
|
126
|
+
def bad_pixel_dark_median_smooth_size(self) -> list[int]:
|
|
127
127
|
"""
|
|
128
128
|
Define the size of the median window used when smoothing dark sigma data to identify bad pixels.
|
|
129
129
|
|
|
@@ -193,7 +193,7 @@ class DlnirspParameters(ParameterBase, ParameterArmIdMixin):
|
|
|
193
193
|
return self._find_most_recent_past_value("dlnirsp_pac_fit_mode")
|
|
194
194
|
|
|
195
195
|
@property
|
|
196
|
-
def lamp_despike_kernel(self) ->
|
|
196
|
+
def lamp_despike_kernel(self) -> list[float]:
|
|
197
197
|
"""Return the (x, y) stddev of the Gaussian kernel used for lamp despiking."""
|
|
198
198
|
return self._find_most_recent_past_value("dlnirsp_lamp_despike_kernel")
|
|
199
199
|
|
|
@@ -356,3 +356,33 @@ class DlnirspParameters(ParameterBase, ParameterArmIdMixin):
|
|
|
356
356
|
The specified method must exist in `~dkist_processing_dlnirsp.tasks.science.ScienceCalibration.apply_WCS_corrections`.
|
|
357
357
|
"""
|
|
358
358
|
return self._find_most_recent_past_value("dlnirsp_wcs_crpix_correction_method")
|
|
359
|
+
|
|
360
|
+
@property
|
|
361
|
+
def movie_core_wave_value_nm(self) -> float:
|
|
362
|
+
"""Define the wavelength to use when plotting a spectral line core in quicklook movies."""
|
|
363
|
+
return self._find_parameter_for_arm("dlnirsp_movie_core_wave_value_nm")
|
|
364
|
+
|
|
365
|
+
@property
|
|
366
|
+
def movie_cont_wave_value_nm(self) -> float:
|
|
367
|
+
"""Define te wavelength to use when plotting continuum signal in quicklook movies."""
|
|
368
|
+
return self._find_parameter_for_arm("dlnirsp_movie_cont_wave_value_nm")
|
|
369
|
+
|
|
370
|
+
@property
|
|
371
|
+
def movie_vertical_nan_slices(self) -> list[slice]:
|
|
372
|
+
"""
|
|
373
|
+
Define slices of known-to-be-bad data regions in the remapped IFU cube's "vertical" dimension.
|
|
374
|
+
|
|
375
|
+
These regions are caused by slight over-sizing of the group ID array. There is no data here, but it gets mapped
|
|
376
|
+
to the IFU cube and "looks" bad if we don't mask it out.
|
|
377
|
+
"""
|
|
378
|
+
index_list = self._find_most_recent_past_value("dlnirsp_movie_vertical_nan_slices")
|
|
379
|
+
return [slice(i[0], i[1]) for i in index_list]
|
|
380
|
+
|
|
381
|
+
@property
|
|
382
|
+
def movie_nan_replacement_kernel_shape(self) -> list[int]:
|
|
383
|
+
"""
|
|
384
|
+
Define the shape of the kernel used to `interpolate_and_replace_nans` when building mosaic images for the movie.
|
|
385
|
+
|
|
386
|
+
The kernel will be exactly `np.ones(movie_nan_replacement_kernel_shape)`.
|
|
387
|
+
"""
|
|
388
|
+
return self._find_most_recent_past_value("dlnirsp_movie_nan_replacement_kernel_shape")
|
|
@@ -2,37 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from dkist_processing_common.models.fits_access import MetadataKey
|
|
4
4
|
from dkist_processing_common.models.tags import StemName
|
|
5
|
-
from dkist_processing_common.models.task_name import TaskName
|
|
6
5
|
from dkist_processing_common.parsers.single_value_single_key_flower import (
|
|
7
6
|
SingleValueSingleKeyFlower,
|
|
8
7
|
)
|
|
8
|
+
from dkist_processing_common.parsers.task import parse_header_ip_task_with_gains
|
|
9
9
|
|
|
10
10
|
from dkist_processing_dlnirsp.parsers.dlnirsp_l0_fits_access import DlnirspL0FitsAccess
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def parse_header_ip_task(fits_obj: DlnirspL0FitsAccess) -> str:
|
|
14
|
-
"""
|
|
15
|
-
Parse DLNIRSP tasks from a combination of header values.
|
|
16
|
-
|
|
17
|
-
Parameters
|
|
18
|
-
----------
|
|
19
|
-
fits_obj:
|
|
20
|
-
A single FitsAccess object
|
|
21
|
-
"""
|
|
22
|
-
# Distinguish between lamp and solar gains
|
|
23
|
-
if (
|
|
24
|
-
fits_obj.ip_task_type == "gain"
|
|
25
|
-
and fits_obj.gos_level3_status == "lamp"
|
|
26
|
-
and fits_obj.gos_level3_lamp_status == "on"
|
|
27
|
-
):
|
|
28
|
-
return TaskName.lamp_gain.value
|
|
29
|
-
if fits_obj.ip_task_type == "gain" and fits_obj.gos_level3_status == "clear":
|
|
30
|
-
return TaskName.solar_gain.value
|
|
31
|
-
|
|
32
|
-
# Everything else is unchanged
|
|
33
|
-
return fits_obj.ip_task_type
|
|
34
|
-
|
|
35
|
-
|
|
36
13
|
class DlnirspTaskTypeFlower(SingleValueSingleKeyFlower):
|
|
37
14
|
"""Flower to find the DLNIRSP task type."""
|
|
38
15
|
|
|
@@ -48,4 +25,4 @@ class DlnirspTaskTypeFlower(SingleValueSingleKeyFlower):
|
|
|
48
25
|
fits_obj:
|
|
49
26
|
A single FitsAccess object
|
|
50
27
|
"""
|
|
51
|
-
return
|
|
28
|
+
return parse_header_ip_task_with_gains(fits_obj)
|
|
@@ -5,11 +5,11 @@ from typing import Hashable
|
|
|
5
5
|
from dkist_processing_common.models.fits_access import MetadataKey
|
|
6
6
|
from dkist_processing_common.models.flower_pot import Stem
|
|
7
7
|
from dkist_processing_common.models.task_name import TaskName
|
|
8
|
+
from dkist_processing_common.parsers.task import parse_header_ip_task_with_gains
|
|
8
9
|
from dkist_processing_common.parsers.unique_bud import TaskUniqueBud
|
|
9
10
|
|
|
10
11
|
from dkist_processing_dlnirsp.models.constants import DlnirspBudName
|
|
11
12
|
from dkist_processing_dlnirsp.parsers.dlnirsp_l0_fits_access import DlnirspRampFitsAccess
|
|
12
|
-
from dkist_processing_dlnirsp.parsers.task import parse_header_ip_task
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class DLnirspSolarGainIpStartTimeBud(TaskUniqueBud):
|
|
@@ -20,7 +20,7 @@ class DLnirspSolarGainIpStartTimeBud(TaskUniqueBud):
|
|
|
20
20
|
constant_name=DlnirspBudName.solar_gain_ip_start_time.value,
|
|
21
21
|
metadata_key=MetadataKey.ip_start_time,
|
|
22
22
|
ip_task_types=TaskName.solar_gain.value,
|
|
23
|
-
task_type_parsing_function=
|
|
23
|
+
task_type_parsing_function=parse_header_ip_task_with_gains,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"""Top-level tasks that can be assembled into a pipeline workflow."""
|
|
2
2
|
|
|
3
|
-
from dkist_processing_dlnirsp.tasks.assemble_movie import *
|
|
4
3
|
from dkist_processing_dlnirsp.tasks.bad_pixel_map import *
|
|
5
4
|
from dkist_processing_dlnirsp.tasks.dark import *
|
|
6
5
|
from dkist_processing_dlnirsp.tasks.geometric import *
|
|
@@ -9,7 +8,7 @@ from dkist_processing_dlnirsp.tasks.instrument_polarization import *
|
|
|
9
8
|
from dkist_processing_dlnirsp.tasks.l1_output_data import *
|
|
10
9
|
from dkist_processing_dlnirsp.tasks.lamp import *
|
|
11
10
|
from dkist_processing_dlnirsp.tasks.linearity_correction import *
|
|
12
|
-
from dkist_processing_dlnirsp.tasks.
|
|
11
|
+
from dkist_processing_dlnirsp.tasks.movie import *
|
|
13
12
|
from dkist_processing_dlnirsp.tasks.parse import *
|
|
14
13
|
from dkist_processing_dlnirsp.tasks.quality_metrics import *
|
|
15
14
|
from dkist_processing_dlnirsp.tasks.science import *
|