Skip to content

Commit

Permalink
Modify the covariance calculation based on reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
krzywon committed Oct 22, 2024
1 parent a7236a3 commit 8f1b246
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/sas/sascalc/fit/BumpsFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,14 +415,13 @@ def abort_test():
success = best is not None
try:
stderr = fitdriver.stderr() if success else None
if not hasattr(fitdriver.fitter, 'state'):
cov = fitdriver.cov()
else:
if hasattr(fitdriver.fitter, 'state'):
x = fitdriver.fitter.state.draw().points
if x.shape[1] > 1:
cov = np.cov(x.T, bias=1)
else:
cov = np.array([[np.var(x.T, ddof=1)]])
n_parameters = x.shape[1]
cov = np.cov(x.T, bias=True).reshape((n_parameters, n_parameters))
print(cov)
else:
cov = fitdriver.cov()
except Exception as exc:
errors.append(str(exc))
errors.append(traceback.format_exc())
Expand Down

0 comments on commit 8f1b246

Please sign in to comment.