From 298aba710064736fc2703137f59a9b90505f60c1 Mon Sep 17 00:00:00 2001 From: Josue De-Santiago Date: Tue, 26 Mar 2024 19:33:49 -0600 Subject: [PATCH] Testing hdf5_groupname with ifs --- src/rail/evaluation/evaluator.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rail/evaluation/evaluator.py b/src/rail/evaluation/evaluator.py index 1d7c8a8c..bfd485f2 100644 --- a/src/rail/evaluation/evaluator.py +++ b/src/rail/evaluation/evaluator.py @@ -25,6 +25,7 @@ class Evaluator(RailStage): nzbins=Param(int, 301, msg="# of bins in zgrid"), pit_metrics=Param(str, 'all', msg='PIT-based metrics to include'), point_metrics=Param(str, 'all', msg='Point-estimate metrics to include'), + hdf5_groupname=SHARED_PARAMS['hdf5_groupname'], do_cde=Param(bool, True, msg='Evaluate CDE Metric'), redshift_col=SHARED_PARAMS) inputs = [('input', QPHandle), @@ -79,10 +80,12 @@ def run(self): """ pz_data = self.get_data('input') - try: #pragma: no cover - z_true = self.get_data('truth')[self.config.hdf5_groupname][self.config.redshift_col] - except: - z_true = self.get_data('truth')[self.config.redshift_col] + if self.config.hdf5_groupname: + specz_data = self.get_data('truth')[self.config.hdf5_groupname] + else: + specz_data = self.get_data('truth') + z_true = specz_data[self.config['redshift_col']] + zgrid = np.linspace(self.config.zmin, self.config.zmax, self.config.nzbins+1) # Create an instance of the PIT class