Skip to content

Commit

Permalink
use rel. error for barlow beeston gauss case
Browse files Browse the repository at this point in the history
  • Loading branch information
pfackeldey committed Mar 27, 2024
1 parent 565c03a commit aa16b63
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/evermore/staterror.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class StatErrors(eqx.Module):

params_global: PyTree
params_per_process: PyTree
ntot: Array = eqx.field(static=True)
etot: Array = eqx.field(static=True)
mask: Array = eqx.field(static=True)

Expand All @@ -60,12 +61,12 @@ def __init__(
self.params_per_process = jtu.tree_map(
lambda hist: PoissonConstrained(lamb=hist), hists
)
wtot = sum_leaves(hists)
self.ntot = sum_leaves(hists)
self.etot = jnp.sqrt(sum_leaves(histsw2))
wtot_eff = jnp.round(wtot**2 / self.etot**2, decimals=0)
self.mask = wtot_eff > threshold
ntot_eff = jnp.round(self.ntot**2 / self.etot**2, decimals=0)
self.mask = ntot_eff > threshold

def get(self, where: Callable) -> ModifierLike:
poisson_mod = where(self.params_per_process).poisson()
normal_mod = self.params_global.normal(width=self.etot)
normal_mod = self.params_global.normal(width=self.etot / self.ntot)
return modifier_where(self.mask, normal_mod, poisson_mod)

0 comments on commit aa16b63

Please sign in to comment.