dkist-processing-test 1.14.1__tar.gz → 1.15.0__tar.gz

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.

Potentially problematic release.


This version of dkist-processing-test might be problematic. Click here for more details.

Files changed (41) hide show
  1. {dkist-processing-test-1.14.1/dkist_processing_test.egg-info → dkist-processing-test-1.15.0}/PKG-INFO +1 -1
  2. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/models/parameters.py +11 -8
  3. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/fake_science.py +5 -1
  4. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tests/test_parameters.py +3 -1
  5. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tests/test_tasks.py +27 -4
  6. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0/dkist_processing_test.egg-info}/PKG-INFO +1 -1
  7. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test.egg-info/requires.txt +5 -5
  8. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/setup.cfg +5 -5
  9. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/.gitignore +0 -0
  10. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/.pre-commit-config.yaml +0 -0
  11. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/README.rst +0 -0
  12. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/bitbucket-pipelines.yml +0 -0
  13. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/__init__.py +0 -0
  14. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/config.py +0 -0
  15. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/models/__init__.py +0 -0
  16. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/__init__.py +0 -0
  17. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/exercise_numba.py +0 -0
  18. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/fail.py +0 -0
  19. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/high_memory.py +0 -0
  20. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/manual.py +0 -0
  21. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/movie.py +0 -0
  22. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/noop.py +0 -0
  23. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/parse.py +0 -0
  24. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/quality.py +0 -0
  25. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/trial_output_data.py +0 -0
  26. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tasks/write_l1.py +0 -0
  27. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tests/__init__.py +0 -0
  28. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tests/conftest.py +0 -0
  29. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/tests/test_workflows.py +0 -0
  30. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/__init__.py +0 -0
  31. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/common_tasks.py +0 -0
  32. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/end_to_end.py +0 -0
  33. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/exercise_numba.py +0 -0
  34. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/fail.py +0 -0
  35. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/noop.py +0 -0
  36. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/resource_queue.py +0 -0
  37. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test/workflows/trial_end_to_end.py +0 -0
  38. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test.egg-info/SOURCES.txt +0 -0
  39. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test.egg-info/dependency_links.txt +0 -0
  40. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/dkist_processing_test.egg-info/top_level.txt +0 -0
  41. {dkist-processing-test-1.14.1 → dkist-processing-test-1.15.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dkist-processing-test
3
- Version: 1.14.1
3
+ Version: 1.15.0
4
4
  Summary: Example Instrument code that is used by the DKIST Science Data Processing pipelines to test processing infrastructure.
5
5
  Home-page: https://bitbucket.org/dkistdc/dkist-processing-test/src/main/
6
6
  Author: NSO / AURA
@@ -1,5 +1,6 @@
1
+ from datetime import datetime
2
+
1
3
  import numpy as np
2
- from astropy.io import fits
3
4
  from dkist_processing_common.models.parameters import ParameterBase
4
5
  from dkist_processing_common.models.parameters import ParameterWavelengthMixin
5
6
 
@@ -10,19 +11,21 @@ class TestParameters(ParameterBase, ParameterWavelengthMixin):
10
11
  @property
11
12
  def randomness(self) -> (float, float):
12
13
  """A dummy parameter that requires loading a file."""
13
- with open(self._find_most_recent_past_value("test_random_data")["param_path"], "rb") as f:
14
- data = fits.open(f)[0].data
15
- mean = np.nanmean(data)
16
- std = np.nanstd(data)
14
+ param_dict = self._find_most_recent_past_value(
15
+ "test_random_data", start_date=datetime.now()
16
+ )
17
+ data = self._load_param_value_from_fits(param_dict)
18
+ mean = np.nanmean(data)
19
+ std = np.nanstd(data)
17
20
 
18
21
  return mean, std
19
22
 
20
23
  @property
21
24
  def constant(self) -> float:
22
25
  """A dummy parameter that depends on the same file as a different parameter."""
23
- with open(self._find_most_recent_past_value("test_random_data")["param_path"], "rb") as f:
24
- data = fits.open(f)[1].data
25
- constant = np.median(data)
26
+ param_dict = self._find_most_recent_past_value("test_random_data")
27
+ data = self._load_param_value_from_fits(param_dict, hdu=1)
28
+ constant = np.median(data)
26
29
 
27
30
  return float(constant)
28
31
 
@@ -31,7 +31,11 @@ class GenerateCalibratedData(WorkflowTaskBase, InputDatasetMixin):
31
31
  workflow_name=workflow_name,
32
32
  workflow_version=workflow_version,
33
33
  )
34
- self.parameters = TestParameters(self.input_dataset_parameters, wavelength=2.0)
34
+ self.parameters = TestParameters(
35
+ self.input_dataset_parameters,
36
+ obs_ip_start_time=self.constants.obs_ip_start_time,
37
+ wavelength=2.0,
38
+ )
35
39
 
36
40
  def run(self):
37
41
  rng = np.random.default_rng()
@@ -70,7 +70,9 @@ def task_with_parameters(parameter_dict_with_path):
70
70
  workflow_name=workflow_name,
71
71
  workflow_version=workflow_version,
72
72
  )
73
- self.parameters = TestParameters(parameter_dict_with_path, wavelength=2.0)
73
+ self.parameters = TestParameters(
74
+ parameter_dict_with_path, wavelength=2.0, obs_ip_start_time="2024-06-11T12:00:00"
75
+ )
74
76
 
75
77
  def run(self):
76
78
  """Do stuff."""
@@ -4,6 +4,7 @@ Tests for the tasks defined in this repo
4
4
  import json
5
5
  from dataclasses import asdict
6
6
  from dataclasses import dataclass
7
+ from dataclasses import is_dataclass
7
8
  from datetime import datetime
8
9
  from random import randint
9
10
  from uuid import uuid4
@@ -16,6 +17,7 @@ from dkist_header_validator import spec122_validator
16
17
  from dkist_processing_common._util.scratch import WorkflowFileSystem
17
18
  from dkist_processing_common.codecs.fits import fits_hdu_decoder
18
19
  from dkist_processing_common.codecs.fits import fits_hdulist_encoder
20
+ from dkist_processing_common.models.constants import ConstantsBase
19
21
  from dkist_processing_common.models.tags import Tag
20
22
  from dkist_processing_common.tests.conftest import FakeGQLClient
21
23
  from dkist_service_configuration.logging import logger
@@ -36,6 +38,7 @@ from dkist_processing_test.tests.conftest import S122Headers
36
38
  @dataclass
37
39
  class FakeConstantDb:
38
40
  NUM_DSPS_REPEATS: int = 2
41
+ OBS_IP_START_TIME: str = "2024-06-12T12:00:00"
39
42
  INSTRUMENT: str = "TEST"
40
43
  AVERAGE_CADENCE: float = 10.0
41
44
  MINIMUM_CADENCE: float = 10.0
@@ -85,16 +88,19 @@ def generate_calibrated_data_task(
85
88
  tmp_path,
86
89
  recipe_run_id,
87
90
  assign_input_dataset_doc_to_task,
91
+ link_constants_db,
88
92
  parameter_file_object_key,
89
93
  random_parameter_hdulist,
90
94
  ):
91
95
  number_of_frames = 10
96
+ link_constants_db(
97
+ recipe_run_id=recipe_run_id, constants_obj=FakeConstantDb(NUM_DSPS_REPEATS=number_of_frames)
98
+ )
92
99
  with GenerateCalibratedData(
93
100
  recipe_run_id=recipe_run_id, workflow_name="GenerateCalibratedData", workflow_version="VX.Y"
94
101
  ) as task:
95
102
  # configure input data
96
103
  task.scratch = WorkflowFileSystem(scratch_base_path=tmp_path, recipe_run_id=recipe_run_id)
97
- task.constants._update(asdict(FakeConstantDb(NUM_DSPS_REPEATS=number_of_frames)))
98
104
  input_frame_set = Spec122Dataset(
99
105
  instrument="vbi",
100
106
  dataset_shape=(number_of_frames, 512, 512),
@@ -121,7 +127,7 @@ def generate_calibrated_data_task(
121
127
  )
122
128
 
123
129
  # This needs to be after we've tagged the parameter file
124
- assign_input_dataset_doc_to_task(task)
130
+ assign_input_dataset_doc_to_task(task, obs_ip_start_time=task.constants.obs_ip_start_time)
125
131
 
126
132
  # result
127
133
  yield task, number_of_frames
@@ -172,7 +178,7 @@ def assign_input_dataset_doc_to_task(
172
178
  input_dataset_document_parameters_part_with_file,
173
179
  input_dataset_document_parameters_part_with_wavelength,
174
180
  ):
175
- def update_task(task):
181
+ def update_task(task, obs_ip_start_time=None):
176
182
  doc_path = task.scratch.workflow_base_path / "dataset_parameters.json"
177
183
  full_parameters = (
178
184
  input_dataset_document_parameters_part_with_file
@@ -181,11 +187,28 @@ def assign_input_dataset_doc_to_task(
181
187
  with open(doc_path, "w") as f:
182
188
  f.write(json.dumps(full_parameters))
183
189
  task.tag(doc_path, Tag.input_dataset_parameters())
184
- task.parameters = TestParameters(task.input_dataset_parameters, wavelength=2.0)
190
+ task.parameters = TestParameters(
191
+ task.input_dataset_parameters, wavelength=2.0, obs_ip_start_time=obs_ip_start_time
192
+ )
185
193
 
186
194
  return update_task
187
195
 
188
196
 
197
+ @pytest.fixture
198
+ def link_constants_db():
199
+ return constants_linker
200
+
201
+
202
+ def constants_linker(recipe_run_id: int, constants_obj):
203
+ """Take a dataclass (or dict) containing a constants DB and link it to a specific recipe run id."""
204
+ if is_dataclass(constants_obj):
205
+ constants_obj = asdict(constants_obj)
206
+ constants = ConstantsBase(recipe_run_id=recipe_run_id, task_name="test")
207
+ constants._purge()
208
+ constants._update(constants_obj)
209
+ return
210
+
211
+
189
212
  def test_generate_calibrated_data(generate_calibrated_data_task, mocker):
190
213
  """
191
214
  Given: A GenerateCalibratedData task
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dkist-processing-test
3
- Version: 1.14.1
3
+ Version: 1.15.0
4
4
  Summary: Example Instrument code that is used by the DKIST Science Data Processing pipelines to test processing infrastructure.
5
5
  Home-page: https://bitbucket.org/dkistdc/dkist-processing-test/src/main/
6
6
  Author: NSO / AURA
@@ -1,10 +1,10 @@
1
- dkist-processing-common==7.0.0
1
+ dkist-processing-common==8.0.0
2
2
  dkist-header-validator==5.1.0
3
3
  dkist-service-configuration==2.2
4
- dkist-fits-specifications==4.2.0
5
- numba==0.57.1
6
- astropy==5.3.0
7
- numpy==1.24.3
4
+ dkist-fits-specifications==4.3.0
5
+ numba==0.59.1
6
+ astropy==6.1.0
7
+ numpy==1.26.4
8
8
  dkist-spectral-lines==3.0.0
9
9
 
10
10
  [asdf]
@@ -17,13 +17,13 @@ setup_requires = setuptools_scm
17
17
  packages = find:
18
18
  include_package_data = True
19
19
  install_requires =
20
- dkist-processing-common == 7.0.0
20
+ dkist-processing-common == 8.0.0
21
21
  dkist-header-validator == 5.1.0
22
22
  dkist-service-configuration == 2.2
23
- dkist-fits-specifications == 4.2.0
24
- numba == 0.57.1
25
- astropy == 5.3.0
26
- numpy == 1.24.3
23
+ dkist-fits-specifications == 4.3.0
24
+ numba == 0.59.1
25
+ astropy == 6.1.0
26
+ numpy == 1.26.4
27
27
  dkist-spectral-lines == 3.0.0
28
28
 
29
29
  [options.extras_require]