dkist-processing-ops 1.6.6rc1__tar.gz → 1.6.7__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-ops might be problematic. Click here for more details.
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/PKG-INFO +1 -1
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/_version.py +2 -2
- dkist_processing_ops-1.6.7/dkist_processing_ops/tasks/read_memory_leak.py +51 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/PKG-INFO +1 -1
- dkist_processing_ops-1.6.6rc1/dkist_processing_ops/tasks/read_memory_leak.py +0 -55
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/.gitignore +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/.pre-commit-config.yaml +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/LICENSE.rst +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/MANIFEST.in +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/README.rst +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/bitbucket-pipelines.yml +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/__init__.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/dags/scale.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tasks/__init__.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tasks/wait.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tests/__init__.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tests/test_workflows.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/workflows/__init__.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/workflows/memory_leak.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/workflows/smoke.py +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/SOURCES.txt +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/dependency_links.txt +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/not-zip-safe +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/requires.txt +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops.egg-info/top_level.txt +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/pyproject.toml +0 -0
- {dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/setup.cfg +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from abc import ABC
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
5
|
+
from typing import Generator
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
from astropy.io import fits
|
|
9
|
+
from dkist_processing_common.codecs.fits import fits_hdu_decoder
|
|
10
|
+
from dkist_processing_common.codecs.path import path_decoder
|
|
11
|
+
from dkist_processing_common.models.tags import Tag
|
|
12
|
+
from dkist_processing_common.tasks import tag_type_hint
|
|
13
|
+
from dkist_processing_common.tasks import WorkflowTaskBase
|
|
14
|
+
|
|
15
|
+
|
|
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))
|
|
20
|
+
|
|
21
|
+
|
|
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
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FitsDataRead(WorkflowTaskBase, ABC):
|
|
28
|
+
@property
|
|
29
|
+
def data_type(self) -> str:
|
|
30
|
+
"""Recipe run configuration indicating how fFITS data should be read."""
|
|
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")
|
|
36
|
+
|
|
37
|
+
def run(self) -> None:
|
|
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
|
+
if self.read_method == "yield":
|
|
42
|
+
hdus = yield_from_read(
|
|
43
|
+
self, tags=[Tag.input(), Tag.frame()], decoder=fits_hdu_decoder
|
|
44
|
+
)
|
|
45
|
+
if self.data_type == "binary":
|
|
46
|
+
if self.read_method == "return":
|
|
47
|
+
hdus = self.read(tags=[Tag.input(), Tag.frame()], decoder=binary_decoder)
|
|
48
|
+
if self.read_method == "yield":
|
|
49
|
+
hdus = yield_from_read(
|
|
50
|
+
self, tags=[Tag.input(), Tag.frame()], decoder=binary_decoder
|
|
51
|
+
)
|
|
@@ -1,55 +0,0 @@
|
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/__init__.py
RENAMED
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/dags/scale.py
RENAMED
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tasks/__init__.py
RENAMED
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tasks/wait.py
RENAMED
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/tests/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dkist_processing_ops-1.6.6rc1 → dkist_processing_ops-1.6.7}/dkist_processing_ops/workflows/smoke.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|