Skip to content

Commit

Permalink
Merge pull request #266 from choderalab/PrepCFRelease
Browse files Browse the repository at this point in the history
3.0.2 release and bugfix
  • Loading branch information
Lnaden committed Jun 21, 2017
2 parents f039206 + 54ab9e9 commit 82ad9f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions pymbar/mbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ def computePMF(self, u_n, bin_n, nbins, uncertainties='from-lowest', pmf_referen
# PRIVATE METHODS - INTERFACES ARE NOT EXPORTED
#=========================================================================

def _ErrorOfDifferences(self,cov,warning_cutoff=1.0e-10):
def _ErrorOfDifferences(self, cov, warning_cutoff=1.0e-10):
"""
inputs:
cov is the covariance matrix of A
Expand All @@ -1397,12 +1397,16 @@ def _ErrorOfDifferences(self,cov,warning_cutoff=1.0e-10):
diag = np.matrix(cov.diagonal())
d2 = diag + diag.transpose() - 2 * cov

# Cast warning_cutoff to compare a negative number
cutoff = -abs(warning_cutoff)

# check for any numbers below zero.
if (np.any(d2 < 0.0)):
if (np.any(d2) < warning_cutoff):
print("A squared uncertainty is negative. d2 = %e" % d2[(np.any(d2) < warning_cutoff)])
if np.any(d2 < 0.0):
if np.any(d2 < cutoff):
print("A squared uncertainty is negative. Largest Magnitude = {0:f}".format(
abs(np.min(d2[d2 < cutoff]))))
else:
d2[(np.any(d2) < warning_cutoff)] = 0.0
d2[np.logical_and(0 > d2, d2 > cutoff)] = 0.0
return np.sqrt(np.array(d2))

def _pseudoinverse(self, A, tol=1.0e-10):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import six

##########################
VERSION = "3.0.1"
VERSION = "3.0.2"
ISRELEASED = True
__version__ = VERSION
##########################
Expand Down

0 comments on commit 82ad9f0

Please sign in to comment.