Skip to content

Commit

Permalink
Merge pull request #207 from SasView/py37-sascalc
Browse files Browse the repository at this point in the history
  • Loading branch information
pkienzle authored Mar 6, 2019
2 parents 8c9e65c + 7af652d commit f205d3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/sas/sascalc/corfunc/corfunc_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ def _porod(self, q, K, sigma, bg):
def _fit_guinier(self, q, iq):
"""Fit the Guinier region of the curve"""
A = np.vstack([q**2, np.ones(q.shape)]).T
return lstsq(A, np.log(iq), rcond=None)
# CRUFT: numpy>=1.14.0 allows rcond=None for the following default
rcond = np.finfo(float).eps * max(A.shape)
return lstsq(A, np.log(iq), rcond=rcond)

def _fit_porod(self, q, iq):
"""Fit the Porod region of the curve"""
Expand Down
4 changes: 3 additions & 1 deletion src/sas/sascalc/invariant/invariant.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,10 @@ def fit(self, power=None, qmin=None, qmax=None):
return [a, b], [0, math.sqrt(err)]
else:
A = np.vstack([linearized_data.x / linearized_data.dy, 1.0 / linearized_data.dy]).T
# CRUFT: numpy>=1.14.0 allows rcond=None for the following default
rcond = np.finfo(float).eps * max(A.shape)
p, residuals, _, _ = np.linalg.lstsq(A, linearized_data.y / linearized_data.dy,
rcond=None)
rcond=rcond)

# Get the covariance matrix, defined as inv_cov = a_transposed * a
err = np.zeros(2)
Expand Down
4 changes: 3 additions & 1 deletion src/sas/sascalc/pr/invertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,9 @@ def lstsq(self, nfunc=5, nr=20):
raise RuntimeError("Invertor: could not invert I(Q)\n %s" % str(exc))

# Perform the inversion (least square fit)
c, chi2, _, _ = lstsq(a, b, rcond=-1)
# CRUFT: numpy>=1.14.0 allows rcond=None for the following default
rcond = np.finfo(float).eps * max(a.shape)
c, chi2, _, _ = lstsq(a, b, rcond=rcond)
# Sanity check
try:
float(chi2)
Expand Down

0 comments on commit f205d3a

Please sign in to comment.