Skip to content

Commit

Permalink
Some more notes on stat uncertainty
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- committed Jan 29, 2019
1 parent c9b48bc commit ff3e479
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions fnal_column_analysis_tools/hist/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@

def poisson_interval(sumw, sumw2, sigma=1):
"""
The so-called 'exact' interval
c.f. http://ms.mcmaster.ca/peter/s743/poissonalpha.html
The so-called 'Garwood' interval
c.f. https://www.ine.pt/revstat/pdf/rs120203.pdf
or http://ms.mcmaster.ca/peter/s743/poissonalpha.html
For weighted data, approximate the observed count by sumw**2/sumw2
When a bin is zero, find the scale of the nearest nonzero bin
If all bins zero, raise warning and set interval to sumw
This choice effectively scales the unweighted poisson interval by the average weight
Maybe not the best... see https://arxiv.org/pdf/1309.1287.pdf for a proper treatment
When a bin is zero, find the scale of the nearest nonzero bin
If all bins zero, raise warning and set interval to sumw
"""
scale = np.empty_like(sumw)
scale[sumw!=0] = sumw2[sumw!=0] / sumw[sumw!=0]
Expand Down

0 comments on commit ff3e479

Please sign in to comment.