gns.ns_end_funcs module

gns.ns_end_funcs.checkIfAveragedLhood(nFinal, livePointsLhood, avLhood)[source]

Checks if Lhood was averaged over in getLogWeightsLive or not. If it was, need to work with average LLhood value for remainder of calculations, if not then carry on working with nLive size array of LLhoods. For ZLiveType == ‘max’, average is just taken over array size one with max Lhood value in it, so it is still just max value

gns.ns_end_funcs.getFinalAverage(livePointsPhys, livePointsLLhood, X, nFinal, avLLhood, space)[source]

gets final livepoint values and X value per remaining livepoint for average Z criteria NOTE Xfinal is a list not a numpy array space says whether you are working in linear or log space (X or logX)

gns.ns_end_funcs.getFinalContribution(verbose, ZLiveType, trapezoidalFlag, nFinal, EofZ, EofZ2, EofX, EofWeights, H, livePointsPhys, livePointsLhood, avLhood, liveLhoodMax, liveMaxIndex, LhoodStar, errorEval='recursive')[source]

as above but in linear space

gns.ns_end_funcs.getFinalContributionLog(verbose, ZLiveType, trapezoidalFlag, nFinal, logEofZ, logEofZ2, logEofX, logEofWeights, H, livePointsPhys, livePointsLLhood, avLLhood, liveLLhoodMax, liveMaxIndex, LLhoodStar, errorEval='recursive')[source]

Get final contribution from livepoints after NS loop has ended. Way of estimating final contribution is dictated by ZLiveType. Also updates H value and gets final weights (and physical values) for posterior this function could be quite taxing on memory as it has to copy all arrays/ lists across NOTE: for standard quadrature summation, average Lhood and average X give same values of Z (averaging over X is equivalent to averaging over L). However, correct posterior weights are given by latter method, and Z errors are different in both cases

gns.ns_end_funcs.getFinalMax(liveMaxIndex, livePointsPhys, liveLhoodMax, X)[source]

get livepoint and physical livepoint values corresponding to maximum likelihood point in remaining livepoints. Note Xfinal is a list not a numpy array or a scalar Function works for log or linear space

gns.ns_end_funcs.getLivePointsPhysFinal(livePointsPhys, avLhood)[source]

Get physical values associated with remaining contribution of livepoints. If LLhood isn’t averaged over (X is) this is just the input livepoint values, but if LLhood is averaged it is non-trivial, I.E. THE PHYSICAL VALUES ASSOCIATED WITH THIS POINT ARE MEANININGLESS Only relevant for ZLiveType == ‘average’ as for ‘max’ case, physical values are just that corresponding to max(L) These are needed for posterior samples of remaining contribution of livepoints

gns.ns_end_funcs.getTotal(deadPointsPhys, livePointsPhysFinal, deadPointsLhood, livePointsLhoodFinal, XArr, XFinalArr, weights)[source]

gets final arrays of physical, llhood and X values for all accepted points in algorithm. This function mutates deadPointsPhys by appending numpy array livePointsPhysFinal. This is at the end of the program however, so it shouldn’t be an issue. Concatenate works on a list of numpy arrays (those corresponding to deadPoints should have shape (1, nDims) and there should be nest of them, the single numpy arrays corresponding to the final live points should have shape (nLive, nDims) if average of Z was used for final contribution or (1, nDims) if max of Z was used. Concatenating list of numpy arrays is much more efficient than using np.append() at each iteration.