This repository was archived by the owner on Feb 7, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
Failing test #242
Copy link
Copy link
Open
Labels
Description
Activity
And now failing with 0.2.6 on master (b2444828a1a6682a3976d8ab9758b26bca9a7592) and scipy 1.9.1
________________________________ test_tonality _________________________________ window = 'hanning', Nx = 10025, fftbins = True def get_window(window, Nx, fftbins=True): """ Return a window of a given length and type. Parameters ---------- window : string, float, or tuple The type of window to create. See below for more details. Nx : int The number of samples in the window. fftbins : bool, optional If True (default), create a "periodic" window, ready to use with `ifftshift` and be multiplied by the result of an FFT (see also :func:`~scipy.fft.fftfreq`). If False, create a "symmetric" window, for use in filter design. Returns ------- get_window : ndarray Returns a window of length `Nx` and type `window` Notes ----- Window types: - `~scipy.signal.windows.boxcar` - `~scipy.signal.windows.triang` - `~scipy.signal.windows.blackman` - `~scipy.signal.windows.hamming` - `~scipy.signal.windows.hann` - `~scipy.signal.windows.bartlett` - `~scipy.signal.windows.flattop` - `~scipy.signal.windows.parzen` - `~scipy.signal.windows.bohman` - `~scipy.signal.windows.blackmanharris` - `~scipy.signal.windows.nuttall` - `~scipy.signal.windows.barthann` - `~scipy.signal.windows.cosine` - `~scipy.signal.windows.exponential` - `~scipy.signal.windows.tukey` - `~scipy.signal.windows.taylor` - `~scipy.signal.windows.kaiser` (needs beta) - `~scipy.signal.windows.kaiser_bessel_derived` (needs beta) - `~scipy.signal.windows.gaussian` (needs standard deviation) - `~scipy.signal.windows.general_cosine` (needs weighting coefficients) - `~scipy.signal.windows.general_gaussian` (needs power, width) - `~scipy.signal.windows.general_hamming` (needs window coefficient) - `~scipy.signal.windows.dpss` (needs normalized half-bandwidth) - `~scipy.signal.windows.chebwin` (needs attenuation) If the window requires no parameters, then `window` can be a string. If the window requires parameters, then `window` must be a tuple with the first argument the string name of the window, and the next arguments the needed parameters. If `window` is a floating point number, it is interpreted as the beta parameter of the `~scipy.signal.windows.kaiser` window. Each of the window types listed above is also the name of a function that can be called directly to create a window of that type. Examples -------- >>> from scipy import signal >>> signal.get_window('triang', 7) array([ 0.125, 0.375, 0.625, 0.875, 0.875, 0.625, 0.375]) >>> signal.get_window(('kaiser', 4.0), 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) >>> signal.get_window(('exponential', None, 1.), 9) array([ 0.011109 , 0.03019738, 0.082085 , 0.22313016, 0.60653066, 0.60653066, 0.22313016, 0.082085 , 0.03019738]) >>> signal.get_window(4.0, 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) """ sym = not fftbins try: > beta = float(window) E ValueError: could not convert string to float: 'hanning' /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/windows/_windows.py:2214: ValueError During handling of the above exception, another exception occurred: window = 'hanning', Nx = 10025, fftbins = True def get_window(window, Nx, fftbins=True): """ Return a window of a given length and type. Parameters ---------- window : string, float, or tuple The type of window to create. See below for more details. Nx : int The number of samples in the window. fftbins : bool, optional If True (default), create a "periodic" window, ready to use with `ifftshift` and be multiplied by the result of an FFT (see also :func:`~scipy.fft.fftfreq`). If False, create a "symmetric" window, for use in filter design. Returns ------- get_window : ndarray Returns a window of length `Nx` and type `window` Notes ----- Window types: - `~scipy.signal.windows.boxcar` - `~scipy.signal.windows.triang` - `~scipy.signal.windows.blackman` - `~scipy.signal.windows.hamming` - `~scipy.signal.windows.hann` - `~scipy.signal.windows.bartlett` - `~scipy.signal.windows.flattop` - `~scipy.signal.windows.parzen` - `~scipy.signal.windows.bohman` - `~scipy.signal.windows.blackmanharris` - `~scipy.signal.windows.nuttall` - `~scipy.signal.windows.barthann` - `~scipy.signal.windows.cosine` - `~scipy.signal.windows.exponential` - `~scipy.signal.windows.tukey` - `~scipy.signal.windows.taylor` - `~scipy.signal.windows.kaiser` (needs beta) - `~scipy.signal.windows.kaiser_bessel_derived` (needs beta) - `~scipy.signal.windows.gaussian` (needs standard deviation) - `~scipy.signal.windows.general_cosine` (needs weighting coefficients) - `~scipy.signal.windows.general_gaussian` (needs power, width) - `~scipy.signal.windows.general_hamming` (needs window coefficient) - `~scipy.signal.windows.dpss` (needs normalized half-bandwidth) - `~scipy.signal.windows.chebwin` (needs attenuation) If the window requires no parameters, then `window` can be a string. If the window requires parameters, then `window` must be a tuple with the first argument the string name of the window, and the next arguments the needed parameters. If `window` is a floating point number, it is interpreted as the beta parameter of the `~scipy.signal.windows.kaiser` window. Each of the window types listed above is also the name of a function that can be called directly to create a window of that type. Examples -------- >>> from scipy import signal >>> signal.get_window('triang', 7) array([ 0.125, 0.375, 0.625, 0.875, 0.875, 0.625, 0.375]) >>> signal.get_window(('kaiser', 4.0), 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) >>> signal.get_window(('exponential', None, 1.), 9) array([ 0.011109 , 0.03019738, 0.082085 , 0.22313016, 0.60653066, 0.60653066, 0.22313016, 0.082085 , 0.03019738]) >>> signal.get_window(4.0, 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) """ sym = not fftbins try: beta = float(window) except (TypeError, ValueError) as e: args = () if isinstance(window, tuple): winstr = window[0] if len(window) > 1: args = window[1:] elif isinstance(window, str): if window in _needs_param: raise ValueError("The '" + window + "' window needs one or " "more parameters -- pass a tuple.") from e else: winstr = window else: raise ValueError("%s as window type is not supported." % str(type(window))) from e try: > winfunc = _win_equiv[winstr] E KeyError: 'hanning' /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/windows/_windows.py:2232: KeyError The above exception was the direct cause of the following exception: def test_tonality(): duration = 60.0 fs = 10025.0 samples = int(fs * duration) times = np.arange(samples) / fs signal = Signal(np.sin(2.0 * np.pi * 1000.0 * times), fs) tonality = Tonality(signal, signal.fs) # Test methods before analysis > tonality.spectrum tests/standards/test_iso_1996_2_2007.py:20: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ acoustics/standards/iso_1996_2_2007.py:213: in spectrum f, p = welch(self.signal, fs=self.sample_frequency, nperseg=nbins, window=self.window, detrend=False, /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/_spectral_py.py:446: in welch freqs, Pxx = csd(x, x, fs=fs, window=window, nperseg=nperseg, /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/_spectral_py.py:580: in csd freqs, _, Pxy = _spectral_helper(x, y, fs, window, nperseg, noverlap, nfft, /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/_spectral_py.py:1780: in _spectral_help win, nperseg = _triage_segments(window, nperseg, input_length=x.shape[-1]) /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/_spectral_py.py:2003: in _triage_segmen win = get_window(window, nperseg) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ window = 'hanning', Nx = 10025, fftbins = True def get_window(window, Nx, fftbins=True): """ Return a window of a given length and type. Parameters ---------- window : string, float, or tuple The type of window to create. See below for more details. Nx : int The number of samples in the window. fftbins : bool, optional If True (default), create a "periodic" window, ready to use with `ifftshift` and be multiplied by the result of an FFT (see also :func:`~scipy.fft.fftfreq`). If False, create a "symmetric" window, for use in filter design. Returns ------- get_window : ndarray Returns a window of length `Nx` and type `window` Notes ----- Window types: - `~scipy.signal.windows.boxcar` - `~scipy.signal.windows.triang` - `~scipy.signal.windows.blackman` - `~scipy.signal.windows.hamming` - `~scipy.signal.windows.hann` - `~scipy.signal.windows.bartlett` - `~scipy.signal.windows.flattop` - `~scipy.signal.windows.parzen` - `~scipy.signal.windows.bohman` - `~scipy.signal.windows.blackmanharris` - `~scipy.signal.windows.nuttall` - `~scipy.signal.windows.barthann` - `~scipy.signal.windows.cosine` - `~scipy.signal.windows.exponential` - `~scipy.signal.windows.tukey` - `~scipy.signal.windows.taylor` - `~scipy.signal.windows.kaiser` (needs beta) - `~scipy.signal.windows.kaiser_bessel_derived` (needs beta) - `~scipy.signal.windows.gaussian` (needs standard deviation) - `~scipy.signal.windows.general_cosine` (needs weighting coefficients) - `~scipy.signal.windows.general_gaussian` (needs power, width) - `~scipy.signal.windows.general_hamming` (needs window coefficient) - `~scipy.signal.windows.dpss` (needs normalized half-bandwidth) - `~scipy.signal.windows.chebwin` (needs attenuation) If the window requires no parameters, then `window` can be a string. If the window requires parameters, then `window` must be a tuple with the first argument the string name of the window, and the next arguments the needed parameters. If `window` is a floating point number, it is interpreted as the beta parameter of the `~scipy.signal.windows.kaiser` window. Each of the window types listed above is also the name of a function that can be called directly to create a window of that type. Examples -------- >>> from scipy import signal >>> signal.get_window('triang', 7) array([ 0.125, 0.375, 0.625, 0.875, 0.875, 0.625, 0.375]) >>> signal.get_window(('kaiser', 4.0), 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) >>> signal.get_window(('exponential', None, 1.), 9) array([ 0.011109 , 0.03019738, 0.082085 , 0.22313016, 0.60653066, 0.60653066, 0.22313016, 0.082085 , 0.03019738]) >>> signal.get_window(4.0, 9) array([ 0.08848053, 0.29425961, 0.56437221, 0.82160913, 0.97885093, 0.97885093, 0.82160913, 0.56437221, 0.29425961]) """ sym = not fftbins try: beta = float(window) except (TypeError, ValueError) as e: args = () if isinstance(window, tuple): winstr = window[0] if len(window) > 1: args = window[1:] elif isinstance(window, str): if window in _needs_param: raise ValueError("The '" + window + "' window needs one or " "more parameters -- pass a tuple.") from e else: winstr = window else: raise ValueError("%s as window type is not supported." % str(type(window))) from e try: winfunc = _win_equiv[winstr] except KeyError as e: > raise ValueError("Unknown window type.") from e E ValueError: Unknown window type. /nix/store/18rm2w2r6q6ms5xb12z8mbgrplv5bbxk-python3.10-scipy-1.9.1/lib/python3.10/site-packages/scipy/signal/windows/_windows.py:2234: ValueError
Failing test with nixpkgs at d10a0143d0cbf3777c0e386c8dac635b59754cf2.