From 7247e37d7f955e4babe816f449a7323f82d21c21 Mon Sep 17 00:00:00 2001 From: gac-alvra Date: Thu, 24 Feb 2022 13:10:36 +0100 Subject: [PATCH] added error on missing camera name; print raw shape --- procprof/make_example_images.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/procprof/make_example_images.py b/procprof/make_example_images.py index 72904b1..8015c06 100755 --- a/procprof/make_example_images.py +++ b/procprof/make_example_images.py @@ -36,13 +36,19 @@ def mk_rand(n): def mk_real(fn, ch, n): ch = harmonize_channel(ch) with SFDataFiles(fn) as f: - imgs = f[ch][:n] + if ch is None: + names = list(f.names) + raise SystemExit(f"No camera or channel name specificed. Choose from: {names}") + c = f[ch] + print("Shape of raw images:", c.shape) + imgs = c[:n] nreal = len(imgs) if nreal != n: print(f"Warning: Got only {nreal} images from channel {ch} in {fn}") return imgs def harmonize_channel(ch): + if ch is None: return if not ch.endswith(FPIC): ch += FPIC return ch