From 4217af0f38cc991d970fa987c46ed266191759d7 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 18 Dec 2017 15:03:04 -0500 Subject: [PATCH] Backport PR #10019: TST: test mlab cohere --- lib/matplotlib/tests/test_mlab.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/matplotlib/tests/test_mlab.py b/lib/matplotlib/tests/test_mlab.py index ef36eaf0b702..9ea18d67c281 100644 --- a/lib/matplotlib/tests/test_mlab.py +++ b/lib/matplotlib/tests/test_mlab.py @@ -2136,6 +2136,20 @@ def test_psd_windowarray_equal(self): assert_allclose(speca, specb, atol=1e-08) +# extra test for cohere... +def test_cohere(): + N = 1024 + np.random.seed(19680801) + x = np.random.randn(N) + # phase offset + y = np.roll(x, 20) + # high-freq roll-off + y = np.convolve(y, np.ones(20) / 20., mode='same') + cohsq, f = mlab.cohere(x, y, NFFT=256, Fs=2, noverlap=128) + assert_allclose(np.mean(cohsq), 0.837, atol=1.e-3) + assert np.isreal(np.mean(cohsq)) + + def test_griddata_linear(): # z is a linear function of x and y. def get_z(x, y): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy