dkist-processing-ops 1.6.6rc1__py3-none-any.whl → 1.6.8__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.6rc1'
16
- __version_tuple__ = version_tuple = (1, 6, 6)
15
+ __version__ = version = '1.6.8'
16
+ __version_tuple__ = version_tuple = (1, 6, 8)
@@ -1,55 +1,59 @@
1
+ import os
1
2
  from abc import ABC
2
3
  from pathlib import Path
4
+ from typing import Any
5
+ from typing import Generator
3
6
 
4
7
  import numpy as np
5
8
  from astropy.io import fits
6
9
  from dkist_processing_common.codecs.fits import fits_hdu_decoder
10
+ from dkist_processing_common.codecs.path import path_decoder
7
11
  from dkist_processing_common.models.tags import Tag
12
+ from dkist_processing_common.tasks import tag_type_hint
8
13
  from dkist_processing_common.tasks import WorkflowTaskBase
9
14
 
10
15
 
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
+ def yield_from_read(
17
+ self, tags: tag_type_hint, decoder: callable = path_decoder, **decoder_kwargs
18
+ ) -> Generator[Any, None, None]:
19
+ yield from (decoder(p, **decoder_kwargs) for p in self.scratch.find_all(tags=tags))
16
20
 
17
21
 
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
22
+ def binary_decoder(path: Path) -> bytes:
23
+ """Generates a random blob of binary data."""
24
+ return os.urandom(67109008) # This is the size of the VBI data arrays, in bytes
33
25
 
34
26
 
35
27
  class FitsDataRead(WorkflowTaskBase, ABC):
36
28
  @property
37
- def fits_data_read_strategy(self) -> str:
29
+ def data_type(self) -> str:
38
30
  """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
- )
31
+ return self.metadata_store_recipe_run_configuration().get("data_type", "fits")
32
+
33
+ @property
34
+ def read_method(self):
35
+ return self.metadata_store_recipe_run_configuration().get("read_method", "return")
42
36
 
43
37
  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)
38
+ if self.data_type == "fits":
39
+ if self.read_method == "return":
40
+ hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder)
41
+ for hdu in hdus:
42
+ pass
43
+ if self.read_method == "yield":
44
+ hdus = yield_from_read(
45
+ self, tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder
46
+ )
47
+ for hdu in hdus:
48
+ pass
49
+ if self.data_type == "binary":
50
+ if self.read_method == "return":
51
+ hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=binary_decoder)
52
+ for hdu in hdus:
53
+ pass
54
+ if self.read_method == "yield":
55
+ hdus = yield_from_read(
56
+ self, tags=[Tag.input(), Tag.frame()], decoder=binary_decoder
57
+ )
58
+ for hdu in hdus:
59
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dkist-processing-ops
3
- Version: 1.6.6rc1
3
+ Version: 1.6.8
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
@@ -1,16 +1,16 @@
1
1
  dkist_processing_ops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- dkist_processing_ops/_version.py,sha256=9RAIDmiss1RtRR-GQ0-8xTf_pW-cAasYjCvLV9-OMCY,414
2
+ dkist_processing_ops/_version.py,sha256=cmsiv9CCkKr77S4CsQCya3nhc7DDRNXIH_h8pHWpeYE,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
+ dkist_processing_ops/tasks/read_memory_leak.py,sha256=G7i-u9hmHbtEUbAwJB-ESPxLhWHeiZ0JbPlyIN9HE-g,2222
6
6
  dkist_processing_ops/tasks/wait.py,sha256=uObka-nH1dKPcGBDsp3t2RCtTV2F1kksM0V-lRewFuY,273
7
7
  dkist_processing_ops/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  dkist_processing_ops/tests/test_workflows.py,sha256=Ch_8BlGeQyPJU_9hB_GOncwW-SoZwpRUVKMOEz0RQZk,285
9
9
  dkist_processing_ops/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  dkist_processing_ops/workflows/memory_leak.py,sha256=lYXAYyJVjXif3Os9xPDp-bPTG_je6HOw1uvRJ4WMUi4,758
11
11
  dkist_processing_ops/workflows/smoke.py,sha256=ofXu0_iYF6L3zQy-BOVvS5VdzKhmXs1gyugqMNkd-GM,878
12
- dkist_processing_ops-1.6.6rc1.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
13
- dkist_processing_ops-1.6.6rc1.dist-info/METADATA,sha256=gCkBfRYvIBcc5uvCqbhxvH3wRxIR7xCthuIVpsK-j5Y,1502
14
- dkist_processing_ops-1.6.6rc1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
- dkist_processing_ops-1.6.6rc1.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
16
- dkist_processing_ops-1.6.6rc1.dist-info/RECORD,,
12
+ dkist_processing_ops-1.6.8.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
13
+ dkist_processing_ops-1.6.8.dist-info/METADATA,sha256=fBQTb9H9LispuQPBP2ibCEQhlkOypuriQjJXxOf0EV8,1499
14
+ dkist_processing_ops-1.6.8.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
+ dkist_processing_ops-1.6.8.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
16
+ dkist_processing_ops-1.6.8.dist-info/RECORD,,