Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Failing test #242

Description

@FRidh

Failing test with nixpkgs at d10a0143d0cbf3777c0e386c8dac635b59754cf2.

/build/acoustics-0.2.3/tests /build/acoustics-0.2.3
============================= test session starts ==============================
platform linux -- Python 3.7.6, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
rootdir: /build/acoustics-0.2.3
collected 504 items                                                            

test__signal.py ........................................................ [ 11%]
........................................................................ [ 25%]                                                                                                                                                                    
...............................                                          [ 31%]                                                                                                                                                                    
test_aio.py ............................................................ [ 43%]
................................................................         [ 56%]                                                                                                                                                                    
test_atmosphere.py ..                                                    [ 56%]
test_bands.py ................                                           [ 59%]
test_building.py .........                                               [ 61%]
test_cepstrum.py ..                                                      [ 61%]
test_criterion.py ...................                                    [ 65%]
test_decibel.py ......                                                   [ 66%]
test_descriptors.py ..........                                           [ 68%]
test_directivity.py .....                                                [ 69%]
test_generator.py ..............................                         [ 75%]
test_imaging.py .....                                                    [ 76%]
test_octave.py ..                                                        [ 77%]
test_power.py ...                                                        [ 77%]
test_room.py .............................                               [ 83%]
test_signal.py ...................................................       [ 93%]
test_utils.py ..............                                             [ 96%]
test_weighting.py ......                                                 [ 97%]
standards/test_iec_61672_1_2013.py ..........                            [ 99%]
standards/test_iso_1996_2_2007.py F                                      [ 99%]
standards/test_iso_tr_25417_2007.py .                                    [100%]

=================================== FAILURES ===================================
________________________________ test_tonality _________________________________

    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
        tonality.plot_spectrum()
    
        tonality.frequency_resolution
        tonality.effective_analysis_bandwidth
    
        # No values yet, cannot print overview.
        with pytest.raises(ValueError):
            print(tonality.overview())
        tonality.results_as_dataframe()
    
        assert len(list(tonality.noise_pauses)) == 0
        assert len(list(tonality.tones)) == 0
        assert len(list(tonality.critical_bands)) == 0
    
        # Perform analysis
>       tonality.determine_noise_pauses().analyse()

standards/test_iso_1996_2_2007.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/nix/store/ndi5w75n7cvgfchh5y1icykk6jhvhnkq-python3.7-acoustics-0.2.3/lib/python3.7/site-packages/acoustics/standards/iso_1996_2_2007.py:321: in analyse
    self._determine_tones()
/nix/store/ndi5w75n7cvgfchh5y1icykk6jhvhnkq-python3.7-acoustics-0.2.3/lib/python3.7/site-packages/acoustics/standards/iso_1996_2_2007.py:295: in _determine_tones
    self.force_bandwidth_criterion,
/nix/store/ndi5w75n7cvgfchh5y1icykk6jhvhnkq-python3.7-acoustics-0.2.3/lib/python3.7/site-packages/acoustics/standards/iso_1996_2_2007.py:658: in determine_tone_lines
    indices_3db = np.nonzero(levels.iloc[npr] >= levels.iloc[npr].max() - TONE_BANDWIDTH_CRITERION_DB)[0]
<__array_function__ internals>:6: in nonzero
    ???
/nix/store/mg6agzzf88rxhsc5j3lhgv68sdwvc4hd-python3.7-numpy-1.18.1/lib/python3.7/site-packages/numpy/core/fromnumeric.py:1896: in nonzero
    return _wrapfunc(a, 'nonzero')
/nix/store/mg6agzzf88rxhsc5j3lhgv68sdwvc4hd-python3.7-numpy-1.18.1/lib/python3.7/site-packages/numpy/core/fromnumeric.py:58: in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
/nix/store/mg6agzzf88rxhsc5j3lhgv68sdwvc4hd-python3.7-numpy-1.18.1/lib/python3.7/site-packages/numpy/core/fromnumeric.py:51: in _wrapit
    result = wrap(result)
/nix/store/sdvrxnwmjbs14p27racmgidjkwg5ypw3-python3.7-pandas-1.0.1/lib/python3.7/site-packages/pandas/core/generic.py:1918: in __array_wrap__
    return self._constructor(result, **d).__finalize__(self)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'Series' object has no attribute '_name'") raised in repr()] Series object at 0x7fffe072d850>
data = array([[1, 2]])
index = Float64Index([4.0, 5.0, 6.0, 7.0], dtype='float64'), dtype = None
name = None, copy = False, fastpath = False

    def __init__(
        self, data=None, index=None, dtype=None, name=None, copy=False, fastpath=False
    ):
    
        # we are called internally, so short-circuit
        if fastpath:
    
            # data is an ndarray, index is defined
            if not isinstance(data, SingleBlockManager):
                data = SingleBlockManager(data, index, fastpath=True)
            if copy:
                data = data.copy()
            if index is None:
                index = data.index
    
        else:
    
            name = ibase.maybe_extract_name(name, data, type(self))
    
            if is_empty_data(data) and dtype is None:
                # gh-17261
                warnings.warn(
                    "The default dtype for empty Series will be 'object' instead "
                    "of 'float64' in a future version. Specify a dtype explicitly "
                    "to silence this warning.",
                    DeprecationWarning,
                    stacklevel=2,
                )
                # uncomment the line below when removing the DeprecationWarning
                # dtype = np.dtype(object)
    
            if index is not None:
                index = ensure_index(index)
    
            if data is None:
                data = {}
            if dtype is not None:
                dtype = self._validate_dtype(dtype)
    
            if isinstance(data, MultiIndex):
                raise NotImplementedError(
                    "initializing a Series from a MultiIndex is not supported"
                )
            elif isinstance(data, Index):
    
                if dtype is not None:
                    # astype copies
                    data = data.astype(dtype)
                else:
                    # need to copy to avoid aliasing issues
                    data = data._values.copy()
                    if isinstance(data, ABCDatetimeIndex) and data.tz is not None:
                        # GH#24096 need copy to be deep for datetime64tz case
                        # TODO: See if we can avoid these copies
                        data = data._values.copy(deep=True)
                copy = False
    
            elif isinstance(data, np.ndarray):
                if len(data.dtype):
                    # GH#13296 we are dealing with a compound dtype, which
                    #  should be treated as 2D
                    raise ValueError(
                        "Cannot construct a Series from an ndarray with "
                        "compound dtype.  Use DataFrame instead."
                    )
                pass
            elif isinstance(data, ABCSeries):
                if index is None:
                    index = data.index
                else:
                    data = data.reindex(index, copy=copy)
                data = data._data
            elif is_dict_like(data):
                data, index = self._init_dict(data, index, dtype)
                dtype = None
                copy = False
            elif isinstance(data, SingleBlockManager):
                if index is None:
                    index = data.index
                elif not data.index.equals(index) or copy:
                    # GH#19275 SingleBlockManager input should only be called
                    # internally
                    raise AssertionError(
                        "Cannot pass both SingleBlockManager "
                        "`data` argument and a different "
                        "`index` argument. `copy` must be False."
                    )
    
            elif is_extension_array_dtype(data):
                pass
            elif isinstance(data, (set, frozenset)):
                raise TypeError(f"'{type(data).__name__}' type is unordered")
            elif isinstance(data, ABCSparseArray):
                # handle sparse passed here (and force conversion)
                data = data.to_dense()
            else:
                data = com.maybe_iterable_to_list(data)
    
            if index is None:
                if not is_list_like(data):
                    data = [data]
                index = ibase.default_index(len(data))
            elif is_list_like(data):
    
                # a scalar numpy array is list-like but doesn't
                # have a proper length
                try:
                    if len(index) != len(data):
                        raise ValueError(
>                           f"Length of passed values is {len(data)}, "
                            f"index implies {len(index)}."
                        )
E                       ValueError: Length of passed values is 1, index implies 4.

/nix/store/sdvrxnwmjbs14p27racmgidjkwg5ypw3-python3.7-pandas-1.0.1/lib/python3.7/site-packages/pandas/core/series.py:292: ValueError
=============================== warnings summary ===============================
standards/test_iec_61672_1_2013.py:30
  /build/acoustics-0.2.3/tests/standards/test_iec_61672_1_2013.py:30: DeprecationWarning: invalid escape sequence \c
    """

-- Docs: https://docs.pytest.org/en/latest/warnings.html
================== 1 failed, 503 passed, 1 warning in 17.45s ===================
builder for '/nix/store/10sbf7k08xjbq84jc2qvymly3gvs1q1s-python3.7-acoustics-0.2.3.drv' failed with exit code 1
error: build of '/nix/store/10sbf7k08xjbq84jc2qvymly3gvs1q1s-python3.7-acoustics-0.2.3.drv' failed

Activity

  1. mweinelt commented on Nov 15, 2022

    @mweinelt

    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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions