Skip to content

Commit 2bab47b

Browse files
committed
fix doctest
1 parent 8987126 commit 2bab47b

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
@@ -327,7 +327,7 @@ def percentile(
327327
>>> pyhf.set_backend("numpy")
328328
>>> a = pyhf.tensorlib.astensor([[10, 7, 4], [3, 2, 1]])
329329
>>> pyhf.tensorlib.percentile(a, 50)
330-
3.5
330+
np.float64(3.5)
331331
>>> pyhf.tensorlib.percentile(a, 50, axis=1)
332332
array([7., 2.])
333333
@@ -391,7 +391,7 @@ def simple_broadcast(self, *args: Sequence[Tensor[T]]) -> Sequence[Tensor[T]]:
391391
... pyhf.tensorlib.astensor([1]),
392392
... pyhf.tensorlib.astensor([2, 3, 4]),
393393
... pyhf.tensorlib.astensor([5, 6, 7]))
394-
[array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.])]
394+
(array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.]))
395395
396396
Args:
397397
args (Array of Tensors): Sequence of arrays
@@ -474,7 +474,7 @@ def poisson(self, n: Tensor[T], lam: Tensor[T]) -> ArrayLike:
474474
>>> import pyhf
475475
>>> pyhf.set_backend("numpy")
476476
>>> pyhf.tensorlib.poisson(5., 6.)
477-
0.16062314...
477+
np.float64(0.16062314...)
478478
>>> values = pyhf.tensorlib.astensor([5., 9.])
479479
>>> rates = pyhf.tensorlib.astensor([6., 8.])
480480
>>> pyhf.tensorlib.poisson(values, rates)
@@ -517,7 +517,7 @@ def normal(self, x: Tensor[T], mu: Tensor[T], sigma: Tensor[T]) -> ArrayLike:
517517
>>> import pyhf
518518
>>> pyhf.set_backend("numpy")
519519
>>> pyhf.tensorlib.normal(0.5, 0., 1.)
520-
0.35206532...
520+
np.float64(0.35206532...)
521521
>>> values = pyhf.tensorlib.astensor([0.5, 2.0])
522522
>>> means = pyhf.tensorlib.astensor([0., 2.3])
523523
>>> sigmas = pyhf.tensorlib.astensor([1., 0.8])
@@ -545,7 +545,7 @@ def normal_cdf(
545545
>>> import pyhf
546546
>>> pyhf.set_backend("numpy")
547547
>>> pyhf.tensorlib.normal_cdf(0.8)
548-
0.78814460...
548+
np.float64(0.78814460...)
549549
>>> values = pyhf.tensorlib.astensor([0.8, 2.0])
550550
>>> pyhf.tensorlib.normal_cdf(values)
551551
array([0.7881446 , 0.97724987])

0 commit comments

Comments
 (0)