All checks were successful
Run apocalypse tests / Explore-Gitea-Actions (push) Successful in 10s
33 lines
984 B
Python
Executable File
33 lines
984 B
Python
Executable File
import argparse
|
|
from pathlib import Path
|
|
|
|
from sfdata import SFDataFile, SFProcFile
|
|
|
|
from utils.helpers import get_acq_from_pth
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--input", "-f", required=True)
|
|
|
|
args = parser.parse_args()
|
|
|
|
filename = Path(args.input)
|
|
out_pth = Path(
|
|
str(filename).replace("/raw/", "/res/processed/").replace(".CAMERAS.h5", ".PROCESSED.h5")
|
|
)
|
|
out_pth.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
with SFDataFile(args.input) as fdata, SFProcFile(out_pth) as fproc:
|
|
for name, chan in fdata.items():
|
|
if chan.ndim > 1:
|
|
proj = chan.data.sum(axis=1)
|
|
fproc[f"{name}.projection"] = (chan.pids, proj)
|
|
|
|
meta_pth = Path(str(filename).replace("/raw/", "/res/processed/").replace("/data/ac", "/meta/ac"))
|
|
acq = get_acq_from_pth(str(filename))
|
|
meta_pth = meta_pth.with_name(f"apo_acq{acq}.txt")
|
|
|
|
meta_pth.parent.mkdir(parents=True, exist_ok=True)
|
|
|
|
with open(meta_pth, "w") as f:
|
|
f.write("message to save as meta")
|