Skip to content

Commit

Permalink
poi_val val
Browse files Browse the repository at this point in the history
  • Loading branch information
StFroese committed Jan 23, 2025
1 parent 9ef03ef commit c0d530f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 6 additions & 4 deletions titrate/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from titrate.statistics import QMuTestStatistic, QTildeMuTestStatistic
from titrate.utils import copy_dataset_with_models


STATISTICS = {"qmu": QMuTestStatistic, "qtildemu": QTildeMuTestStatistic}


Expand Down Expand Up @@ -137,15 +136,17 @@ def __init__(
poi_name="scale",
ax=None,
analysis="3d",
poi_val=1e5,
):
self.path = path
# self.ax = ax if ax is not None else plt.gca()
self.analysis = analysis
self.measurement_dataset = measurement_dataset
self.poi_name = poi_name
self.poi_val = poi_val

self.d_sig = copy_dataset_with_models(self.measurement_dataset)
self.d_sig.models.parameters[self.poi_name].value = 1e5
self.d_sig.models.parameters[self.poi_name].value = self.poi_val
self.d_sig.models.parameters[self.poi_name].frozen = True
fit = Fit()
_ = fit.run(self.d_sig)
Expand Down Expand Up @@ -243,6 +244,7 @@ def plot(
statistic_bkg,
axs,
):
print(self.poi_val)
axs["diff"].hist(
toys_ts_diff,
bins=bins_diff,
Expand All @@ -263,7 +265,7 @@ def plot(
axs["diff"].plot(
linspace_diff,
statistic_bkg.asympotic_approximation_pdf(
poi_val=1e5, same=False, poi_true_val=0, ts_val=linspace_diff
poi_val=self.poi_val, same=False, poi_true_val=0, ts_val=linspace_diff
),
color="C0",
ls="--",
Expand All @@ -272,7 +274,7 @@ def plot(
axs["same"].plot(
linspace_same,
statistic_sig.asympotic_approximation_pdf(
poi_val=1e5, ts_val=linspace_same
poi_val=self.poi_val, ts_val=linspace_same
),
color="C1",
ls="--",
Expand Down
4 changes: 0 additions & 4 deletions titrate/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,6 @@ def asympotic_approximation_pdf(
if same:
sigma = np.sqrt(self.fit_result.covariance_result.matrix[0, 0])
mu_sigma = poi_val**2 / sigma**2
print(mu_sigma, "same")
print(self.dataset, self.poi_best, self.fit_result.covariance_result.matrix)
return np.where(
(ts_val > 0) & (ts_val <= mu_sigma),
(
Expand All @@ -275,8 +273,6 @@ def asympotic_approximation_pdf(

sigma = poi_val / np.sqrt(nc)
mu_sigma = poi_val**2 / sigma**2
print(mu_sigma, "diff")
print(self.dataset, self.poi_best)
return np.where(
(ts_val > 0) & (ts_val <= mu_sigma),
(
Expand Down

0 comments on commit c0d530f

Please sign in to comment.