Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d83473d

Browse filesBrowse files
authored
Merge pull request #10040 from matplotlib/auto-backport-of-pr-10019
Backport PR #10019 on branch v2.1.x
2 parents 7167748 + 4217af0 commit d83473d
Copy full SHA for d83473d

File tree

Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-0
lines changed

‎lib/matplotlib/tests/test_mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_mlab.py
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,20 @@ def test_psd_windowarray_equal(self):
21362136
assert_allclose(speca, specb, atol=1e-08)
21372137

21382138

2139+
# extra test for cohere...
2140+
def test_cohere():
2141+
N = 1024
2142+
np.random.seed(19680801)
2143+
x = np.random.randn(N)
2144+
# phase offset
2145+
y = np.roll(x, 20)
2146+
# high-freq roll-off
2147+
y = np.convolve(y, np.ones(20) / 20., mode='same')
2148+
cohsq, f = mlab.cohere(x, y, NFFT=256, Fs=2, noverlap=128)
2149+
assert_allclose(np.mean(cohsq), 0.837, atol=1.e-3)
2150+
assert np.isreal(np.mean(cohsq))
2151+
2152+
21392153
def test_griddata_linear():
21402154
# z is a linear function of x and y.
21412155
def get_z(x, y):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.