From 704af1278bc56eb54370b863130caaec42e59615 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Sat, 21 Dec 2024 12:12:32 -0500 Subject: [PATCH] migrate get_backend --- src/pyhf/cli/infer.py | 3 ++- src/pyhf/infer/__init__.py | 2 +- src/pyhf/infer/calculators.py | 2 +- src/pyhf/infer/intervals/upper_limits.py | 2 +- src/pyhf/infer/mle.py | 2 +- src/pyhf/infer/test_statistics.py | 2 +- src/pyhf/modifiers/lumi.py | 3 ++- src/pyhf/modifiers/normfactor.py | 3 ++- src/pyhf/modifiers/normsys.py | 3 ++- src/pyhf/optimize/opt_jax.py | 2 +- src/pyhf/optimize/opt_numpy.py | 2 +- src/pyhf/optimize/opt_pytorch.py | 2 +- src/pyhf/optimize/opt_tflow.py | 2 +- src/pyhf/probability.py | 2 +- 14 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/pyhf/cli/infer.py b/src/pyhf/cli/infer.py index f2b0dce107..38649d48b2 100644 --- a/src/pyhf/cli/infer.py +++ b/src/pyhf/cli/infer.py @@ -9,7 +9,8 @@ from pyhf.infer import hypotest from pyhf.infer import mle from pyhf.workspace import Workspace -from pyhf import get_backend, set_backend, optimize +from pyhf.tensor.manager import get_backend, set_backend +from pyhf import optimize log = logging.getLogger(__name__) diff --git a/src/pyhf/infer/__init__.py b/src/pyhf/infer/__init__.py index 058a7460d6..d75516f61c 100644 --- a/src/pyhf/infer/__init__.py +++ b/src/pyhf/infer/__init__.py @@ -1,7 +1,7 @@ """Inference for Statistical Models.""" from pyhf.infer import utils -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf import exceptions diff --git a/src/pyhf/infer/calculators.py b/src/pyhf/infer/calculators.py index f9922c6d89..f0066b501d 100644 --- a/src/pyhf/infer/calculators.py +++ b/src/pyhf/infer/calculators.py @@ -9,7 +9,7 @@ """ from pyhf.infer.mle import fixed_poi_fit -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf.infer import utils import tqdm diff --git a/src/pyhf/infer/intervals/upper_limits.py b/src/pyhf/infer/intervals/upper_limits.py index 6b86d586fe..ece45201ba 100644 --- a/src/pyhf/infer/intervals/upper_limits.py +++ b/src/pyhf/infer/intervals/upper_limits.py @@ -3,7 +3,7 @@ import numpy as np from scipy.optimize import toms748 -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf.infer import hypotest __all__ = ["linear_grid_scan", "toms748_scan", "upper_limit"] diff --git a/src/pyhf/infer/mle.py b/src/pyhf/infer/mle.py index c269eb47c8..7c0420f076 100644 --- a/src/pyhf/infer/mle.py +++ b/src/pyhf/infer/mle.py @@ -1,6 +1,6 @@ """Module for Maximum Likelihood Estimation.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf.exceptions import UnspecifiedPOI __all__ = ["fit", "fixed_poi_fit", "twice_nll"] diff --git a/src/pyhf/infer/test_statistics.py b/src/pyhf/infer/test_statistics.py index 97b6babe79..245e13cd35 100644 --- a/src/pyhf/infer/test_statistics.py +++ b/src/pyhf/infer/test_statistics.py @@ -1,4 +1,4 @@ -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf.infer.mle import fixed_poi_fit, fit from pyhf.exceptions import UnspecifiedPOI diff --git a/src/pyhf/modifiers/lumi.py b/src/pyhf/modifiers/lumi.py index 748c1fb972..7b2279f779 100644 --- a/src/pyhf/modifiers/lumi.py +++ b/src/pyhf/modifiers/lumi.py @@ -1,7 +1,8 @@ import logging import pyhf -from pyhf import get_backend, events +from pyhf.tensor.manager import get_backend +from pyhf import events from pyhf.parameters import ParamViewer log = logging.getLogger(__name__) diff --git a/src/pyhf/modifiers/normfactor.py b/src/pyhf/modifiers/normfactor.py index 6639530121..547c76d031 100644 --- a/src/pyhf/modifiers/normfactor.py +++ b/src/pyhf/modifiers/normfactor.py @@ -1,7 +1,8 @@ import logging import pyhf -from pyhf import get_backend, events +from pyhf.tensor.manager import get_backend +from pyhf import events from pyhf.parameters import ParamViewer log = logging.getLogger(__name__) diff --git a/src/pyhf/modifiers/normsys.py b/src/pyhf/modifiers/normsys.py index 96cf1ff5c0..ee319d5187 100644 --- a/src/pyhf/modifiers/normsys.py +++ b/src/pyhf/modifiers/normsys.py @@ -1,7 +1,8 @@ import logging import pyhf -from pyhf import get_backend, events +from pyhf.tensor.manager import get_backend +from pyhf import events from pyhf import interpolators from pyhf.parameters import ParamViewer diff --git a/src/pyhf/optimize/opt_jax.py b/src/pyhf/optimize/opt_jax.py index 5567678844..be14632123 100644 --- a/src/pyhf/optimize/opt_jax.py +++ b/src/pyhf/optimize/opt_jax.py @@ -1,6 +1,6 @@ """JAX Backend Function Shim.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf.tensor.common import _TensorViewer import jax import logging diff --git a/src/pyhf/optimize/opt_numpy.py b/src/pyhf/optimize/opt_numpy.py index 8f3d4178cf..7032c9e748 100644 --- a/src/pyhf/optimize/opt_numpy.py +++ b/src/pyhf/optimize/opt_numpy.py @@ -1,6 +1,6 @@ """Numpy Backend Function Shim.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend from pyhf import exceptions diff --git a/src/pyhf/optimize/opt_pytorch.py b/src/pyhf/optimize/opt_pytorch.py index 55b204ff41..7e0fafe9ca 100644 --- a/src/pyhf/optimize/opt_pytorch.py +++ b/src/pyhf/optimize/opt_pytorch.py @@ -1,6 +1,6 @@ """PyTorch Backend Function Shim.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend import torch diff --git a/src/pyhf/optimize/opt_tflow.py b/src/pyhf/optimize/opt_tflow.py index 178bc332ac..76647b084b 100644 --- a/src/pyhf/optimize/opt_tflow.py +++ b/src/pyhf/optimize/opt_tflow.py @@ -1,6 +1,6 @@ """Tensorflow Backend Function Shim.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend import tensorflow as tf diff --git a/src/pyhf/probability.py b/src/pyhf/probability.py index 0cc0330272..3368ee90ed 100644 --- a/src/pyhf/probability.py +++ b/src/pyhf/probability.py @@ -1,6 +1,6 @@ """The probability density function module.""" -from pyhf import get_backend +from pyhf.tensor.manager import get_backend __all__ = ["Independent", "Normal", "Poisson", "Simultaneous"]