Skip to content

Commit

Permalink
fix mypy convergence errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener authored and inducer committed Aug 23, 2024
1 parent b355bed commit 0c65d61
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pytools/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def estimate_order_of_convergence(self,

# NOTE: in case any of the errors are exactly 0.0, which
# can give NaNs in `estimate_order_of_convergence`
emax = np.amax(errors)
emax: float = np.amax(errors)
errors += (1 if emax == 0 else emax) * np.finfo(errors.dtype).eps

size = len(abscissae)
Expand All @@ -82,7 +82,8 @@ def estimate_order_of_convergence(self,
return result

def order_estimate(self) -> float:
return self.estimate_order_of_convergence()[0, 1]
from typing import cast
return cast(float, self.estimate_order_of_convergence()[0, 1])

def max_error(self) -> float:
return max(err for absc, err in self.history)
Expand Down

0 comments on commit 0c65d61

Please sign in to comment.