added error on missing camera name; print raw shape

This commit is contained in:
gac-alvra
2022-02-24 13:10:36 +01:00
parent 1186890fe4
commit 7247e37d7f

View File

@ -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