midas-zipper 0.1.1__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.
- midas_zipper-0.1.1/PKG-INFO +72 -0
- midas_zipper-0.1.1/README.md +48 -0
- midas_zipper-0.1.1/midas_zipper/__init__.py +69 -0
- midas_zipper-0.1.1/midas_zipper/_read_cbf.py +518 -0
- midas_zipper-0.1.1/midas_zipper/ff_zip.py +947 -0
- midas_zipper-0.1.1/midas_zipper/update_zarr.py +156 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/PKG-INFO +72 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/SOURCES.txt +13 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/dependency_links.txt +1 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/entry_points.txt +3 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/requires.txt +9 -0
- midas_zipper-0.1.1/midas_zipper.egg-info/top_level.txt +1 -0
- midas_zipper-0.1.1/pyproject.toml +51 -0
- midas_zipper-0.1.1/setup.cfg +4 -0
- midas_zipper-0.1.1/tests/test_smoke.py +74 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: midas-zipper
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Standalone zarr-zip generation for MIDAS FF/PF workflows (no C-binary or source-tree dependency).
|
|
5
|
+
Author-email: Hemant Sharma <hsharma@anl.gov>
|
|
6
|
+
License: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/marinerhemant/MIDAS
|
|
8
|
+
Project-URL: Issues, https://github.com/marinerhemant/MIDAS/issues
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: numpy>=1.22
|
|
17
|
+
Requires-Dist: h5py>=3.0
|
|
18
|
+
Requires-Dist: zarr<3,>=2.13
|
|
19
|
+
Requires-Dist: numcodecs>=0.11
|
|
20
|
+
Requires-Dist: numba>=0.57
|
|
21
|
+
Requires-Dist: pillow>=9.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
24
|
+
|
|
25
|
+
# midas-zipper
|
|
26
|
+
|
|
27
|
+
Standalone zarr-zip generation for MIDAS FF/PF workflows.
|
|
28
|
+
|
|
29
|
+
`pip install midas-zipper` works with **no MIDAS source tree and no compiled C
|
|
30
|
+
binaries** — it depends only on `numpy`, `h5py`, `zarr`, `numcodecs`, `numba`,
|
|
31
|
+
and `pillow`, plus the system `zip`/`bzip2` tools.
|
|
32
|
+
|
|
33
|
+
It packages the zarr ingest that the FF and PF pipelines need to turn raw
|
|
34
|
+
detector data (HDF5/GE/TIFF) into the `*.MIDAS.zip` files the rest of MIDAS
|
|
35
|
+
consumes — previously the source-tree script `utils/ffGenerateZipRefactor.py`,
|
|
36
|
+
which broke `pip`-only installs because it lived outside any package.
|
|
37
|
+
|
|
38
|
+
## CLI
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# FF zarr-zip generation (formerly ffGenerateZipRefactor.py)
|
|
42
|
+
midas-ff-zip -resultFolder <dir> -paramFN <params.txt> -LayerNr <n>
|
|
43
|
+
|
|
44
|
+
# Update a key inside an existing Zarr.zip
|
|
45
|
+
midas-update-zarr -fn <file.MIDAS.zip> -keyToUpdate <key> -updatedValue <...>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Both are also runnable as modules:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m midas_zipper.ff_zip -resultFolder ... -paramFN ... -LayerNr ...
|
|
52
|
+
python -m midas_zipper.update_zarr -fn ... -keyToUpdate ... -updatedValue ...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Python API
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from midas_zipper import generate_ff_zip
|
|
59
|
+
|
|
60
|
+
generate_ff_zip(
|
|
61
|
+
result_folder="/path/to/scan",
|
|
62
|
+
param_file="/path/to/Parameters.txt",
|
|
63
|
+
layer_nr=1,
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Scope
|
|
68
|
+
|
|
69
|
+
This package intentionally **excludes** `AutoCalibrateZarr.py`: that tool drives
|
|
70
|
+
the C/OpenMP calibration binaries (`CalibrantPanelShiftsOMP`,
|
|
71
|
+
`CalibrantIntegratorOMP`, `GetHKLList`) and so cannot be pip-portable. It stays
|
|
72
|
+
with the calibration workflow.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# midas-zipper
|
|
2
|
+
|
|
3
|
+
Standalone zarr-zip generation for MIDAS FF/PF workflows.
|
|
4
|
+
|
|
5
|
+
`pip install midas-zipper` works with **no MIDAS source tree and no compiled C
|
|
6
|
+
binaries** — it depends only on `numpy`, `h5py`, `zarr`, `numcodecs`, `numba`,
|
|
7
|
+
and `pillow`, plus the system `zip`/`bzip2` tools.
|
|
8
|
+
|
|
9
|
+
It packages the zarr ingest that the FF and PF pipelines need to turn raw
|
|
10
|
+
detector data (HDF5/GE/TIFF) into the `*.MIDAS.zip` files the rest of MIDAS
|
|
11
|
+
consumes — previously the source-tree script `utils/ffGenerateZipRefactor.py`,
|
|
12
|
+
which broke `pip`-only installs because it lived outside any package.
|
|
13
|
+
|
|
14
|
+
## CLI
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# FF zarr-zip generation (formerly ffGenerateZipRefactor.py)
|
|
18
|
+
midas-ff-zip -resultFolder <dir> -paramFN <params.txt> -LayerNr <n>
|
|
19
|
+
|
|
20
|
+
# Update a key inside an existing Zarr.zip
|
|
21
|
+
midas-update-zarr -fn <file.MIDAS.zip> -keyToUpdate <key> -updatedValue <...>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Both are also runnable as modules:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m midas_zipper.ff_zip -resultFolder ... -paramFN ... -LayerNr ...
|
|
28
|
+
python -m midas_zipper.update_zarr -fn ... -keyToUpdate ... -updatedValue ...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Python API
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from midas_zipper import generate_ff_zip
|
|
35
|
+
|
|
36
|
+
generate_ff_zip(
|
|
37
|
+
result_folder="/path/to/scan",
|
|
38
|
+
param_file="/path/to/Parameters.txt",
|
|
39
|
+
layer_nr=1,
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Scope
|
|
44
|
+
|
|
45
|
+
This package intentionally **excludes** `AutoCalibrateZarr.py`: that tool drives
|
|
46
|
+
the C/OpenMP calibration binaries (`CalibrantPanelShiftsOMP`,
|
|
47
|
+
`CalibrantIntegratorOMP`, `GetHKLList`) and so cannot be pip-portable. It stays
|
|
48
|
+
with the calibration workflow.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""midas_zipper — standalone zarr-zip generation for MIDAS workflows.
|
|
2
|
+
|
|
3
|
+
Pip-installable with no MIDAS source-tree or C-binary dependency. Wraps the
|
|
4
|
+
zarr/HDF5 ingest that the FF and PF pipelines need to turn raw detector data
|
|
5
|
+
into the ``*.MIDAS.zip`` files the rest of MIDAS consumes.
|
|
6
|
+
|
|
7
|
+
Public API
|
|
8
|
+
----------
|
|
9
|
+
- :func:`generate_ff_zip` — programmatic entry to FF zarr-zip generation
|
|
10
|
+
(mirrors the ``ffGenerateZipRefactor`` CLI).
|
|
11
|
+
- ``python -m midas_zipper.ff_zip`` / ``midas-ff-zip`` — CLI.
|
|
12
|
+
- ``python -m midas_zipper.update_zarr`` / ``midas-update-zarr`` — CLI.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.1"
|
|
18
|
+
|
|
19
|
+
__all__ = ["generate_ff_zip", "__version__"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def generate_ff_zip(
|
|
23
|
+
*,
|
|
24
|
+
result_folder: str,
|
|
25
|
+
param_file: str,
|
|
26
|
+
layer_nr: int = 1,
|
|
27
|
+
data_fn: str = "",
|
|
28
|
+
dark_fn: str = "",
|
|
29
|
+
num_frame_chunks: int = -1,
|
|
30
|
+
preproc_thresh: int = -1,
|
|
31
|
+
num_files_per_scan: int = 1,
|
|
32
|
+
extra_args: list[str] | None = None,
|
|
33
|
+
) -> int:
|
|
34
|
+
"""Generate a ``*.MIDAS.zip`` by invoking the ported ff_zip ``main()``.
|
|
35
|
+
|
|
36
|
+
Runs in-process by populating ``sys.argv`` then calling
|
|
37
|
+
:func:`midas_zipper.ff_zip.main`. Returns 0 on success; raises on error.
|
|
38
|
+
Kept argv-driven so behavior is bit-identical to the legacy
|
|
39
|
+
``ffGenerateZipRefactor.py`` CLI the pipelines used to shell out to.
|
|
40
|
+
"""
|
|
41
|
+
import sys
|
|
42
|
+
from . import ff_zip
|
|
43
|
+
|
|
44
|
+
argv = [
|
|
45
|
+
"midas-ff-zip",
|
|
46
|
+
"-resultFolder", str(result_folder),
|
|
47
|
+
"-paramFN", str(param_file),
|
|
48
|
+
"-LayerNr", str(layer_nr),
|
|
49
|
+
]
|
|
50
|
+
if data_fn:
|
|
51
|
+
argv += ["-dataFN", str(data_fn)]
|
|
52
|
+
if dark_fn:
|
|
53
|
+
argv += ["-darkFN", str(dark_fn)]
|
|
54
|
+
if num_frame_chunks and num_frame_chunks > 0:
|
|
55
|
+
argv += ["-numFrameChunks", str(num_frame_chunks)]
|
|
56
|
+
if preproc_thresh and preproc_thresh > 0:
|
|
57
|
+
argv += ["-preProcThresh", str(preproc_thresh)]
|
|
58
|
+
if num_files_per_scan and num_files_per_scan > 1:
|
|
59
|
+
argv += ["-numFilesPerScan", str(num_files_per_scan)]
|
|
60
|
+
if extra_args:
|
|
61
|
+
argv += [str(a) for a in extra_args]
|
|
62
|
+
|
|
63
|
+
saved = sys.argv
|
|
64
|
+
try:
|
|
65
|
+
sys.argv = argv
|
|
66
|
+
ff_zip.main()
|
|
67
|
+
finally:
|
|
68
|
+
sys.argv = saved
|
|
69
|
+
return 0
|