1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
From: Ole Streicher <olebole@debian.org>
Date: Sun, 9 Feb 2025 14:36:20 +0100
Subject: Explicitly cast doctest results to float
Closes: #1095328
---
astroML/density_estimation/empirical.py | 4 ++--
astroML/utils/utils.py | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/astroML/density_estimation/empirical.py b/astroML/density_estimation/empirical.py
index 6020b14..47fc4ce 100644
--- a/astroML/density_estimation/empirical.py
+++ b/astroML/density_estimation/empirical.py
@@ -71,10 +71,10 @@ class EmpiricalDistribution:
>>> import numpy as np
>>> np.random.seed(0)
>>> x = np.random.normal(size=10000) # normally-distributed variables
- >>> x.mean(), x.std()
+ >>> float(x.mean()), float(x.std())
(-0.018433720158265783, 0.98755656817612003)
>>> x2 = EmpiricalDistribution(x).rvs(10000)
- >>> x2.mean(), x2.std()
+ >>> float(x2.mean()), float(x2.std())
(-0.020293716681613363, 1.0039249294845276)
Notes
diff --git a/astroML/utils/utils.py b/astroML/utils/utils.py
index c4e0ff5..5c771de 100644
--- a/astroML/utils/utils.py
+++ b/astroML/utils/utils.py
@@ -53,7 +53,7 @@ def log_multivariate_gaussian(x, mu, V, Vinv=None, method=1):
>>> x = [1, 2]
>>> mu = [0, 0]
>>> V = [[2, 1], [1, 2]]
- >>> log_multivariate_gaussian(x, mu, V)
+ >>> float(log_multivariate_gaussian(x, mu, V))
-3.3871832107434003
"""
x = np.asarray(x, dtype=float)
|