Skip to content

Commit

Permalink
Added option for z_truth to be inside an hdf5 group (#94)
Browse files Browse the repository at this point in the history
* I added the option for z_truth to be inside an hdf5 group

* Fixing bug

* Testing hdf5_groupname with ifs

* add hdf5_groupname to override shared_params in test

* added pragma statement

* I changed the default goupname to empty string "". With this modification it is not necessary to change the test

---------

Co-authored-by: sschmidt23 <sschmidt@physics.ucdavis.edu>
Co-authored-by: Eric Charles <badass@stanford.edu>
  • Loading branch information
3 people committed Apr 3, 2024
1 parent 0b731ec commit 9dd9522
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/rail/evaluation/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=Param(str, '', msg='Name of group in hdf5 where redshift data is located'),
do_cde=Param(bool, True, msg='Evaluate CDE Metric'),
redshift_col=SHARED_PARAMS)
inputs = [('input', QPHandle),
Expand Down Expand Up @@ -79,7 +80,12 @@ def run(self):
"""

pz_data = self.get_data('input')
z_true = self.get_data('truth')[self.config.redshift_col]
if self.config.hdf5_groupname: # pragma: no cover
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
Expand Down

0 comments on commit 9dd9522

Please sign in to comment.