Skip to content

Commit

Permalink
Merge pull request #149 from ajouellette/fisher-truth
Browse files Browse the repository at this point in the history
include truth values on Fisher matrix plots
  • Loading branch information
joezuntz authored Dec 4, 2024
2 parents 594ea39 + 004484d commit b4a3973
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cosmosis/postprocessing/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1080,8 +1080,11 @@ def plot_1d(self, name, mu, sigma):
sigma2 = sigma**2
x = np.linspace(xmin, xmax, 200)
p = np.exp(-0.5 * (x-mu)**2 / sigma2)# / np.sqrt(2*np.pi*sigma2)
figure,filename = self.figure(name)
figure, filename = self.figure(name)
pylab.figure(figure.number)
if not hasattr(figure, "cosmosis_done_truth"):
self.plot_truth_1d(name)
figure.cosmosis_done_truth = True
pylab.plot(x, p, label=self.source.label)
pylab.xlabel(self.latex(name))
pylab.ylabel("Posterior")
Expand Down Expand Up @@ -1116,9 +1119,13 @@ def plot_2d(self, name1, i, name2, j):
s22 = covmat[1,1]**0.5

#Open the figure (new or existing) for this pair
figure,filename = self.figure("2D", name1, name2)
figure, filename = self.figure("2D", name1, name2)
pylab.figure(figure.number)

if not hasattr(figure, "cosmosis_done_truth"):
self.plot_truth_2d(name1, name2)
figure.cosmosis_done_truth = True

#Plot the 1 sigma and 2 sigma ellipses
self.plot_cov_ellipse(covmat, pos, nstd=1, facecolor=None,
edgecolor=self.line_color(), linewidth=2, fill=False, label=self.source.label)
Expand Down Expand Up @@ -1363,4 +1370,4 @@ def run(self):
pylab.xlabel(self.latex(col1))
pylab.ylabel(self.latex(col2))
filenames.append(filename)
return filenames
return filenames

0 comments on commit b4a3973

Please sign in to comment.