gns.keeton_calculations module¶
-
gns.keeton_calculations.calcEofZ2FinalKeeton(finalLhoods, nLive, nest)[source]¶ Averages over Lhood, which I don’t think is the correct thing to do as it doesn’t correspond to a unique parameter vector value. TODO: consider other ways of getting final contribution from livepoints with Keeton’s method
-
gns.keeton_calculations.calcEofZ2FinalKeetonLog(finalLLhoods, nLive, nest)[source]¶ Based on function calcEofZ2FinalKeetonLog()
-
gns.keeton_calculations.calcEofZ2Keeton(Lhoods, nLive, nest)[source]¶ Calculate second (raw) moment of Z from main NS loop (equation 22 Keeton)
-
gns.keeton_calculations.calcEofZ2KeetonLog(LLhoods, nLive, nest)[source]¶ calculates logEofZ^2 based on Keeton’s equations. Based on functions calcSums, calcInnerSums and calcSumsLoop
-
gns.keeton_calculations.calcEofZFinalKeeton(finalLhoods, nLive, nest)[source]¶ Averages over Lhood, which I don’t think is the correct thing to do as it doesn’t correspond to a unique parameter vector value. However this gives same value for Z as by averaging over X TODO: consider other ways of getting final contribution from livepoints with Keeton’s method
-
gns.keeton_calculations.calcEofZFinalKeetonLog(finalLLhoods, nLive, nest)[source]¶ Based on function calcEofZFinalKeeton().
-
gns.keeton_calculations.calcEofZKeeton(Lhoods, nLive, nest)[source]¶ Calculate first moment of Z from main NS loop. According to paper, this is just E[Z] = 1. / nLive * sum_i^nest L_i * E[t]^i
-
gns.keeton_calculations.calcEofZKeetonLog(LLhoods, nLive, nest)[source]¶ Calculate log of first moment of Z from main NS loop. based on function calcEofZKeeton
-
gns.keeton_calculations.calcEofZZFinalKeeton(Lhoods, finalLhoods, nLive, nest)[source]¶ Averages over Lhood for contribution from final points, which I don’t think is the correct thing to do as it doesn’t correspond to a unique parameter vector value. TODO: consider other ways of getting final contribution from livepoints with Keeton’s method
-
gns.keeton_calculations.calcEofZZFinalKeetonLog(LLhoods, finalLLhoods, nLive, nest)[source]¶ Based on function calcEofZZFinalKeeton()
-
gns.keeton_calculations.calcHKeeton(EofZ, Lhoods, nLive, nest)[source]¶ Calculate H from KL divergence equation transformed to LX space as given in Keeton. Note this calculates contribution to H from main NS loop TODO: consider Keeton equations using trapezium rule
-
gns.keeton_calculations.calcHKeetonLog(logEofZ, LLhoods, nLive, nest)[source]¶ Based on calcHKeeton() function Doesn’t actually work in log-space, this is to prevent numerical difficulties e.g. log(negative number) associated with negative values of LLhoods and logZ (from low L, Z values)
-
gns.keeton_calculations.calcHKeetonLog2(logEofZ, LLhoods, nLive, nest)[source]¶ Based on calcHKeeton() function Works in log-space, but will screw up for low values of L and Z since log(L) ~ negative and log(negative) undefined
-
gns.keeton_calculations.calcHTotalKeeton(EofZ, Lhoods, nLive, nest, finalLhoods)[source]¶ Calculates total value of H based on KL divergence equation transformed to LX space as given in Keeton. Uses H function used to calculate loop H value (but with total Z), and adapts final result to give HTotal Note EofZ corresponds to total EofZ TODO: consider Keeton equations using trapezium rule
-
gns.keeton_calculations.calcHTotalKeetonLog(logEofZ, LLhoods, nLive, nest, finalLLhoods)[source]¶ Based on function calcHTotalKeeton() Again mainly doesn’t work in log-space to avoid undefined function evaluations
-
gns.keeton_calculations.calcHTotalKeetonLog2(logEofZ, LLhoods, nLive, nest, finalLLhoods)[source]¶ Based on function calcHTotalKeeton() Again mainly works in log-space so can mess up for small L, Z
-
gns.keeton_calculations.calcInnerLogSums(LLhoods, nLive, nest)[source]¶ based on calcInnerSums function
-
gns.keeton_calculations.calcInnerSums(Lhoods, nLive, nest)[source]¶ Second generator (yielding) function, which returns inner sum for outer index k
-
gns.keeton_calculations.calcLogSumsLoop(LLhoods, nLive, nest)[source]¶ Based on calcSumsLoop function
-
gns.keeton_calculations.calcSums(Lhoods, nLive, nest)[source]¶ Calculate double summation in equation (22) of Keeton using two generator (yielding) functions. First one creates array associated with index of inner sum (which is subsequently summed). Second one creates array of summed inner sums, which is then multiplied by array of L_k * E[t]^k terms to give outer summation terms. Outer summation terms are added together to give total of double sum.
-
gns.keeton_calculations.calcSumsLoop(Lhoods, nLive, nest)[source]¶ Calculate double summation in equation (22) of Keeton using double for loop (one for each summation). Inefficient (I think) but easy
-
gns.keeton_calculations.calcZMomentsFinalKeeton(finalLhoods, nLive, nest)[source]¶ calculate Z moments a-posteri with list of final Lhood points (ones remaining at termination of main loop), using equations given in Keeton TODO: consider Keeton equations using trapezium rule TODO: consider different ways of handling final livepoints (i.e. average over X or max Lhood)
-
gns.keeton_calculations.calcZMomentsFinalKeetonLog(finalLLhoods, nLive, nest)[source]¶ Calculate log of moments of Z from contribution after main NS loop
-
gns.keeton_calculations.calcZMomentsKeeton(Lhoods, nLive, nest)[source]¶ calculate Z moments a-posteri with full list of Lhoods used in NS loop, using equations given in Keeton TODO: consider Keeton equations using trapezium rule
-
gns.keeton_calculations.calcZMomentsKeetonLog(LLhoods, nLive, nest)[source]¶ Calculate logs of Z moments based on Keeton’s equations
-
gns.keeton_calculations.getEofZ2TotalKeeton(EofZ2, EofZ2Final, EofZZFinal)[source]¶ get total from NS loop and final contributions
-
gns.keeton_calculations.getEofZ2TotalKeetonLog(logEofZ2, logEofZ2Final, logEofZZFinal)[source]¶ Get log of EofZ^2 total from loop and final contributions
-
gns.keeton_calculations.getEofZTotalKeeton(EofZ, EofZFinal)[source]¶ get total from NS loop and final contributions
-
gns.keeton_calculations.getEofZTotalKeetonLog(logEofZ, logEofZFinal)[source]¶ Get log of EofZ total from loop and final contributions
-
gns.keeton_calculations.getVarTotalKeeton(varZ, varZFinal, EofZ, EofZFinal, EofZZFinal)[source]¶ Get total variance from NS loop and final contributions. For recursive method, since E[ZLive] = E[ZTot] etc., and assuming that the recurrence relations account for the covariance between Z and ZFinal, this is just varZFinal. For Keeton’s method, have to explicitly account for correlation as expectations for Z and ZLive are essentially calculated independently TODO: check if recurrence relations of Z and ZFinal properly account for correlation between two ANSWER: they do not