Skip to content

Commit 5af54ad

Browse files
committed
fix up again more with prints/list...
1 parent 2d9a2aa commit 5af54ad

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
@@ -326,8 +326,8 @@ def percentile(
326326
>>> import pyhf
327327
>>> pyhf.set_backend("numpy")
328328
>>> a = pyhf.tensorlib.astensor([[10, 7, 4], [3, 2, 1]])
329-
>>> pyhf.tensorlib.percentile(a, 50)
330-
np.float64(3.5)
329+
>>> print(pyhf.tensorlib.percentile(a, 50))
330+
3.5
331331
>>> pyhf.tensorlib.percentile(a, 50, axis=1)
332332
array([7., 2.])
333333
@@ -387,11 +387,11 @@ def simple_broadcast(self, *args: Sequence[Tensor[T]]) -> Sequence[Tensor[T]]:
387387
388388
>>> import pyhf
389389
>>> pyhf.set_backend("numpy")
390-
>>> pyhf.tensorlib.simple_broadcast(
390+
>>> list(pyhf.tensorlib.simple_broadcast(
391391
... pyhf.tensorlib.astensor([1]),
392392
... pyhf.tensorlib.astensor([2, 3, 4]),
393-
... pyhf.tensorlib.astensor([5, 6, 7]))
394-
(array([1., 1., 1.]), array([2., 3., 4.]), array([5., 6., 7.]))
393+
... pyhf.tensorlib.astensor([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
@@ -473,8 +473,8 @@ def poisson(self, n: Tensor[T], lam: Tensor[T]) -> ArrayLike:
473473
474474
>>> import pyhf
475475
>>> pyhf.set_backend("numpy")
476-
>>> pyhf.tensorlib.poisson(5., 6.)
477-
np.float64(0.16062314...)
476+
>>> print(pyhf.tensorlib.poisson(5., 6.))
477+
0.16062314...
478478
>>> values = pyhf.tensorlib.astensor([5., 9.])
479479
>>> rates = pyhf.tensorlib.astensor([6., 8.])
480480
>>> pyhf.tensorlib.poisson(values, rates)
@@ -516,8 +516,8 @@ def normal(self, x: Tensor[T], mu: Tensor[T], sigma: Tensor[T]) -> ArrayLike:
516516
517517
>>> import pyhf
518518
>>> pyhf.set_backend("numpy")
519-
>>> pyhf.tensorlib.normal(0.5, 0., 1.)
520-
np.float64(0.35206532...)
519+
>>> print(pyhf.tensorlib.normal(0.5, 0., 1.))
520+
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])
@@ -544,8 +544,8 @@ def normal_cdf(
544544
545545
>>> import pyhf
546546
>>> pyhf.set_backend("numpy")
547-
>>> pyhf.tensorlib.normal_cdf(0.8)
548-
np.float64(0.78814460...)
547+
>>> print(pyhf.tensorlib.normal_cdf(0.8))
548+
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)