Skip to content

Commit

Permalink
fix 3dmc
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Dec 14, 2024
1 parent e8c9d2f commit 9c774af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions titrate/upperlimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,12 @@ def pvalue(self, poi_ul, cl_type):

def expected_uls(self):
# scan for poi_ul median
if self.cl_type == "s+b":
target_ts = norm.ppf(1 - (1 - self.cl)) ** 2
if self.cl_type == "s":
target_ts = norm.ppf(1 - 0.5 * (1 - self.cl)) ** 2

poi_ul = 1e-2
target_ts = norm.ppf(1 - 0.5 * (1 - self.cl)) ** 2
while (ts := self.no_signal_statistic.evaluate(poi_ul)) < target_ts:
poi_ul *= 2

Expand Down Expand Up @@ -170,7 +174,7 @@ def expected_uls(self):

def compute_band(self, sigma, n_sigma, cl_type):
if cl_type == "s+b":
return sigma * (norm.ppf(self.cl) + n_sigma)
return sigma * (norm.ppf(1 - (1 - self.cl)) + n_sigma)
elif cl_type == "s":
return sigma * (norm.ppf(1 - (1 - self.cl) * norm.cdf(n_sigma)) + n_sigma)

Expand Down
2 changes: 1 addition & 1 deletion titrate/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from astropy.table import QTable
from astropy.units import Quantity
from gammapy.astro.darkmatter import DarkMatterAnnihilationSpectralModel
from gammapy.modeling.models import SkyModel
from gammapy.modeling import Fit
from gammapy.modeling.models import SkyModel

from titrate.datasets import AsimovMapDataset, AsimovSpectralDataset
from titrate.statistics import QMuTestStatistic, QTildeMuTestStatistic, kstest
Expand Down

0 comments on commit 9c774af

Please sign in to comment.