From e589871db085fc17302f00dbf2ad8869502f8cae Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:50:24 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pyhf/infer/calculators.py | 40 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/pyhf/infer/calculators.py b/src/pyhf/infer/calculators.py index 18c8d078a7..2d9d93f478 100644 --- a/src/pyhf/infer/calculators.py +++ b/src/pyhf/infer/calculators.py @@ -674,7 +674,7 @@ def __init__( test_stat="qtilde", ntoys=2000, track_progress=True, - skip_failing_toys = False, + skip_failing_toys=False, ): r""" Toy-based Calculator. @@ -756,7 +756,7 @@ def distributions(self, poi_test, track_progress=None): """ - print('skip?',self.skip_failing_toys) + print('skip?', self.skip_failing_toys) tensorlib, _ = get_backend() sample_shape = (self.ntoys,) @@ -796,14 +796,14 @@ def distributions(self, poi_test, track_progress=None): signal_teststat = [] for sample in tqdm.tqdm(signal_sample, **tqdm_options, desc='Signal-like'): - try: + try: value = teststat_func( - poi_test, - sample, - self.pdf, - self.init_pars, - self.par_bounds, - self.fixed_params, + poi_test, + sample, + self.pdf, + self.init_pars, + self.par_bounds, + self.fixed_params, ) except RuntimeError: if self.skip_failing_toys: @@ -812,20 +812,18 @@ def distributions(self, poi_test, track_progress=None): raise if (value is not None) and (tensorlib.isfinite(value)): - signal_teststat.append( - value - ) + signal_teststat.append(value) bkg_teststat = [] for sample in tqdm.tqdm(bkg_sample, **tqdm_options, desc='Background-like'): - try: + try: value = teststat_func( - poi_test, - sample, - self.pdf, - self.init_pars, - self.par_bounds, - self.fixed_params, + poi_test, + sample, + self.pdf, + self.init_pars, + self.par_bounds, + self.fixed_params, ) except RuntimeError: if self.skip_failing_toys: @@ -834,9 +832,7 @@ def distributions(self, poi_test, track_progress=None): raise if (value is not None) and (tensorlib.isfinite(value)): - bkg_teststat.append( - value - ) + bkg_teststat.append(value) s_plus_b = EmpiricalDistribution(tensorlib.astensor(signal_teststat)) b_only = EmpiricalDistribution(tensorlib.astensor(bkg_teststat))