dkist-processing-ops 1.6.4__py3-none-any.whl → 1.6.6__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.

Potentially problematic release.


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

@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.6.4'
16
- __version_tuple__ = version_tuple = (1, 6, 4)
15
+ __version__ = version = '1.6.6'
16
+ __version_tuple__ = version_tuple = (1, 6, 6)
@@ -0,0 +1,55 @@
1
+ from abc import ABC
2
+ from pathlib import Path
3
+
4
+ import numpy as np
5
+ from astropy.io import fits
6
+ from dkist_processing_common.codecs.fits import fits_hdu_decoder
7
+ from dkist_processing_common.models.tags import Tag
8
+ from dkist_processing_common.tasks import WorkflowTaskBase
9
+
10
+
11
+ def _extract_hdu(hdul: fits.HDUList) -> fits.PrimaryHDU | fits.CompImageHDU:
12
+ """Return the fits hdu associated with the data in the hdu list."""
13
+ if hdul[0].data is not None:
14
+ return hdul[0]
15
+ return hdul[1]
16
+
17
+
18
+ def fits_hdu_decoder_with_close(path: Path) -> fits.PrimaryHDU | fits.CompImageHDU:
19
+ """Read a Path with `fits` to produce an `HDUList`."""
20
+ hdu_list = fits.open(path, memmap=False)
21
+ hdu_to_return = _extract_hdu(hdu_list).copy()
22
+ hdu_list.close()
23
+ return hdu_to_return
24
+
25
+
26
+ def fits_hdu_decoder_with_close_and_del(path: Path) -> fits.PrimaryHDU | fits.CompImageHDU:
27
+ """Read a Path with `fits` to produce an `HDUList`."""
28
+ hdu_list = fits.open(path, memmap=False)
29
+ hdu_to_return = _extract_hdu(hdu_list).copy()
30
+ hdu_list.close()
31
+ del hdu_list
32
+ return hdu_to_return
33
+
34
+
35
+ class FitsDataRead(WorkflowTaskBase, ABC):
36
+ @property
37
+ def fits_data_read_strategy(self) -> str:
38
+ """Recipe run configuration indicating how fFITS data should be read."""
39
+ return self.metadata_store_recipe_run_configuration().get(
40
+ "fits_data_read_strategy", "leave_open"
41
+ )
42
+
43
+ def run(self) -> None:
44
+ if self.fits_data_read_strategy == "leave_open":
45
+ hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder)
46
+ if self.fits_data_read_strategy == "close":
47
+ hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder_with_close)
48
+ if self.fits_data_read_strategy == "close_and_del":
49
+ hdus = self.read(
50
+ tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder_with_close_and_del
51
+ )
52
+ for hdu in hdus:
53
+ data = hdu.data
54
+ header = hdu.header
55
+ total = np.sum(data)
@@ -0,0 +1,22 @@
1
+ from dkist_processing_common.tasks import TransferL0Data
2
+ from dkist_processing_common.tasks import TrialTeardown
3
+ from dkist_processing_core import ResourceQueue
4
+ from dkist_processing_core import Workflow
5
+
6
+ from dkist_processing_ops.tasks.read_memory_leak import FitsDataRead
7
+
8
+ ops_investigation = Workflow(
9
+ input_data="ops",
10
+ output_data="common",
11
+ category="investigation",
12
+ workflow_package=__package__,
13
+ )
14
+ ops_investigation.add_node(
15
+ task=TransferL0Data, upstreams=None, resource_queue=ResourceQueue.DEFAULT
16
+ )
17
+ ops_investigation.add_node(
18
+ task=FitsDataRead, upstreams=TransferL0Data, resource_queue=ResourceQueue.DEFAULT
19
+ )
20
+ ops_investigation.add_node(
21
+ task=TrialTeardown, upstreams=FitsDataRead, resource_queue=ResourceQueue.DEFAULT
22
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dkist-processing-ops
3
- Version: 1.6.4
3
+ Version: 1.6.6
4
4
  Summary: Automated Processing smoke test and operations workflows
5
5
  Author-email: NSO / AURA <dkistdc@nso.edu>
6
6
  License: BSD 3-Clause
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Requires-Python: >=3.11
12
12
  Description-Content-Type: text/x-rst
13
13
  License-File: LICENSE.rst
14
- Requires-Dist: dkist-processing-common ==10.2.2
14
+ Requires-Dist: dkist-processing-common ==10.3.0
15
15
  Requires-Dist: dkist-service-configuration ==2.3.0
16
16
  Provides-Extra: test
17
17
  Requires-Dist: pytest ; extra == 'test'
@@ -1,14 +1,16 @@
1
1
  dkist_processing_ops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- dkist_processing_ops/_version.py,sha256=nUUf9xc-xNn7sMTK7c2rpMt1p2OZlNNmLiVGIkTETu8,411
2
+ dkist_processing_ops/_version.py,sha256=Nz1l8vGPOAOAlxWDepNu28nfH9fOKk0GnGSnVyZJsFE,411
3
3
  dkist_processing_ops/dags/scale.py,sha256=We5TYjNhkJ-5ykfbrOMgjTpXdzOCkIeyKyA-40sU9r0,2312
4
4
  dkist_processing_ops/tasks/__init__.py,sha256=P81O9cg4dlBMqBTaWitdsAte68RsMtDlhV30JSZfXUY,107
5
+ dkist_processing_ops/tasks/read_memory_leak.py,sha256=5k9s6CpH4EhtKfWoqsVlWs3LnG6IhvtsV2pFwlE0ySQ,2046
5
6
  dkist_processing_ops/tasks/wait.py,sha256=uObka-nH1dKPcGBDsp3t2RCtTV2F1kksM0V-lRewFuY,273
6
7
  dkist_processing_ops/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
8
  dkist_processing_ops/tests/test_workflows.py,sha256=Ch_8BlGeQyPJU_9hB_GOncwW-SoZwpRUVKMOEz0RQZk,285
8
9
  dkist_processing_ops/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ dkist_processing_ops/workflows/memory_leak.py,sha256=lYXAYyJVjXif3Os9xPDp-bPTG_je6HOw1uvRJ4WMUi4,758
9
11
  dkist_processing_ops/workflows/smoke.py,sha256=ofXu0_iYF6L3zQy-BOVvS5VdzKhmXs1gyugqMNkd-GM,878
10
- dkist_processing_ops-1.6.4.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
11
- dkist_processing_ops-1.6.4.dist-info/METADATA,sha256=5BP4OVp4IRUclPuNEgnyCcxmFQLKuMO0fcHW8evTThI,1499
12
- dkist_processing_ops-1.6.4.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
13
- dkist_processing_ops-1.6.4.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
14
- dkist_processing_ops-1.6.4.dist-info/RECORD,,
12
+ dkist_processing_ops-1.6.6.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
13
+ dkist_processing_ops-1.6.6.dist-info/METADATA,sha256=vF9GwFw5XbQeqkpDcBtwQPpWaEyEc05Cze3jsIIPxQM,1499
14
+ dkist_processing_ops-1.6.6.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
+ dkist_processing_ops-1.6.6.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
16
+ dkist_processing_ops-1.6.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5