Skip to content

Commit

Permalink
Pass rcond=None to numpy.linalg.lstsq to silence warning
Browse files Browse the repository at this point in the history
Silence numpy warnings and use new default behavior

From numpy documentation:

Changed in version 1.14.0: If not set, a FutureWarning is given.
The previous default of -1 will use the machine precision as rcond
parameter, the new default will use the machine precision times max(M, N).
To silence the warning and use the new default, use rcond=None,
to keep using the old behavior, use rcond=-1.
  • Loading branch information
mliu49 committed Jul 21, 2019
1 parent 0e41ea1 commit ce81424
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions rmgpy/data/kinetics/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def generateGroupAdditivityValues(self, trainingSet, kunits, method='Arrhenius')
b = numpy.array(b)
kdata = numpy.array(kdata)

x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

for t, T in enumerate(Tdata):

Expand Down Expand Up @@ -513,7 +513,7 @@ def generateGroupAdditivityValues(self, trainingSet, kunits, method='Arrhenius')
b = numpy.array(b)
kdata = numpy.array(kdata)

x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

# Store the results
self.top[0].data = Arrhenius(
Expand Down Expand Up @@ -564,7 +564,7 @@ def generateGroupAdditivityValues(self, trainingSet, kunits, method='Arrhenius')
A = numpy.array(A)
b = numpy.array(b)

x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

# Store the results
self.top[0].data = Arrhenius(
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/kinetics/arrhenius.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ cdef class Arrhenius(KineticsModel):
for n in range(b.size):
A[n,:] *= weights[n]
b[n] *= weights[n]
x, residues, rank, s = numpy.linalg.lstsq(A,b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

# Determine covarianace matrix to obtain parameter uncertainties
count = klist.size
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/kinetics/chebyshev.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ cdef class Chebyshev(PDepKineticsModel):
b[p1*nT+t1] = log10(K[t1,p1])

# Do linear least-squares fit to get coefficients
x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

# Extract coefficients
coeffs = numpy.zeros((degreeT,degreeP), numpy.float64)
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/kinetics/surface.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ cdef class StickingCoefficient(KineticsModel):
for n in range(b.size):
A[n, :] *= weights[n]
b[n] *= weights[n]
x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

# Determine covarianace matrix to obtain parameter uncertainties
count = klist.size
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/statmech/torsion.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ cdef class HinderedRotor(Torsion):
# This row forces dV/dangle = 0 at angle = 0
for m in range(numterms):
A[N,m+numterms] = 1
x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)
fit = numpy.dot(A,x)
x *= 0.001
# This checks if there are any negative values in the forier fit.
Expand Down
2 changes: 1 addition & 1 deletion rmgpy/thermo/wilhoit.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ cdef class Wilhoit(HeatCapacityModel):
for j in range(4):
A[i,j] = (y*y*y - y*y) * y**j
b[i] = ((Cpdata[i] - Cp0) / (CpInf - Cp0) - y*y)
x, residues, rank, s = numpy.linalg.lstsq(A, b)
x, residues, rank, s = numpy.linalg.lstsq(A, b, rcond=None)

self.B = (float(B),"K")
self.a0 = float(x[0])
Expand Down

0 comments on commit ce81424

Please sign in to comment.