Skip to content

Commit

Permalink
Remove T=0 related error
Browse files Browse the repository at this point in the history
  • Loading branch information
gsuarezr committed Oct 8, 2024
1 parent 78fb617 commit 6ebff8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion qutip/core/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -1624,6 +1627,7 @@ def __init__(
exponents = self.combine(exponents)
self.exponents = exponents


@classmethod
def combine(
cls, exponents: Sequence[CFExponent],
Expand Down
2 changes: 1 addition & 1 deletion qutip/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6ebff8c

Please sign in to comment.