From 38a09da41c677a8215cd252854252127aba47c6b Mon Sep 17 00:00:00 2001 From: Nil Fons Miret Date: Mon, 25 Mar 2024 21:10:53 +0000 Subject: [PATCH] perf_metric: fix DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. --- python/vmaf/tools/sigproc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/vmaf/tools/sigproc.py b/python/vmaf/tools/sigproc.py index e282b6043..a434e31a8 100644 --- a/python/vmaf/tools/sigproc.py +++ b/python/vmaf/tools/sigproc.py @@ -125,7 +125,9 @@ def calpvalue(aucs, sigma): # pvalue = 2 * (1 - normcdf(z, 0, 1)); l = np.array([[1, -1]]) z = np.abs(np.diff(aucs)) / np.sqrt(np.dot(np.dot(l, sigma), l.T)) - pvalue = 2 * (1 - scipy.stats.norm.cdf(z, loc=0, scale=1)) + # numpy returns a 2-dimensional array with shape (1, 1), extract the element + z_val = z[0, 0] + pvalue = 2 * (1 - scipy.stats.norm.cdf(z_val, loc=0, scale=1)) return pvalue