From 7b338372122a1e3b206460eaf0987baa6e0ecf24 Mon Sep 17 00:00:00 2001 From: Coos Baakman Date: Mon, 18 Dec 2023 15:57:51 +0100 Subject: [PATCH] handle even a missing targets group --- deeprank/learn/DataSet.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deeprank/learn/DataSet.py b/deeprank/learn/DataSet.py index d74d659..74bdb64 100644 --- a/deeprank/learn/DataSet.py +++ b/deeprank/learn/DataSet.py @@ -936,9 +936,8 @@ def load_one_variant(self, fname, variant_name=None): # get the target value if self.select_target is not None: - target_group = variant_data['targets'] - if self.select_target in target_group: - target = target_group[self.select_target][()] + if 'targets' in variant_data and self.select_target in variant_data['targets']: + target = variant_data['targets'][self.select_target][()] logger.debug("{} has target {}".format(variant_name, target)) target = np.array([target]).astype(outtype)