From 6ebff8cedf852bcb77c5ff14791b7fc1c18695e7 Mon Sep 17 00:00:00 2001 From: mcditooss Date: Tue, 8 Oct 2024 16:38:21 +0200 Subject: [PATCH] Remove T=0 related error --- qutip/core/environment.py | 6 +++++- qutip/utilities.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/qutip/core/environment.py b/qutip/core/environment.py index e3e4414082..c0e9fbd5aa 100644 --- a/qutip/core/environment.py +++ b/qutip/core/environment.py @@ -1186,7 +1186,10 @@ def approx_by_matsubara( def _matsubara_params(self, Nk): """ Calculate the Matsubara coefficients and frequencies. """ - beta = 1 / self.T + if self.T==0: + beta=np.Inf + else: + beta = 1 / self.T Om = np.sqrt(self.w0**2 - (self.gamma / 2)**2) Gamma = self.gamma / 2 @@ -1624,6 +1627,7 @@ def __init__( exponents = self.combine(exponents) self.exponents = exponents + @classmethod def combine( cls, exponents: Sequence[CFExponent], diff --git a/qutip/utilities.py b/qutip/utilities.py index ba143f0765..143a4c7a51 100644 --- a/qutip/utilities.py +++ b/qutip/utilities.py @@ -471,7 +471,7 @@ def _rmse(fun, xdata, ydata, params): parameters. (The closer to zero = the better the fit.) """ yhat = _evaluate(fun, xdata, params) - if (np.max(ydata) - np.min(ydata)) == 0.0: + if (yhat == ydata).all(): return 0 return ( np.sqrt(np.mean((yhat - ydata) ** 2) / len(ydata))