Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Fix mlab fallback for 32-bit systems#30273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
QuLogic wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromQuLogic:mlab32
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletionslib/matplotlib/mlab.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -212,16 +212,8 @@ def detrend_linear(y):


def _stride_windows(x, n, noverlap=0):
x = np.asarray(x)

_api.check_isinstance(Integral, n=n, noverlap=noverlap)
if not (1 <= n <= x.size and n < noverlap):
raise ValueError(f'n ({n}) and noverlap ({noverlap}) must be positive integers '
f'with n < noverlap and n <= x.size ({x.size})')

if n == 1 and noverlap == 0:
return x[np.newaxis]

x = np.asarray(x)
step = n - noverlap
shape = (n, (x.shape[-1]-noverlap)//step)
strides = (x.strides[0], step*x.strides[0])
Expand DownExpand Up@@ -257,7 +249,7 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None,
if NFFT is None:
NFFT = 256

ifnoverlap >=NFFT:
ifnot (0 <= noverlap <NFFT):
raise ValueError('noverlap must be less than NFFT')

if mode is None or mode == 'default':
Expand Down
13 changes: 12 additions & 1 deletionlib/matplotlib/tests/test_mlab.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
import sys

from numpy.testing import (assert_allclose, assert_almost_equal,
assert_array_equal, assert_array_almost_equal_nulp)
import numpy as np
Expand DownExpand Up@@ -429,7 +431,16 @@ def test_spectral_helper_psd(self, mode, case):
assert spec.shape[0] == freqs.shape[0]
assert spec.shape[1] == getattr(self, f"t_{case}").shape[0]

def test_csd(self):
@pytest.mark.parametrize('bitsize', [
pytest.param(None, id='default'),
pytest.param(32,
marks=pytest.mark.skipif(sys.maxsize <= 2**32,
reason='System is already 32-bit'),
id='32-bit')
])
def test_csd(self, bitsize, monkeypatch):
if bitsize is not None:
monkeypatch.setattr(sys, 'maxsize', 2**bitsize)
freqs = self.freqs_density
spec, fsp = mlab.csd(x=self.y, y=self.y+1,
NFFT=self.NFFT_density,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp