Implement get_parameters_at_bounds and suppress_warnings#170
Conversation
Co-authored-by: Copilot <copilot@github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #170 +/- ##
==========================================
Coverage ? 98.05%
==========================================
Files ? 45
Lines ? 2825
Branches ? 496
==========================================
Hits ? 2770
Misses ? 33
Partials ? 22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <copilot@github.com>
rozyczko
left a comment
There was a problem hiding this comment.
Consider acting on silent ignore of NaNs.
The check could also be potentially re-made.
| if not isinstance(rtol, float): | ||
| raise TypeError(f'rtol must be a float. Got {type(rtol)}.') | ||
|
|
||
| if not isinstance(atol, float): | ||
| raise TypeError(f'atol must be a float. Got {type(atol)}.') |
There was a problem hiding this comment.
Aren't those checks too strict?
get_parameters_near_bounds(rtol=0, atol=0) raises TypeError, even though np.isclose happily accepts ints. The same applies to numpy.float64 which is a float subclass and works, but plain Python int is rejected.
Maybe isinstance(x, (int, float)) and not isinstance(x, bool), or use numbers.Real. Also consider validating rtol >= 0 and atol >= 0 — negative tolerances will silently produce surprising results.
There was a problem hiding this comment.
or
from numbers import Real
if not isinstance(rtol, Real) or isinstance(rtol, bool) or rtol < 0:
raise TypeError(f'rtol must be a non-negative number. Got {rtol!r}.')
if not isinstance(atol, Real) or isinstance(atol, bool) or atol < 0:
raise TypeError(f'atol must be a non-negative number. Got {atol!r}.')| value = p.value | ||
|
|
There was a problem hiding this comment.
NaN values are silently ignored. If p.value is NaN, np.isclose will returns False, so a broken parameter isn't reported.
Co-authored-by: Copilot <copilot@github.com>
Closes #168
Closes #169