Skip to content

Commit

Permalink
Improving robustness on 2D plots and update statistics when rescaling…
Browse files Browse the repository at this point in the history
… only the likelihood (#74)

* Reset means to None for forcing reevaluation in updateBaseStatistics for mcsamples objects

* Bound corr by max_corr_2D for avoiding potential issues with matrix inversion

Co-authored-by: chris <chris@ringeval.com>
  • Loading branch information
eatdust and chris committed Dec 8, 2021
1 parent 00c7542 commit 6cafe15
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions getdist/mcsamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def updateBaseStatistics(self):
:return: self
"""
self.means = None
super().updateBaseStatistics()
mult_max = (self.mean_mult * self.numrows) / min(self.numrows // 2, 500)
outliers = np.sum(self.weights > mult_max)
Expand Down Expand Up @@ -1659,6 +1660,7 @@ def get2DDensityGridData(self, j, j2, num_plot_contours=None, get_density=False,
corr = self.getCorrelationMatrix()[j2][j]
if corr == 1:
logging.warning('Parameters are 100%% correlated: %s, %s', parx.name, pary.name)
corr = self.max_corr_2D

logging.debug('Doing 2D: %s - %s', parx.name, pary.name)
logging.debug('sample x_err, y_err, correlation: %s, %s, %s', parx.err, pary.err, corr)
Expand Down

0 comments on commit 6cafe15

Please sign in to comment.