From 0a7d9af79cda03ce67e5b7fe9e96659700fb6f58 Mon Sep 17 00:00:00 2001 From: Maik Herbig Date: Mon, 2 Aug 2021 12:12:24 +0900 Subject: [PATCH] Handle case "setup:identifier" is missing --- YouLabel/YouLabel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/YouLabel/YouLabel.py b/YouLabel/YouLabel.py index 03c24b5..66be118 100644 --- a/YouLabel/YouLabel.py +++ b/YouLabel/YouLabel.py @@ -174,8 +174,10 @@ def write_rtdc(fname,rtdc_path,indices,decisions): h5_targ.attrs["experiment:date"] = time.strftime("%Y-%m-%d") h5_targ.attrs["experiment:time"] = time.strftime("%H:%M:%S") h5_targ.attrs["imaging:pixel size"] = pixel_size - h5_targ.attrs["setup:identifier"] = h5_orig.attrs["setup:identifier"] h5_targ.attrs["experiment:original_file"] = rtdc_path + meta_keys = list(h5_orig.attrs.keys()) + if "setup:identifier" in meta_keys: + h5_targ.attrs["setup:identifier"] = rtdc_path h5_targ.close()