Skip to content

Commit d38d6f2

Browse files
kratsgmatthewfeickert
authored andcommitted
fix up again more with prints/list...
1 parent d7e6a0d commit d38d6f2

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/pyhf/infer/calculators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ def cdf(self, value):
120120
>>> import pyhf
121121
>>> pyhf.set_backend("numpy")
122122
>>> bkg_dist = pyhf.infer.calculators.AsymptoticTestStatDistribution(0.0)
123-
>>> bkg_dist.cdf(0.0)
124-
np.float64(0.5)
123+
>>> print(bkg_dist.cdf(0.0))
124+
0.5
125125
126126
Args:
127127
value (:obj:`float`): The test statistic value.
@@ -619,8 +619,8 @@ def expected_value(self, nsigma):
619619
>>> normal = pyhf.probability.Normal(mean, std)
620620
>>> samples = normal.sample((100,))
621621
>>> dist = pyhf.infer.calculators.EmpiricalDistribution(samples)
622-
>>> dist.expected_value(nsigma=1)
623-
np.float64(6.15094381...)
622+
>>> print(dist.expected_value(nsigma=1))
623+
6.15094381...
624624
625625
>>> import pyhf
626626
>>> import numpy.random as random

src/pyhf/probability.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,11 @@ def log_prob(self, value):
170170
>>> poissons = pyhf.probability.Poisson(rates)
171171
>>> independent = pyhf.probability.Independent(poissons)
172172
>>> values = pyhf.tensorlib.astensor([8.0, 9.0])
173-
>>> independent.log_prob(values)
174-
np.float64(-4.26248380...)
173+
>>> print(independent.log_prob(values))
174+
-4.26248380...
175175
>>> broadcast_value = pyhf.tensorlib.astensor([11.0])
176-
>>> independent.log_prob(broadcast_value)
177-
np.float64(-4.34774364...)
176+
>>> print(independent.log_prob(broadcast_value))
177+
-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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ def percentile(
319319
>>> import pyhf
320320
>>> pyhf.set_backend("numpy")
321321
>>> a = pyhf.tensorlib.astensor([[10, 7, 4], [3, 2, 1]])
322-
>>> pyhf.tensorlib.percentile(a, 50)
323-
np.float64(3.5)
322+
>>> print(pyhf.tensorlib.percentile(a, 50))
323+
3.5
324324
>>> pyhf.tensorlib.percentile(a, 50, axis=1)
325325
array([7., 2.])
326326
@@ -380,11 +380,11 @@ def simple_broadcast(self, *args: Sequence[Tensor[T]]) -> Sequence[Tensor[T]]:
380380
381381
>>> import pyhf
382382
>>> pyhf.set_backend("numpy")
383-
>>> pyhf.tensorlib.simple_broadcast(
383+
>>> list(pyhf.tensorlib.simple_broadcast(
384384
... pyhf.tensorlib.astensor([1]),
385385
... pyhf.tensorlib.astensor([2, 3, 4]),
386-
... pyhf.tensorlib.astensor([5, 6, 7]))
387-
(array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.]))
386+
... pyhf.tensorlib.astensor([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
@@ -466,8 +466,8 @@ def poisson(self, n: Tensor[T], lam: Tensor[T]) -> ArrayLike:
466466
467467
>>> import pyhf
468468
>>> pyhf.set_backend("numpy")
469-
>>> pyhf.tensorlib.poisson(5., 6.)
470-
np.float64(0.16062314...)
469+
>>> print(pyhf.tensorlib.poisson(5., 6.))
470+
0.16062314...
471471
>>> values = pyhf.tensorlib.astensor([5., 9.])
472472
>>> rates = pyhf.tensorlib.astensor([6., 8.])
473473
>>> pyhf.tensorlib.poisson(values, rates)
@@ -509,8 +509,8 @@ def normal(self, x: Tensor[T], mu: Tensor[T], sigma: Tensor[T]) -> ArrayLike:
509509
510510
>>> import pyhf
511511
>>> pyhf.set_backend("numpy")
512-
>>> pyhf.tensorlib.normal(0.5, 0., 1.)
513-
np.float64(0.35206532...)
512+
>>> print(pyhf.tensorlib.normal(0.5, 0., 1.))
513+
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])
@@ -537,8 +537,8 @@ def normal_cdf(
537537
538538
>>> import pyhf
539539
>>> pyhf.set_backend("numpy")
540-
>>> pyhf.tensorlib.normal_cdf(0.8)
541-
np.float64(0.78814460...)
540+
>>> print(pyhf.tensorlib.normal_cdf(0.8))
541+
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)