From f0bf3ce8c1b74abd564a2363e0e66220a23d96e6 Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Thu, 16 May 2024 14:30:53 -0700 Subject: [PATCH] Issues/224/add classes to init (#225) * Adde metric classes to __init__ and make a ValueError more informative * Adde metric classes to __init__ and make a ValueError more informative --- src/qp/metrics/__init__.py | 2 ++ src/qp/metrics/metrics.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qp/metrics/__init__.py b/src/qp/metrics/__init__.py index 31163c7..0a1a0a6 100644 --- a/src/qp/metrics/__init__.py +++ b/src/qp/metrics/__init__.py @@ -2,6 +2,8 @@ from .metrics import * from .goodness_of_fit import * from .base_metric_classes import * +from .concrete_metric_classes import * +from .point_estimate_metric_classes import * # added for testing purposes diff --git a/src/qp/metrics/metrics.py b/src/qp/metrics/metrics.py index f06dbfc..1ccf600 100644 --- a/src/qp/metrics/metrics.py +++ b/src/qp/metrics/metrics.py @@ -229,7 +229,7 @@ def _prepare_for_brier(p, truth, limits, dx=0.01): # Values of truth that are outside the defined limits will not appear truth_array. # Consider expanding the limits or using numpy.clip to restrict truth values to the limits. if np.any(np.less(truth, limits[0])) or np.any(np.greater(truth, limits[1])): - raise ValueError("Input truth values exceed the defined limits") + raise ValueError(f"Input truth values exceed the defined limits ({min(truth)}, {max(truth)}) ({limits[0]} {limits[1]})") # Make a grid object that defines grid values and histogram bin edges using limits and dx grid = _calculate_grid_parameters(limits, dx)