Skip to content

Commit 6a776ff

Browse files
kratsgmatthewfeickert
authored andcommitted
fix doctest
1 parent 31052d5 commit 6a776ff

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/pyhf/infer/calculators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def cdf(self, value):
121121
>>> pyhf.set_backend("numpy")
122122
>>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0)
123123
>>> bkg_dist.cdf(0.0)
124-
0.5
124+
np.float64(0.5)
125125
126126
Args:
127127
value (:obj:`float`): The test statistic value.
@@ -620,7 +620,7 @@ def expected_value(self, nsigma):
620620
>>> samples = normal.sample((100,))
621621
>>> dist = pyhf.infer.calculators.EmpiricalDistribution(samples)
622622
>>> dist.expected_value(nsigma=1)
623-
6.15094381...
623+
np.float64(6.15094381...)
624624
625625
>>> import pyhf
626626
>>> import numpy.random as random

src/pyhf/probability.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ def log_prob(self, value):
171171
>>> independent = pyhf.probability.Independent(poissons)
172172
>>> values = pyhf.tensorlib.astensor([8.0, 9.0])
173173
>>> independent.log_prob(values)
174-
-4.26248380...
174+
np.float64(-4.26248380...)
175175
>>> broadcast_value = pyhf.tensorlib.astensor([11.0])
176176
>>> independent.log_prob(broadcast_value)
177-
-4.34774364...
177+
np.float64(-4.34774364...)
178178
179179
Args:
180180
value (:obj:`tensor` or :obj:`float`): The value at which to evaluate the distribution

src/pyhf/tensor/numpy_backend.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def percentile(
320320
>>> pyhf.set_backend("numpy")
321321
>>> a = pyhf.tensorlib.astensor([[10, 7, 4], [3, 2, 1]])
322322
>>> pyhf.tensorlib.percentile(a, 50)
323-
3.5
323+
np.float64(3.5)
324324
>>> pyhf.tensorlib.percentile(a, 50, axis=1)
325325
array([7., 2.])
326326
@@ -384,7 +384,7 @@ def simple_broadcast(self, *args: Sequence[Tensor[T]]) -> Sequence[Tensor[T]]:
384384
... pyhf.tensorlib.astensor([1]),
385385
... pyhf.tensorlib.astensor([2, 3, 4]),
386386
... pyhf.tensorlib.astensor([5, 6, 7]))
387-
[array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.])]
387+
(array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.]))
388388
389389
Args:
390390
args (Array of Tensors): Sequence of arrays
@@ -467,7 +467,7 @@ def poisson(self, n: Tensor[T], lam: Tensor[T]) -> ArrayLike:
467467
>>> import pyhf
468468
>>> pyhf.set_backend("numpy")
469469
>>> pyhf.tensorlib.poisson(5., 6.)
470-
0.16062314...
470+
np.float64(0.16062314...)
471471
>>> values = pyhf.tensorlib.astensor([5., 9.])
472472
>>> rates = pyhf.tensorlib.astensor([6., 8.])
473473
>>> pyhf.tensorlib.poisson(values, rates)
@@ -510,7 +510,7 @@ def normal(self, x: Tensor[T], mu: Tensor[T], sigma: Tensor[T]) -> ArrayLike:
510510
>>> import pyhf
511511
>>> pyhf.set_backend("numpy")
512512
>>> pyhf.tensorlib.normal(0.5, 0., 1.)
513-
0.35206532...
513+
np.float64(0.35206532...)
514514
>>> values = pyhf.tensorlib.astensor([0.5, 2.0])
515515
>>> means = pyhf.tensorlib.astensor([0., 2.3])
516516
>>> sigmas = pyhf.tensorlib.astensor([1., 0.8])
@@ -538,7 +538,7 @@ def normal_cdf(
538538
>>> import pyhf
539539
>>> pyhf.set_backend("numpy")
540540
>>> pyhf.tensorlib.normal_cdf(0.8)
541-
0.78814460...
541+
np.float64(0.78814460...)
542542
>>> values = pyhf.tensorlib.astensor([0.8, 2.0])
543543
>>> pyhf.tensorlib.normal_cdf(values)
544544
array([0.7881446 , 0.97724987])

0 commit comments

Comments
 (0)