Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b9cdec

Browse files
committed
Fix specgram test on NumPy 1.20.
In NumPy 1.20, the fft is slight different (more accurate?) and returns 0 as the last entry, instead of some small number ~1e-30. This causes a divide-by-zero warning in `log10`. However, this test doesn't really care about the spectrogram, just the frequencies, so we can change the scale to linear to avoid the warning.
1 parent 2ea0d63 commit 7b9cdec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4452,7 +4452,7 @@ def test_specgram_angle():
44524452

44534453
def test_specgram_fs_none():
44544454
"""Test axes.specgram when Fs is None, should not throw error."""
4455-
spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None)
4455+
spec, freqs, t, im = plt.specgram(np.ones(300), Fs=None, scale='linear')
44564456
xmin, xmax, freq0, freq1 = im.get_extent()
44574457
assert xmin == 32 and xmax == 96
44584458

0 commit comments

Comments
 (0)