diff --git a/src/pyhf/infer/calculators.py b/src/pyhf/infer/calculators.py index ed8eaaf9c6..04ac58aec1 100644 --- a/src/pyhf/infer/calculators.py +++ b/src/pyhf/infer/calculators.py @@ -120,8 +120,8 @@ def cdf(self, value): >>> import pyhf >>> pyhf.set_backend("numpy") >>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0) - >>> bkg_dist.cdf(0.0) - np.float64(0.5) + >>> print(bkg_dist.cdf(0.0)) + 0.5 Args: value (:obj:`float`): The test statistic value. @@ -619,8 +619,8 @@ def expected_value(self, nsigma): >>> normal = pyhf.probability.Normal(mean, std) >>> samples = normal.sample((100,)) >>> dist = pyhf.infer.calculators.EmpiricalDistribution(samples) - >>> dist.expected_value(nsigma=1) - np.float64(6.15094381...) + >>> print(dist.expected_value(nsigma=1)) + 6.15094381... >>> import pyhf >>> import numpy.random as random diff --git a/src/pyhf/probability.py b/src/pyhf/probability.py index 8505757840..ed00c205f4 100644 --- a/src/pyhf/probability.py +++ b/src/pyhf/probability.py @@ -170,11 +170,11 @@ def log_prob(self, value): >>> poissons = pyhf.probability.Poisson(rates) >>> independent = pyhf.probability.Independent(poissons) >>> values = pyhf.tensorlib.astensor([8.0, 9.0]) - >>> independent.log_prob(values) - np.float64(-4.26248380...) + >>> print(independent.log_prob(values)) + -4.26248380... >>> broadcast_value = pyhf.tensorlib.astensor([11.0]) - >>> independent.log_prob(broadcast_value) - np.float64(-4.34774364...) + >>> print(independent.log_prob(broadcast_value)) + -4.34774364... Args: value (:obj:`tensor` or :obj:`float`): The value at which to evaluate the distribution diff --git a/src/pyhf/tensor/numpy_backend.py b/src/pyhf/tensor/numpy_backend.py index b7ca445a70..8135d15068 100644 --- a/src/pyhf/tensor/numpy_backend.py +++ b/src/pyhf/tensor/numpy_backend.py @@ -319,8 +319,8 @@ def percentile( >>> import pyhf >>> pyhf.set_backend("numpy") >>> a = pyhf.tensorlib.astensor([[10, 7, 4], [3, 2, 1]]) - >>> pyhf.tensorlib.percentile(a, 50) - np.float64(3.5) + >>> print(pyhf.tensorlib.percentile(a, 50)) + 3.5 >>> pyhf.tensorlib.percentile(a, 50, axis=1) array([7., 2.]) @@ -380,11 +380,11 @@ def simple_broadcast(self, *args: Sequence[Tensor[T]]) -> Sequence[Tensor[T]]: >>> import pyhf >>> pyhf.set_backend("numpy") - >>> pyhf.tensorlib.simple_broadcast( + >>> list(pyhf.tensorlib.simple_broadcast( ... pyhf.tensorlib.astensor([1]), ... pyhf.tensorlib.astensor([2, 3, 4]), - ... pyhf.tensorlib.astensor([5, 6, 7])) - (array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.])) + ... pyhf.tensorlib.astensor([5, 6, 7]))) + [array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.])] Args: args (Array of Tensors): Sequence of arrays @@ -466,8 +466,8 @@ def poisson(self, n: Tensor[T], lam: Tensor[T]) -> ArrayLike: >>> import pyhf >>> pyhf.set_backend("numpy") - >>> pyhf.tensorlib.poisson(5., 6.) - np.float64(0.16062314...) + >>> print(pyhf.tensorlib.poisson(5., 6.)) + 0.16062314... >>> values = pyhf.tensorlib.astensor([5., 9.]) >>> rates = pyhf.tensorlib.astensor([6., 8.]) >>> pyhf.tensorlib.poisson(values, rates) @@ -509,8 +509,8 @@ def normal(self, x: Tensor[T], mu: Tensor[T], sigma: Tensor[T]) -> ArrayLike: >>> import pyhf >>> pyhf.set_backend("numpy") - >>> pyhf.tensorlib.normal(0.5, 0., 1.) - np.float64(0.35206532...) + >>> print(pyhf.tensorlib.normal(0.5, 0., 1.)) + 0.35206532... >>> values = pyhf.tensorlib.astensor([0.5, 2.0]) >>> means = pyhf.tensorlib.astensor([0., 2.3]) >>> sigmas = pyhf.tensorlib.astensor([1., 0.8]) @@ -537,8 +537,8 @@ def normal_cdf( >>> import pyhf >>> pyhf.set_backend("numpy") - >>> pyhf.tensorlib.normal_cdf(0.8) - np.float64(0.78814460...) + >>> print(pyhf.tensorlib.normal_cdf(0.8)) + 0.78814460... >>> values = pyhf.tensorlib.astensor([0.8, 2.0]) >>> pyhf.tensorlib.normal_cdf(values) array([0.7881446 , 0.97724987])