From c0d530f0a41d829a24e9ffec2f381be6f225b5f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Fr=C3=B6se?= Date: Thu, 23 Jan 2025 11:44:29 +0800 Subject: [PATCH] poi_val val --- titrate/plotting.py | 10 ++++++---- titrate/statistics.py | 4 ---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/titrate/plotting.py b/titrate/plotting.py index 1c43585..7a1236f 100644 --- a/titrate/plotting.py +++ b/titrate/plotting.py @@ -10,7 +10,6 @@ from titrate.statistics import QMuTestStatistic, QTildeMuTestStatistic from titrate.utils import copy_dataset_with_models - STATISTICS = {"qmu": QMuTestStatistic, "qtildemu": QTildeMuTestStatistic} @@ -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) @@ -243,6 +244,7 @@ def plot( statistic_bkg, axs, ): + print(self.poi_val) axs["diff"].hist( toys_ts_diff, bins=bins_diff, @@ -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="--", @@ -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="--", diff --git a/titrate/statistics.py b/titrate/statistics.py index 2052179..69bb6d0 100644 --- a/titrate/statistics.py +++ b/titrate/statistics.py @@ -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), ( @@ -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), (