gns.plotting module

gns.plotting.GetDistPlotterTheor(g, p, x, plotName, Z=1.0)[source]

Takes GetDistPlotter object and plots theoretical posterior (p) on its axis for given x values. Currently only works in 1-d. Optionally normalises points w.r.t. Z

Args:

g : GetDistPlotter object

p : array of theoretical posterior points

x : array domain of points

plotName : string name of plot

gns.plotting.callGetDist(chainsFilePrefix, plotName, nParams, plotLegend)[source]

produces triangular posterior plots using getDist for first nParams parameters from chains file as labelled in that file and in .paramnames plotName should contain image type extension (e.g. .png)

Args:

chainsFilePrefix : string chains file excluding the ‘.txt’ prefix

plotName : string name of plot

nParams : int dimensionality of parameter space

plotLegend : list used for plot legend

gns.plotting.cornerPlots(chainsFilePrefix, plotName, plotLegend, labels)[source]
gns.plotting.get2DMarg(params, Lhood, n)[source]

marginalise Lhood for 2d array params, with n samples in each dimension (n^2 total). Returns n sized array of Lhoods and n sized array of params for each dimension

gns.plotting.get3DMarg(params, Lhood, n)[source]

marginalise Lhood for 3d array params, with n samples in each dimension (n^3 total). Returns n sized array of Lhoods and n sized array of params for each dimension

gns.plotting.get4DMarg(params, Lhood, n)[source]

marginalise Lhood for 4d array params, with n samples in each dimension (n^4 total). Returns n sized array of Lhoods and n sized array of params for each dimension

gns.plotting.get5DMarg(params, Lhood, n)[source]

marginalise Lhood for 5d array params, with n samples in each dimension (n^5 total). Returns n sized array of Lhoods and n sized array of params for each dimension

gns.plotting.plotLhood(x, Lhood, space)[source]

Plot likelihood values

Args:

x : array inputs to likelihood function

Lhood : function likelihood function

space : string whether to calculate likelihood or log of it

gns.plotting.plotPhysPosteriorIW(x, unnormalisedSamples, Z, space)[source]

Plots posterior in physical space according to importance weights w(theta)L(theta) / Z. Doesn’t use KDE so isn’t true shape of posterior. If inputting logWeights/ logZ then set space == ‘log’

Args:

x : array inputs to likelihood function

unnormalisedSamples : array unnormalised likelihood samples

Z : float Bayesian evidence

space : string whether to calculate likelihood or log of it

gns.plotting.plotSphericalKDE(chains1, chains2=None)[source]

Largely copied from main.py in spherical_kde package Will made, but edited to work for my chains (for gns and mn) chains strings should include ‘.txt’ if chains2 isn’t provided, uses 3rd and 4th parameters of chains1 for second plot

gns.plotting.plotXPosterior(X, L, Z, space)[source]

Plots X*L(X)/Z in log X space, not including KDE methods

Args:

x : array inputs to likelihood function

L : array likelihood values

Z : float Bayesian evidence

space : string whether to calculate likelihood or log of it