Skip to content

Commit

Permalink
Add preliminary validate_results.py script (ref #37)
Browse files Browse the repository at this point in the history
This is meant to be integrated in fractal-analytics-platform/fractal-containers#21
  • Loading branch information
tcompa committed Oct 3, 2023
1 parent c52d77f commit 1939dae
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions examples/01_cardio_tiny_dataset/validate_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import zarr
import itertools
import logging
import sys
from pathlib import Path

logging.basicConfig(
level=logging.INFO,
format="%(asctime)s; %(levelname)s; %(message)s"
)

outdir = Path("output_cardiac-tiny")
f1 = outdir / "20200812-CardiomyocyteDifferentiation14-Cycle1.zarr"
f2 = outdir / "20200812-CardiomyocyteDifferentiation14-Cycle1_mip.zarr"


for path in [
f1,
f1 / "B/03/0",
f1 / "B/03/0/tables",
f1 / "B/03/0/tables/well_ROI_table",
f1 / "B/03/0/tables/FOV_ROI_table",
f2,
f2 / "B/03/0",
f2 / "B/03/0/tables",
f2 / "B/03/0/tables/well_ROI_table",
f2 / "B/03/0/tables/FOV_ROI_table",
]:
try:
g = zarr.open_group(path.as_posix(), "r")
logging.info(f"{path} is a valid zarr group")
logging.info(f"Sub-groups/arrays: {list(g.keys())}")
except Exception as e:
logging.error(f"{path} is not a valid zarr group")
logging.error(f"Original error: {str(e)}")
sys.exit(1)

for (f, level) in itertools.product((f1, f2), range(5)):
try:
path = f / "B/03/0" / str(level)
a = zarr.open_array(path.as_posix(), "r")
logging.info(f"{path} is a valid zarr array")
except Exception as e:
logging.error(f"{path} is not a valid zarr array")
logging.error(f"Original error: {str(e)}")
sys.exit(1)

0 comments on commit 1939dae

Please sign in to comment.