gns.recurrence_calculations module

gns.recurrence_calculations.updateEofX(Eoft, EofX)[source]

Update value of raw first moment of X

gns.recurrence_calculations.updateEofX2(Eoft2, EofX2)[source]

Update value of raw 2nd momement of X

gns.recurrence_calculations.updateEofX2Final(EofX, nFinal)[source]

can’t be proved mathematically, just derived from recurrence relations

gns.recurrence_calculations.updateEofXFinal(EofX, nFinal)[source]

can’t be proved mathematically, X is treated deterministically to be X / nLive

gns.recurrence_calculations.updateEofZ(EofZ, Eof1mt, EofX, L)[source]

Update mean estimate of Z.

gns.recurrence_calculations.updateEofZ2(EofZ2, Eof1mt, EofZX, Eof1mt2, EofX2, L)[source]

Update value of raw 2nd moment of Z based on Lhood value obtained in that NS iteration

gns.recurrence_calculations.updateEofZ2Final(EofZ2, EofX, EofZ, EofX2, L)[source]

TODO: rewrite docstring

gns.recurrence_calculations.updateEofZFinal(EofZ, EofX, L)[source]

TODO: rewrite docstring

gns.recurrence_calculations.updateEofZX(Eoft, EofZX, Eoft2, EofX2, L)[source]

Updates raw ‘mixed’ moment of Z and X. Required to calculate E(Z)^2.

gns.recurrence_calculations.updateH(H, weight, ZNew, Lhood, Z)[source]

Same as Skilling’s implementation but in linear space Handles FloatingPointErrors associated with taking np.log(0) (0 * log(0) = 0) TODO: consider trapezium rule for sum and derive equivalent for recurrence relation I’m not sure this is correct as Skilling’s implementation uses E[log(Z)], E[log(t)] so H is actually exp(E[log(weight)] - E[log(ZNew)]) * log(Lhood) + exp(E[log(Z)] - E[log(ZNew)]) * (H + E[log(Z)]) - E[log(ZNew)]. However, it is in very close (to within millionths of a percent) with the version derived from Keeton’s paper

gns.recurrence_calculations.updateHLog(H, logWeight, logZNew, LLhood, logZ)[source]

update H using previous value, previous and new log(Z) and latest weight Isn’t a non-log version as H propto log(L). As given in Skilling’s paper. 100 percent accurate implementation should be as explained above. TODO: consider if trapezium rule should lead to different implementation

gns.recurrence_calculations.updateLogEofX(logEoft, logEofX)[source]

as above but for log space

gns.recurrence_calculations.updateLogEofX2(logEoft2, logEofX2)[source]

as above but for log space

gns.recurrence_calculations.updateLogEofX2Final(logEofX, nFinal)[source]

can’t be proved mathematically, just derived from recurrence relations

gns.recurrence_calculations.updateLogEofXFinal(logEofX, nFinal)[source]

can’t be proved mathematically, just derived from recurrence relations

gns.recurrence_calculations.updateLogEofZ(logEofZ, logEof1mt, logEofX, LL)[source]

as above but for log space

gns.recurrence_calculations.updateLogEofZ2(logEofZ2, logEof1mt, logEofZX, logEof1mt2, logEofX2, LL)[source]

as above but for log space

gns.recurrence_calculations.updateLogEofZ2Final(logEofZ2, logEofX, logEofZ, logEofX2, LL)[source]

TODO: rewrite docstring

gns.recurrence_calculations.updateLogEofZFinal(logEofZ, logEofX, LL)[source]

TODO: rewrite docstring

gns.recurrence_calculations.updateLogEofZX(logEoft, logEofZX, logEoftmEoft2, logEofX2, LL)[source]

as above but for log space

gns.recurrence_calculations.updateLogZnXM(nLive, logEofZ, logEofZ2, logEofZX, logEofX, logEofX2, LL)[source]

as above but for log space

gns.recurrence_calculations.updateLogZnXMoments(nLive, logEofZ, logEofZ2, logEofZX, logEofX, logEofX2, LLhoodStarOld, LLhoodStar, trapezoidalFlag)[source]

as above but for log space

gns.recurrence_calculations.updateLogZnXMomentsF(nFinal, logEofZ, logEofZ2, logEofX, LL, errorEval)[source]

TODO: rewrite docstring

gns.recurrence_calculations.updateLogZnXMomentsFinal(nFinal, logEofZ, logEofZ2, logEofX, LLhood_im1, LLhood_i, trapezoidalFlag, errorEval)[source]

Wrapper around updateZnXMomentsF taking into account whether trapezium rule is used or not

gns.recurrence_calculations.updateZnXM(nLive, EofZ, EofZ2, EofZX, EofX, EofX2, L)[source]

Update moments of Z and X based on their previous values, expected value of random variable t and Lhood value ((L_i + L_i-1) / 2. in case of trapezium rule). Used to calculate the mean and standard deviation of Z, and thus of log(Z) as well TODO: CONSIDER KEETON NON-RECURSIVE METHOD

gns.recurrence_calculations.updateZnXMoments(nLive, EofZ, EofZ2, EofZX, EofX, EofX2, LhoodStarOld, LhoodStar, trapezoidalFlag)[source]

Wrapper around updateZnXM taking into account whether trapezium rule is used or not

gns.recurrence_calculations.updateZnXMomentsF(nFinal, EofZ, EofZ2, EofX, L, errorEval)[source]

TODO: rewrite docstring TODO: CONSIDER KEETON NON-RECURSIVE METHOD WHICH EXPLICITLY ACCOUNTS FOR CORRELATION BETWEEN EOFZ AND EOFZLIVE

gns.recurrence_calculations.updateZnXMomentsFinal(nFinal, EofZ, EofZ2, EofX, Lhood_im1, Lhood_i, trapezoidalFlag, errorEval)[source]

Wrapper around updateZnXMomentsF taking into account whether trapezium rule is used or not