gns.output module

gns.output.printBreak()[source]

tell user final contribution to sampling is being calculated

gns.output.printFinalLivePoints(i, physValue, Lhood, ZLiveType, space)[source]

print information about final livepoints used to calculate final contribution to Z/ posterior samples.

gns.output.printSampleNum(numSamples)[source]

Print number of samples used in sampling (including final livepoints used for posterior weights)

gns.output.printTerminationUpdateInfo(nest, terminator)[source]

Print update on termination status when evaluating by H value

gns.output.printTerminationUpdateZ(EofZLive, endValue, terminationFactor, space)[source]

Print update on termination status when evaluating by Z ratio

gns.output.printTheoretical(ZTheor, ZTheorErr, HTheor, HTheorErr)[source]

Outputs values for theoretical values of Z and H (and their errors)

gns.output.printUpdate(nest, deadPointPhys, deadPointLhood, EofZ, livePointPhys, livePointLhood, space)[source]

gives update on latest deadpoint and newpoint found to replace it

gns.output.printZHValues(EofZ, EofZ2, varZ, lnZ, lnVarZ, H, space, stage, method)[source]

print values of Z (including varios moments, variance) and H in either log or linear space, at a given stage and calculated by a given method If using log space, EofZ, EofZ2, varZ should actually be ln(E[Z]), ln(E[Z^2]) and ln(var[Z])

gns.output.rectifyLigoParamNames(file)[source]

paramNames in ligo runs I’ve already done aren’t in Latex. So Latex them in the .paramnames file for getdist here

Args:

file : string input file location

gns.output.rectifyShapeParamNames(file)[source]

paramNames in shape toy models which I’ve already ran aren’t Latex’d. So Latex them in the .paramnames file for getdist here

Args:

file : string input file location

gns.output.writeOutput(outputFile, totalPointsPhys, totalPointsLhood, weights, XArr, paramNames, space, targetSupport, Z, varZ, lnZ, lnVarZ)[source]

writes a summary file which contains values for all sampled points. Also writes files needed for getDist. When inputs are log values, the weights written are transformed to linear space, in order for KDE to work. Furthermore these weights are normalised by dividing by Z For log case, Z and varZ should actually be ln(E[Z]) and ln(var[Z])

Args:

outputFile : string output file location

totalPointsPhys : array all sampled points in their physical representation

totalPointsLhood : array Lhood values of all sampled points

weights : array posterior weights

XArr : array nested sampling prior volume values of each sample

paramNames : list parameter names

targetSupport : array target support values in array of shape (3, nDims)

Z : float Bayesian evidence

varZ : float var Z

lnZ : float log Z

lnVarZ : float log var Z

gns.output.writeParamNames(outputFile, paramNames)[source]

Write file giving index and list parameter names for getDist

Args:

outputFile : string output file location

paramNames : list parameter names

gns.output.writeRanges(outputFile, paramNames, targetSupport)[source]

write file with hard constraints on parameter boundaries. N means that constraints are inferred from data Here constraints are derived from target function’s support (sampling space), and unbounded supports are assigned N N

Args:

outputFile : string output file location

paramNames : list parameter names

targetSupport : array target support values in array of shape (3, nDims)

gns.output.writeSummary(outputFile, params, Lhood, weights, XArr, header)[source]
gns.output.writeTheorZ(Z, ZErr, outputFile)[source]
gns.output.writeTheoreticalSamples(outputFile, logPriorFunc, invPriorFunc, LLhoodFunc, targetSupport, paramNames, method, priorHyperParams=None)[source]

Write file of theoretical values of posterior in format of getdist .txt file to be used in getdist method == ‘sampling’ samples parameter space according to prior, then evaluates LLhood at these points. method == ‘grid’ forms a nDims-dimensional mesh grid and evaluates posterior at each point on this grid. Obviously infeasible for high dimensions. In this case, the ‘LLhood’ value written to getdist file is actually LLhood + logPrior. Again all weights are 1. Size of grid determined by domain of sampling space. If prior is unbounded (presumably Gaussian), take width in that dimension to be 5 standard deviations each side of prior mean Appends ‘_theor_s’ or ‘_theor_g’ to name of file where it saves results. TO MAKE THIS WORK IN GETDIST, WEIGHTS HAVE TO BE PROPORTIONAL TO LHOOD IN CASE OF SAMPLING METHOD, OR POSTERIOR IN CASE OF GRID METHOD. HENCE WE SET THE WEIGHTS EQUAL TO THE LHOOD OR POSTERIOR, AND SET THE LHOOD TO 1 (LLHOOD = 0) Will probably only work if n is high priorHyperParams is a (2. nDims) array with the hyperparameters (e.g. mean and standard dev) of the prior in each dimension. Only needed if usings the gridding method, and one or more of the priors is unbounded, to determine upper and lower bounds of grid

Args:

outputFile : string output file location

logPriorFunc : function log prior function

invPriorFunc : function inverse prior function

LLhoodFunc : function log likelihood function

targetSupport : array target support values in array of shape (3, nDims)

paramNames : list parameter names

method : string method to calculate theoretical estimate

priorHyperParams : array prior hyperparameter values (2, nDims)

gns.output.writeTxt(outputFile, weights, LLhood, params)[source]