From 64d3f8ff49e9cf882ae17cb4a732f6f6d84232aa Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Wed, 20 Sep 2023 17:08:14 -0700 Subject: [PATCH 1/2] Fix misleading error message for epsilon values In `BaseEM` class, epsilon properties are allowed to be zero or positive, although the error message stated that epsilon should be greater than zero. Fix the error message to agree with the implemented logic and also print the offending value. --- geoana/em/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/geoana/em/base.py b/geoana/em/base.py index a346c985..c80eb0f4 100644 --- a/geoana/em/base.py +++ b/geoana/em/base.py @@ -102,7 +102,10 @@ def epsilon(self, value): raise TypeError(f"epsilon must be a number, got {type(value)}") if value < 0.0: - raise ValueError("epsilon must be greater than 0") + raise ValueError( + f"Invalid epsilon '{value}': " + "epsilon must be greater or equal than than zero." + ) self._epsilon = value From a693d653e5fd5e2dcc9e976135c9ba8692015c1d Mon Sep 17 00:00:00 2001 From: Santiago Soler Date: Wed, 20 Sep 2023 17:11:15 -0700 Subject: [PATCH 2/2] Fix wording --- geoana/em/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geoana/em/base.py b/geoana/em/base.py index c80eb0f4..2a611bd0 100644 --- a/geoana/em/base.py +++ b/geoana/em/base.py @@ -104,7 +104,7 @@ def epsilon(self, value): if value < 0.0: raise ValueError( f"Invalid epsilon '{value}': " - "epsilon must be greater or equal than than zero." + "epsilon must be greater or equal than zero." ) self._epsilon = value