dkist-processing-ops 1.6.12__py3-none-any.whl → 1.6.14__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.12'
16
- __version_tuple__ = version_tuple = (1, 6, 12)
15
+ __version__ = version = '1.6.14'
16
+ __version_tuple__ = version_tuple = (1, 6, 14)
@@ -1,79 +1,74 @@
1
- import logging
2
- import os
3
- import sys
1
+ import gc
4
2
  from abc import ABC
5
3
  from pathlib import Path
6
- from typing import Any
7
- from typing import Generator
8
4
 
9
5
  import numpy as np
10
6
  from astropy.io import fits
7
+ from dkist_processing_common.codecs.fits import fits_hdu_decoder
11
8
  from dkist_processing_common.codecs.path import path_decoder
12
9
  from dkist_processing_common.models.tags import Tag
13
- from dkist_processing_common.tasks import tag_type_hint
14
10
  from dkist_processing_common.tasks import WorkflowTaskBase
15
11
 
16
12
 
17
- def yield_from_read(
18
- self, tags: tag_type_hint, decoder: callable = path_decoder, **decoder_kwargs
19
- ) -> Generator[Any, None, None]:
20
- yield from (decoder(p, **decoder_kwargs) for p in self.scratch.find_all(tags=tags))
13
+ def generated_hdu_decoder(path: Path) -> fits.PrimaryHDU | fits.CompImageHDU:
14
+ data = np.random.rand(4096, 4096)
15
+ hdu = fits.CompImageHDU(data)
16
+ return hdu
21
17
 
22
18
 
23
- def binary_decoder(path: Path) -> bytes:
24
- """Generates a random blob of binary data."""
25
- data = os.urandom(67109008) # This is the size of the VBI data arrays, in bytes
26
- logging.info(f"Size of data: {sys.getsizeof(data)}")
27
- logging.info(f"Bytes of data: {len(data)}")
28
- return data
29
-
30
-
31
- def fits_smart_hdu_decoder(path: Path) -> fits.PrimaryHDU | fits.CompImageHDU:
32
- """Read a Path with `fits` to produce an `HDUList`."""
33
- hdu_list = fits.open(path, lazy_load_hdus=False)
34
- return hdu_list[1]
19
+ def fits_garbage_collect_hdu_decoder(path: Path) -> fits.PrimaryHDU | fits.CompImageHDU:
20
+ hdul = fits.open(path)
21
+ hdu = fits.CompImageHDU(header=hdul[1].header, data=hdul[1].data)
22
+ hdul.close()
23
+ del hdul
24
+ gc.collect()
25
+ return hdu
35
26
 
36
27
 
37
28
  class FitsDataRead(WorkflowTaskBase, ABC):
38
29
  @property
39
- def data_type(self) -> str:
40
- """Recipe run configuration indicating how fFITS data should be read."""
41
- return self.metadata_store_recipe_run_configuration().get("data_type", "fits")
30
+ def run_type(self):
31
+ return self.metadata_store_recipe_run_configuration().get("run_type", "file_read")
42
32
 
43
- @property
44
- def read_method(self):
45
- return self.metadata_store_recipe_run_configuration().get("read_method", "return")
33
+ def run(self) -> None:
34
+ if self.run_type == "garbage_collect_read":
35
+ hdus = self.read(
36
+ tags=[Tag.input(), Tag.frame()], decoder=fits_garbage_collect_hdu_decoder
37
+ )
38
+ for hdu in hdus:
39
+ h = hdu.header
40
+ d = hdu.data
46
41
 
47
- @property
48
- def manipulate_data(self):
49
- return self.metadata_store_recipe_run_configuration().get("manipulate_data", True)
42
+ if self.run_type == "garbage_collect_task":
43
+ filepaths = self.read(tags=[Tag.input(), Tag.frame()], decoder=path_decoder)
44
+ for filepath in filepaths:
45
+ hdu = fits_garbage_collect_hdu_decoder(filepath)
46
+ h = hdu.header
47
+ d = hdu.data
50
48
 
51
- def run(self) -> None:
52
- if self.data_type == "fits":
53
- if self.read_method == "return":
54
- hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=fits_smart_hdu_decoder)
55
- for hdu in hdus:
56
- h = hdu.header
57
- d = hdu.data
58
- if self.manipulate_data:
59
- total = np.sum(d)
60
- if self.read_method == "yield":
61
- hdus = yield_from_read(
62
- self, tags=[Tag.input(), Tag.frame()], decoder=fits_smart_hdu_decoder
63
- )
64
- for hdu in hdus:
65
- h = hdu.header
66
- d = hdu.data
67
- if self.manipulate_data:
68
- total = np.sum(d)
69
- if self.data_type == "binary":
70
- if self.read_method == "return":
71
- hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=binary_decoder)
72
- for hdu in hdus:
73
- data = hdu
74
- if self.read_method == "yield":
75
- hdus = yield_from_read(
76
- self, tags=[Tag.input(), Tag.frame()], decoder=binary_decoder
77
- )
78
- for hdu in hdus:
79
- data = hdu
49
+ if self.run_type == "file_read":
50
+ hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder)
51
+ for hdu in hdus:
52
+ h = hdu.header
53
+ d = hdu.data
54
+ #
55
+ # if self.run_type == "generated_read":
56
+ # hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=generated_hdu_decoder)
57
+ # for hdu in hdus:
58
+ # h = hdu.header
59
+ # d = hdu.data
60
+ #
61
+ # if self.run_type == "file_task":
62
+ # filepaths = self.read(tags=[Tag.input(), Tag.frame()], decoder=path_decoder)
63
+ # for filepath in filepaths:
64
+ # hdu = fits.open(filepath)[1]
65
+ # h = hdu.header
66
+ # d = hdu.data
67
+ #
68
+ # if self.run_type == "generated_task":
69
+ # filepaths = self.read(tags=[Tag.input(), Tag.frame()], decoder=path_decoder)
70
+ # for filepath in filepaths:
71
+ # data = np.random.rand(4096, 4096)
72
+ # hdu = fits.CompImageHDU(data)
73
+ # h = hdu.header
74
+ # d = hdu.data
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dkist-processing-ops
3
- Version: 1.6.12
3
+ Version: 1.6.14
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=dUu2OxelDtAMXjHtstu0l-dD_T_j4hfz4LAPXSgLBBc,413
2
+ dkist_processing_ops/_version.py,sha256=ENoeph2R-6hTwDBnYv-6HGbXQQBxCuxRZdUsEOyJGbk,413
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=gAhoOKp3m9PPXCHUFqTkeiUhWZzTUD-QCMkjvsFMzIE,2941
5
+ dkist_processing_ops/tasks/read_memory_leak.py,sha256=WuwS7Jb-wUBqGsI6Qn8DvGvDHZDsj6jVyRp_vKf2QV4,2657
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.12.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
13
- dkist_processing_ops-1.6.12.dist-info/METADATA,sha256=Rd4do0X7qmPP8hRsVV-M8B-rcLn2IRTXeiZvCBuYnVg,1500
14
- dkist_processing_ops-1.6.12.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
- dkist_processing_ops-1.6.12.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
16
- dkist_processing_ops-1.6.12.dist-info/RECORD,,
12
+ dkist_processing_ops-1.6.14.dist-info/LICENSE.rst,sha256=LJjTmkf2-q1phdZSySMpiyPxgLOy6zYHOr3R1Bb1__8,327
13
+ dkist_processing_ops-1.6.14.dist-info/METADATA,sha256=KUW80lrBGyblfl5r9uSPaWF3ohu26KT2rSlQRV7qleA,1500
14
+ dkist_processing_ops-1.6.14.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
+ dkist_processing_ops-1.6.14.dist-info/top_level.txt,sha256=o_SNho1HKt6wvCSUhm9qzX9FS2iopnqYuMos1CCD9cI,21
16
+ dkist_processing_ops-1.6.14.dist-info/RECORD,,