def increment(self,logL,nlive=None):
"""
Increment the state of the evidence integrator
Simply uses rectangle rule for initial estimate
"""
if(logL<=self.logLs[-1]):
print('WARNING: NS integrator received non-monotonic logL. {0:.3f} -> {1:.3f}'.format(self.logLs[-1],logL))
if nlive is None:
nlive = self.nlive
oldZ = self.logZ
logt=-1.0/nlive
Wt = self.logw + logL + logsubexp(0,logt)
self.logZ = logaddexp(self.logZ,Wt)
# Update information estimate
if np.isfinite(oldZ) and np.isfinite(self.logZ):
self.info = exp(Wt - self.logZ)*logL + exp(oldZ - self.logZ)*(self.info + oldZ) - self.logZ
# Update history
self.logw += logt
self.iteration += 1
self.logLs.append(logL)
self.log_vols.append(self.logw)
评论列表
文章目录