Accepting request 1105311 from home:bnavigator:branches:devel:languages:python:numeric

- Update to 0.10.1
  * VQT octave boundaries by @bmcfee in #1677
  * redoing 0.10.0.post1 release by @bmcfee in #1684
  * Pin pooch < 1.7 by @bmcfee in #1686
  * Post-release 2 for 0.10.0, pin pooch by @bmcfee in #1687
  * Stricter checks on yin/pyin parameters by @bmcfee in #1693
  * bumping sphinx config, fixes #1671 by @bmcfee in #1699
  * fixed bins_per_octave's docs type float to int by @kyaryunha in
    #1703
  * add volume adjustment(rms-mean) at pitch_shift by @kyaryunha in
    #1704
  * Several small documentation updates by @bmcfee in #1713
  * pin numpy version to < 1.24 in doc environment by @bmcfee in
    #1714
  * fixed broken 'latest' link generator by @bmcfee in #1716
  * README.md typo fix by @Zenitismus in #1706
  * CI for documentation builds by @bmcfee in #1718
  * reworked lazy loading of matplotlib by @bmcfee in #1722
  * Advanced example for patch generation by @bmcfee in #1719
  * support pooch >= 1.7 by @bmcfee in #1727
  * Consistent conversion of time duration/offset to sample counts
    by @bmcfee in #1726
  * Update tests for scipy 1.11 by @bmcfee in #1731
- Update to 0.10.0.post2
  * This maintenance release updates the dependency specifications
    to avoid an incompatibility with pooch >= 1.7.0. This
    restriction only affects loading of specific example files, and
    does not otherwise affect functionality of the library.
- Releae 0.10.0
  * This release provides many speedups and enhancements to core
    operations, faster importing and loading, and full type
    annotations.
  ## New features
  * #1485 Added support for “h” (hours) and “m” (minutes) in
    librosa.display.TimeFormatter. Vincent Lostanlen
  * #1495 Expanded options for bandwidth calculation in
    librosa.segment.recurrence_matrix and
    librosa.segment.cross_similarity. Tom Xi
  * #1529 Accelerated utility functions for squared magnitude
    librosa.util.abs2 and librosa.util.phasor. Brian McFee
  * #1514 librosa.stft support for pre-allocated output arrays.
    Brian McFee
  * #1533 Accelerated librosa.util.localmax and
    librosa.util.localmin. Brian McFee
  * #1552 EXPERIMENTAL Support for just-intonation based variable-Q
    transforms librosa.vqt and functional just system (FJS)
    notation. Brian McFee, Vincent Lostanlen
  * #1579 Imports are now done lazily, significantly reducing
    startup time. It is not longer necessary to explicitly import
    librosa.display. Brian McFee
  * #1587, #1632, #1637 Type annotations. Matan Gover, Brian McFee,
    Fabian Keller
  * #1647 Harmonic spectrum interpolation librosa.f0_harmonics and
    tempogram ratio features librosa.feature.tempogram_ratio. Brian
    McFee
  ## Bug fixes
  * #1560 Corrected an error in bandwidth estimation for window
    functions that take on negative sample values. Brian McFee
  * #1571 Fixed rounding error in multirate filterbank calculation
    of sampling rates. Brian McFee
  * #1594 Fixed incorrect use of deprecated numpy numerical types.
    Mattia Di Gangi
  * #1596 Fixed harmonic interpolation for recent scipy releases.
    Brian McFee
  ## API changes
  * #1561 librosa.resample now supports axis= for all sample rate
    conversion backends. Brian McFee
  * #1572 Notation conversion (e.g., librosa.midi_to_note) now
    vectorizes operations, and produces numpy.ndarray outputs
    rather than list when given iterable inputs. Brian McFee
  * #1625 Deprecations now raise FutureWarning instead of
    DeprecationWarning.
  * #1625 librosa.get_duration parameter filename has been renamed
    to path. Brian McFee
  * #1643 Removed support for threshold=None in
    librosa.zero_crossings. Brian McFee
  * #1665 Fixed overflow bug in librosa.feature.rms on integer
    inputs. Brian McFee
  ## Deprecations
  * #1521 Removed backward compatibility support for positional
    arguments that are now keyword-only. Brian McFee
  * #1577 Removed official support for python 3.6. Brian McFee
  * #1625 The audioread backend is now deprecated and will be
    removed in a future release. Brian McFee
  ## Other changes
  * #1501 Infer square / equal plot dimensions for compatible x/y
    axes in librosa.display.specshow. Kian Eliasi
  * #1535 Standardized integer type checks throughout the library.
    Alexandre Chabot-Leclerc
  * #1539 Refactored librosa.display.AdaptiveWaveplot to allow
    callback disconnection. Brian McFee
  * #1548 Removed deprecated ‘hanning’ window specification from
    tests. Brian McFee
  * #1551 Removed dependency on contextlib2. Steve Kowalik
  * #1565 Efficiency improvements to librosa.autocorrelate. Brian
    McFee
  * #1566 Changed the default sample rate conversion method from
    kaiser_best (resampy) to soxr_hq (soxr). Brian McFee
  * #1581 Updated tests for numpy 1.23 compatibility. Brian McFee
  * #1617 Accelerated librosa.yin implementation. Brian McFee
  * #1640 Updated display module dependencies to require matplotlib
    >= 3.3. Brian McFee
  * #1643 Accelerated librosa.zero_crossings implementation. Brian
    McFee
  * #1646 Added support for transposed (vertical) display of
    waveforms. Brian McFee
- Drop patches
  * remove-contextlib2.patch
  * skip-test-data-missing-tests.patch
  * update-tests-for-numpy-123.patch
  * remove-hanning-from-tests.patch
  * update-for-numpy-124.patch

OBS-URL: https://build.opensuse.org/request/show/1105311
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-librosa?expand=0&rev=33
This commit is contained in:
Markéta Machová 2023-08-22 19:02:55 +00:00 committed by Git OBS Bridge
parent 4aa9b749c8
commit 521a3cf778
12 changed files with 190 additions and 975 deletions

7
_constraints Normal file
View File

@ -0,0 +1,7 @@
<constraints>
<hardware>
<physicalmemory>
<size unit="G">12</size>
</physicalmemory>
</hardware>
</constraints>

3
librosa-0.10.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e25de58fc93497648ec665a900d3f206ad22e1f4579ca2a8a7d6f4dab5572eb8
size 2210436

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6bb5d527680c2ca733407dc69bfddfbe5cc8cc530b997c20aa288ede222d9d47
size 1994373

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c5dd7908aadf03bd098046ffaffc58b1601669cd11e0d88bb6f0f9b9d19ede9
size 12256429
oid sha256:b1782f38133323301db9a074ffac2f99f61f62f0ecdc80676331bdf5514cf832
size 15634820

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:18abbb24b8c8d4ddfff26d55acecdc84e9149e183f8fcb8467a9cbd50d297fa6
size 164603766

View File

@ -1,3 +1,123 @@
-------------------------------------------------------------------
Sun Aug 20 16:24:41 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Update to 0.10.1
* VQT octave boundaries by @bmcfee in #1677
* redoing 0.10.0.post1 release by @bmcfee in #1684
* Pin pooch < 1.7 by @bmcfee in #1686
* Post-release 2 for 0.10.0, pin pooch by @bmcfee in #1687
* Stricter checks on yin/pyin parameters by @bmcfee in #1693
* bumping sphinx config, fixes #1671 by @bmcfee in #1699
* fixed bins_per_octave's docs type float to int by @kyaryunha in
#1703
* add volume adjustment(rms-mean) at pitch_shift by @kyaryunha in
#1704
* Several small documentation updates by @bmcfee in #1713
* pin numpy version to < 1.24 in doc environment by @bmcfee in
#1714
* fixed broken 'latest' link generator by @bmcfee in #1716
* README.md typo fix by @Zenitismus in #1706
* CI for documentation builds by @bmcfee in #1718
* reworked lazy loading of matplotlib by @bmcfee in #1722
* Advanced example for patch generation by @bmcfee in #1719
* support pooch >= 1.7 by @bmcfee in #1727
* Consistent conversion of time duration/offset to sample counts
by @bmcfee in #1726
* Update tests for scipy 1.11 by @bmcfee in #1731
-------------------------------------------------------------------
Mon May 29 15:19:42 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Update to 0.10.0.post2
* This maintenance release updates the dependency specifications
to avoid an incompatibility with pooch >= 1.7.0. This
restriction only affects loading of specific example files, and
does not otherwise affect functionality of the library.
- Releae 0.10.0
* This release provides many speedups and enhancements to core
operations, faster importing and loading, and full type
annotations.
## New features
* #1485 Added support for “h” (hours) and “m” (minutes) in
librosa.display.TimeFormatter. Vincent Lostanlen
* #1495 Expanded options for bandwidth calculation in
librosa.segment.recurrence_matrix and
librosa.segment.cross_similarity. Tom Xi
* #1529 Accelerated utility functions for squared magnitude
librosa.util.abs2 and librosa.util.phasor. Brian McFee
* #1514 librosa.stft support for pre-allocated output arrays.
Brian McFee
* #1533 Accelerated librosa.util.localmax and
librosa.util.localmin. Brian McFee
* #1552 EXPERIMENTAL Support for just-intonation based variable-Q
transforms librosa.vqt and functional just system (FJS)
notation. Brian McFee, Vincent Lostanlen
* #1579 Imports are now done lazily, significantly reducing
startup time. It is not longer necessary to explicitly import
librosa.display. Brian McFee
* #1587, #1632, #1637 Type annotations. Matan Gover, Brian McFee,
Fabian Keller
* #1647 Harmonic spectrum interpolation librosa.f0_harmonics and
tempogram ratio features librosa.feature.tempogram_ratio. Brian
McFee
## Bug fixes
* #1560 Corrected an error in bandwidth estimation for window
functions that take on negative sample values. Brian McFee
* #1571 Fixed rounding error in multirate filterbank calculation
of sampling rates. Brian McFee
* #1594 Fixed incorrect use of deprecated numpy numerical types.
Mattia Di Gangi
* #1596 Fixed harmonic interpolation for recent scipy releases.
Brian McFee
## API changes
* #1561 librosa.resample now supports axis= for all sample rate
conversion backends. Brian McFee
* #1572 Notation conversion (e.g., librosa.midi_to_note) now
vectorizes operations, and produces numpy.ndarray outputs
rather than list when given iterable inputs. Brian McFee
* #1625 Deprecations now raise FutureWarning instead of
DeprecationWarning.
* #1625 librosa.get_duration parameter filename has been renamed
to path. Brian McFee
* #1643 Removed support for threshold=None in
librosa.zero_crossings. Brian McFee
* #1665 Fixed overflow bug in librosa.feature.rms on integer
inputs. Brian McFee
## Deprecations
* #1521 Removed backward compatibility support for positional
arguments that are now keyword-only. Brian McFee
* #1577 Removed official support for python 3.6. Brian McFee
* #1625 The audioread backend is now deprecated and will be
removed in a future release. Brian McFee
## Other changes
* #1501 Infer square / equal plot dimensions for compatible x/y
axes in librosa.display.specshow. Kian Eliasi
* #1535 Standardized integer type checks throughout the library.
Alexandre Chabot-Leclerc
* #1539 Refactored librosa.display.AdaptiveWaveplot to allow
callback disconnection. Brian McFee
* #1548 Removed deprecated hanning window specification from
tests. Brian McFee
* #1551 Removed dependency on contextlib2. Steve Kowalik
* #1565 Efficiency improvements to librosa.autocorrelate. Brian
McFee
* #1566 Changed the default sample rate conversion method from
kaiser_best (resampy) to soxr_hq (soxr). Brian McFee
* #1581 Updated tests for numpy 1.23 compatibility. Brian McFee
* #1617 Accelerated librosa.yin implementation. Brian McFee
* #1640 Updated display module dependencies to require matplotlib
>= 3.3. Brian McFee
* #1643 Accelerated librosa.zero_crossings implementation. Brian
McFee
* #1646 Added support for transposed (vertical) display of
waveforms. Brian McFee
- Drop patches
* remove-contextlib2.patch
* skip-test-data-missing-tests.patch
* update-tests-for-numpy-123.patch
* remove-hanning-from-tests.patch
* update-for-numpy-124.patch
-------------------------------------------------------------------
Mon May 29 13:45:26 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -16,8 +16,9 @@
#
%define static_test_data_commit 72bd79e448829187f6336818b3f6bdc2c2ae8f5a
Name: python-librosa
Version: 0.9.2
Version: 0.10.1
Release: 0
Summary: Python module for audio and music processing
License: CC-BY-3.0 AND ISC
@ -27,50 +28,48 @@ Source0: https://github.com/librosa/librosa/archive/%{version}.tar.gz#/li
Source1: librosa-create-pooch-cache.py
# Pooch test data. Use librosa-create-pooch-cache.py to create this file
Source2: librosa-pooch-cache.tar.gz
# PATCH-FIX-UPSTREAM gh#librosa/librosa#1551
Patch0: remove-contextlib2.patch
# PATCH-FIX-OPENSUSE Skip tests that require further test data that is ~180MiB
Patch1: skip-test-data-missing-tests.patch
# PATCH-FIX-UPSTREAM update-tests-for-numpy-123.patch gh#librosa/librosa#1581
Patch2: update-tests-for-numpy-123.patch
# PATCH-FIX-UPSTREAM remove-hanning-from-tests.patch gh#librosa/librosa#1548
Patch3: remove-hanning-from-tests.patch
# PATCH-FIX-UPSTREAM update-for-numpy-124.patch, parts from gh#librosa/librosa#1587, gh#librosa/librosa#1632
Patch4: update-for-numpy-124.patch
BuildRequires: %{python_module SoundFile >= 0.10.2}
# Static test data
Source3: https://github.com/librosa/librosa-test-data/archive/%{static_test_data_commit}.tar.gz#/librosa-static-test-data-%{version}.tar.gz
BuildRequires: %{python_module SoundFile >= 0.12.1}
BuildRequires: %{python_module audioread >= 2.1.9}
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module decorator >= 4.0.10}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module decorator >= 4.3.0}
BuildRequires: %{python_module joblib >= 0.14}
BuildRequires: %{python_module numba >= 0.45.1}
BuildRequires: %{python_module numpy >= 1.17.0}
BuildRequires: %{python_module packaging >= 20.0}
BuildRequires: %{python_module lazy_loader >= 0.1}
BuildRequires: %{python_module msgpack >= 1.0}
BuildRequires: %{python_module numba >= 0.51.0}
BuildRequires: %{python_module numpy >= 1.22.3}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pooch >= 1.0}
BuildRequires: %{python_module resampy >= 0.2.2}
BuildRequires: %{python_module scikit-learn >= 0.19.1}
BuildRequires: %{python_module pooch >= 1.0 with %python-pooch < 1.7}
BuildRequires: %{python_module scikit-learn >= 0.20.0}
BuildRequires: %{python_module scipy >= 1.2.0}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module soxr >= 0.3.2}
BuildRequires: %{python_module typing_extensions >= 4.1.1}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-SoundFile >= 0.10.2
Requires: python-SoundFile >= 0.12.1
Requires: python-audioread >= 2.1.9
Requires: python-decorator >= 4.0.10
Requires: python-decorator >= 4.3.0
Requires: python-joblib >= 0.14
Requires: python-numba >= 0.45.1
Requires: python-numpy >= 1.17.0
Requires: python-packaging >= 20.0
Requires: python-pooch >= 1.0
Requires: python-resampy >= 0.2.2
Requires: python-scikit-learn >= 0.19.1
Requires: python-lazy_loader >= 0.1
Requires: python-msgpack >= 1.0
Requires: python-numba >= 0.51.0
Requires: python-numpy >= 1.22.3
Requires: python-scikit-learn >= 0.20.0
Requires: python-scipy >= 1.2.0
Requires: python-soxr >= 0.3.2
Requires: python-typing_extensions >= 4.1.1
Requires: (python-pooch >= 1.0 with python-pooch < 1.7)
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module matplotlib >= 3.3.0}
BuildRequires: %{python_module packaging >= 20.0}
BuildRequires: %{python_module pytest-mpl}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module resampy >= 0.2.2}
BuildRequires: %{python_module samplerate}
BuildRequires: ffmpeg
# /SECTION
@ -83,6 +82,9 @@ systems.
%prep
%autosetup -p1 -n librosa-%{version} -a 2
pushd tests/data
tar xf %{SOURCE3} --strip-components=1
popd
# Remove unneeded shebangs
find librosa -name "*.py" -exec sed -i -e '/^#!\//, 1d' {} \;
# don't measure test coverage
@ -97,23 +99,38 @@ sed -i '/addopts/ s/--cov-report.*--cov-report=xml//' setup.cfg
%check
export LIBROSA_DATA_DIR=$PWD/librosa-pooch-cache
# test data files not packaged
donttest+=" or (test_core and test_iirt) or test_find_files"
donttest+=" or (test_features and test_cens)"
donttest+=" or (test_filters and test_semitone_filterbank)"
# image files do not match without exact mpl version
donttest+=" or test_display"
# soxr not in Tumbleweed
donttest+=" or soxr"
donttest="test_display"
# fails with current Tumbleweed
donttest+=" or test_pyin_multi_center"
# Overflow on i586
# Overflow on 32-bit
if [ $(getconf LONG_BIT) -eq 32 ]; then
donttest+=" or test_tempo or test_hybrid_cqt or test_stft_winsizes"
donttest+=" or test_istft_reconstruction or test_trim"
donttest+=" or test_nnls_multiblock"
donttest+=" or test_multichannel"
donttest+=" or test_time_stretch_multi"
donttest+=" or test_piptrack_properties"
donttest+=" or test_pitch_shift_multi"
donttest+=" or test_split_multi"
donttest+=" or test_hpss_multi"
donttest+=" or test_nn_filter_multi"
donttest+=" or (test_nnls_multiblock and 256)"
donttest+=" or (test_rms and (4096 or 4097))"
fi
%pytest -k "not (${donttest:4})" -n auto
# Flaky segfaults when run in parallel, upstream does not test with xdist
notparallel="test_piptrack"
notparallel+=" or (test_onset_strength_audio and chroma_stft)"
notparallel+=" or test_localmax"
notparallel+=" or test_localmin"
notparallel+=" or test_yin"
notparallel+=" or test_pyin"
notparallel+=" or test_tonnetz"
notparallel+=" or test_remix"
notparallel+=" or test_chroma"
notparallel+=" or test_estimate_tuning"
notparallel+=" or test_zero_crossings"
%pytest -k "not (${donttest} or ${notparallel})" -n auto
%pytest -k "not (${donttest}) and (${notparallel})"
%files %{python_files}
%doc AUTHORS.md README.md

View File

@ -1,154 +0,0 @@
From 1108bd9d23460c5e46744b873f6a7caf83089958 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Thu, 11 Aug 2022 16:53:46 +1000
Subject: [PATCH] Drop use of contextlib2
As of Python 3.7, contextlib in the standard library now supports all
functionality that this library requires. As a consequence, remove the
external requirement, and switch to it. Drive by removing some now
unneeded __future__ imports.
---
.github/environment-ci.yml | 1 -
.github/environment-minimal.yml | 1 -
librosa/version.py | 1 -
setup.cfg | 1 -
tests/test_beat.py | 4 +---
tests/test_effects.py | 2 +-
tests/test_filters.py | 2 +-
tests/test_multichannel.py | 4 +---
tests/test_onset.py | 3 +--
9 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/.github/environment-ci.yml b/.github/environment-ci.yml
index 444898d1d3..5018ab6dde 100644
--- a/.github/environment-ci.yml
+++ b/.github/environment-ci.yml
@@ -22,7 +22,6 @@ dependencies:
- pytest-mpl
- pytest-cov
- pytest
- - contextlib2
- coverage
- ffmpeg
- pip:
diff --git a/.github/environment-minimal.yml b/.github/environment-minimal.yml
index 98ddc7b99c..12d24d36af 100644
--- a/.github/environment-minimal.yml
+++ b/.github/environment-minimal.yml
@@ -22,7 +22,6 @@ dependencies:
- pytest-mpl
- pytest-cov
- pytest
- - contextlib2
- coverage
- ffmpeg
- tomli<2.0
diff --git a/librosa/version.py b/librosa/version.py
index 14b00bf7de..4b979c2f11 100644
--- a/librosa/version.py
+++ b/librosa/version.py
@@ -57,7 +57,6 @@ def show_versions():
"matplotlib",
"samplerate",
"soxr",
- "contextlib2",
"presets",
]
diff --git a/setup.cfg b/setup.cfg
index ab848a79a2..f6b4ad2b3c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -77,7 +77,6 @@ tests =
pytest-mpl
pytest-cov
pytest
- contextlib2
samplerate
soxr
display =
diff --git a/tests/test_beat.py b/tests/test_beat.py
index 0aad1bb1c0..4d38e71683 100644
--- a/tests/test_beat.py
+++ b/tests/test_beat.py
@@ -2,8 +2,6 @@
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
# unit tests for librosa.beat
-from __future__ import print_function
-
# Disable cache
import os
@@ -13,7 +11,7 @@
pass
import pytest
-from contextlib2 import nullcontext as dnr
+from contextlib import nullcontext as dnr
import numpy as np
import scipy.stats
diff --git a/tests/test_effects.py b/tests/test_effects.py
index f7d24130e7..2cdc65b08b 100644
--- a/tests/test_effects.py
+++ b/tests/test_effects.py
@@ -11,7 +11,7 @@
except KeyError:
pass
-from contextlib2 import nullcontext as dnr
+from contextlib import nullcontext as dnr
import numpy as np
import pytest
diff --git a/tests/test_filters.py b/tests/test_filters.py
index 59e351d3e0..f2c1a344bd 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -19,7 +19,7 @@
except KeyError:
pass
-from contextlib2 import nullcontext as dnr
+from contextlib import nullcontext as dnr
import glob
import numpy as np
import scipy.io
diff --git a/tests/test_multichannel.py b/tests/test_multichannel.py
index d927233321..94a5c72a99 100644
--- a/tests/test_multichannel.py
+++ b/tests/test_multichannel.py
@@ -3,8 +3,6 @@
# unit tests for multi-channel functionality
#
-from __future__ import print_function
-
# Disable cache
import os
@@ -21,7 +19,7 @@
import warnings
from unittest import mock
-from contextlib2 import nullcontext as dnr
+from contextlib import nullcontext as dnr
from test_core import srand
diff --git a/tests/test_onset.py b/tests/test_onset.py
index f74fe9e22d..91c97dc734 100644
--- a/tests/test_onset.py
+++ b/tests/test_onset.py
@@ -2,9 +2,8 @@
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
# unit tests for librosa.onset
-from __future__ import print_function
import pytest
-from contextlib2 import nullcontext as dnr
+from contextlib import nullcontext as dnr
# Disable cache
import os

View File

@ -1,21 +0,0 @@
From 2f4f68869b708e8e5dca3a4b64ac59fc86dcb2a1 Mon Sep 17 00:00:00 2001
From: Brian McFee <brian.mcfee@nyu.edu>
Date: Fri, 5 Aug 2022 12:10:28 -0400
Subject: [PATCH] removed hanning from tests, fixes #1547
---
tests/test_filters.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/tests/test_filters.py b/tests/test_filters.py
index 14c2f1dea5..59e351d3e0 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -226,7 +226,6 @@ def test_chroma_issue1295(freq):
"flattop",
"hamming",
"hann",
- "hanning",
"nuttall",
"parzen",
"triang",

View File

@ -1,410 +0,0 @@
Index: librosa-0.9.2/tests/test_core.py
===================================================================
--- librosa-0.9.2.orig/tests/test_core.py
+++ librosa-0.9.2/tests/test_core.py
@@ -21,7 +21,7 @@ import numpy as np
import scipy.io
import pytest
import warnings
-from unittest import mock
+from unittest import mock, SkipTest
# -- utilities --#
@@ -39,6 +39,11 @@ def srand(seed=628318530):
def load(infile):
return scipy.io.loadmat(infile, chars_as_strings=True)
+def _safe_load(fname, **kwargs):
+ if not os.path.exists(fname):
+ raise SkipTest()
+ return librosa.load(fname, **kwargs)
+
@pytest.mark.parametrize(
"infile", files(os.path.join("tests", "data", "core-load-*.mat"))
@@ -58,6 +63,8 @@ def test_load(infile):
def test_load_soundfile():
fname = os.path.join("tests", "data", "test1_44100.wav")
+ if not os.path.exists(fname):
+ raise SkipTest()
# Load from filename
y, sr = librosa.load(fname, sr=None, mono=False)
@@ -72,7 +79,9 @@ def test_load_soundfile():
def test_load_audioread():
fname = os.path.join("tests", "data", "test1_44100.wav")
-
+ if not os.path.exists(fname):
+ raise SkipTest()
+
# Load using an existing audioread object
reader = audioread.rawread.RawAudioFile(fname)
y, sr = librosa.load(reader, sr=None)
@@ -104,7 +113,7 @@ def test_segment_load():
sample_len = 2003
fs = 44100
test_file = os.path.join("tests", "data", "test1_44100.wav")
- y, sr = librosa.load(
+ y, sr = _safe_load(
test_file, sr=None, mono=False, offset=0.0, duration=sample_len / float(fs)
)
@@ -129,9 +138,10 @@ def test_segment_load():
)
def resample_audio(request):
infile = request.param
- y, sr_in = librosa.load(
- os.path.join("tests", "data", infile), sr=None, duration=5, mono=False
- )
+ file_ = os.path.join("tests", "data", infile)
+ if not os.path.exists(file_):
+ raise SkipTest()
+ y, sr_in = librosa.load(file_, sr=None, duration=5, mono=False)
return (y, sr_in)
@@ -599,7 +609,7 @@ def test_reassigned_spectrogram_paramete
def test_salience_basecase():
- (y, sr) = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
+ (y, sr) = _safe_load(os.path.join("tests", "data", "test1_22050.wav"))
S = np.abs(librosa.stft(y))
freqs = librosa.core.fft_frequencies(sr=sr)
harms = [1]
@@ -611,7 +621,8 @@ def test_salience_basecase():
def test_salience_basecase2():
- (y, sr) = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
+ filename = os.path.join("tests", "data", "test1_22050.wav")
+ (y, sr) = _safe_load(filename)
S = np.abs(librosa.stft(y))
freqs = librosa.core.fft_frequencies(sr=sr)
harms = [1, 0.5, 2.0]
@@ -684,13 +695,13 @@ def test_salience_aggregate():
@pytest.fixture(scope="module")
def y_22050():
- y, sr = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_22050.wav"))
return y
@pytest.fixture(scope="module")
def y_44100():
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"), sr=None)
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_44100.wav"), sr=None)
return y
@@ -777,7 +788,7 @@ def test_istft_reconstruction(y_chirp_is
"filename", files(os.path.join("tests", "data", "test1_22050.*"))
)
def test_load_options(filename, offset, duration, mono, dtype):
- y, sr = librosa.load(
+ y, sr = _safe_load(
filename, mono=mono, offset=offset, duration=duration, dtype=dtype
)
@@ -827,6 +838,8 @@ def test_get_duration_specgram(sr, dur,
def test_get_duration_filename():
filename = os.path.join("tests", "data", "test2_8000.wav")
+ if not os.path.exists(filename):
+ raise SkipTest
true_duration = 30.197625
duration_fn = librosa.get_duration(filename=filename)
@@ -839,6 +852,8 @@ def test_get_duration_filename():
def test_get_duration_mp3():
filename = os.path.join("tests", "data", "test1_22050.mp3")
+ if not os.path.exists(filename):
+ raise SkipTest()
true_duration = 4.587528344671202
duration_fn = librosa.get_duration(filename=filename)
@@ -999,13 +1014,11 @@ def pip_hop(request, pip_nfft):
def pip_spec(y_22050, pip_nfft, pip_hop):
return np.abs(librosa.stft(y_22050, n_fft=pip_nfft, hop_length=pip_hop))
-
@pytest.mark.parametrize("fmin", [0, 100])
@pytest.mark.parametrize("fmax", [4000, 8000, 11025])
@pytest.mark.parametrize("threshold", [0.1, 0.2, 0.5])
@pytest.mark.parametrize("ref", [None, 1.0, np.max])
def test_piptrack_properties(pip_spec, pip_nfft, pip_hop, fmin, fmax, threshold, ref):
-
n_fft = pip_nfft
hop_length = pip_hop
S = pip_spec
@@ -1061,7 +1074,10 @@ def test_yin_tone(freq):
def test_yin_chirp():
y = librosa.chirp(fmin=220, fmax=640, duration=1.0)
f0 = librosa.yin(y, fmin=110, fmax=880, center=False)
- target_f0 = np.load(os.path.join("tests", "data", "pitch-yin.npy"))
+ filename = os.path.join("tests", "data", "pitch-yin.npy")
+ if not os.path.exists(filename):
+ raise SkipTest()
+ target_f0 = np.load(filename)
assert np.allclose(np.log2(f0), np.log2(target_f0), rtol=0, atol=1e-2)
@@ -1138,7 +1154,10 @@ def test_pyin_chirp():
y = librosa.chirp(fmin=220, fmax=640, duration=1.0)
y = np.pad(y, (22050,))
f0, voiced_flag, _ = librosa.pyin(y, fmin=110, fmax=880, center=False)
- target_f0 = np.load(os.path.join("tests", "data", "pitch-pyin.npy"))
+ filename = os.path.join("tests", "data", "pitch-pyin.npy")
+ if not os.path.exists(filename):
+ raise SkipTest
+ target_f0 = np.load(filename)
# test if correct frames are voiced
assert np.array_equal(voiced_flag, target_f0 > 0)
# test voiced frames are within one cent of the target
@@ -1718,7 +1737,7 @@ def test_iirt():
)["f_cqt"]
# There shouldn't be a load here, but test1_44100 was resampled for this fixture :\
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"))
+ y, sr = _safe_load(os.path.join("tests", "data", "test1_44100.wav"))
mut1 = librosa.iirt(y, sr=sr, hop_length=2205, win_length=4410, flayout="ba")
@@ -2137,6 +2156,8 @@ def test_griffinlim_momentum_warn():
def test_get_samplerate(ext):
path = os.path.join("tests", "data", os.path.extsep.join(["test1_22050", ext]))
+ if not os.path.exists(path):
+ raise SkipTest()
sr = librosa.get_samplerate(path)
assert sr == 22050
@@ -2145,6 +2166,8 @@ def test_get_samplerate(ext):
def test_get_samplerate_soundfile():
path = os.path.join("tests", "data", os.path.extsep.join(["test1_22050", "wav"]))
+ if not os.path.exists(path):
+ raise SkipTest()
sfo = soundfile.SoundFile(path)
@@ -2162,9 +2185,13 @@ def path(request):
if request.param == "as_string":
yield path
elif request.param == "as_file":
+ if not os.path.exists(path):
+ raise SkipTest()
with open(path, "rb") as f:
yield f
elif request.param == "as_sfo":
+ if not os.path.exists(path):
+ raise SkipTest()
with soundfile.SoundFile(path) as f:
yield f
@@ -2204,7 +2231,8 @@ def test_stream(
fill_value,
dtype,
):
-
+ if not os.path.exists(path):
+ raise SkipTest()
stream = librosa.stream(
path,
block_length=block_length,
Index: librosa-0.9.2/tests/test_beat.py
===================================================================
--- librosa-0.9.2.orig/tests/test_beat.py
+++ librosa-0.9.2/tests/test_beat.py
@@ -11,6 +11,7 @@ except:
pass
import pytest
+import unittest
from contextlib import nullcontext as dnr
import numpy as np
@@ -24,6 +25,8 @@ __EXAMPLE_FILE = os.path.join("tests", "
@pytest.fixture(scope="module", params=[22050, 44100])
def ysr(request):
+ if not os.path.exists(__EXAMPLE_FILE):
+ raise unittest.SkipTest()
return librosa.load(__EXAMPLE_FILE, sr=request.param)
Index: librosa-0.9.2/tests/test_segment.py
===================================================================
--- librosa-0.9.2.orig/tests/test_segment.py
+++ librosa-0.9.2/tests/test_segment.py
@@ -15,6 +15,7 @@ import numpy as np
import scipy
from scipy.spatial.distance import cdist, pdist, squareform
import pytest
+import unittest
from test_core import srand
@@ -404,6 +405,8 @@ def test_timelag_filter_pos1():
@pytest.fixture(scope="module")
def ysr():
+ if not os.path.exists(__EXAMPLE_FILE):
+ raise unittest.SkipTest()
return librosa.load(__EXAMPLE_FILE)
Index: librosa-0.9.2/tests/test_onset.py
===================================================================
--- librosa-0.9.2.orig/tests/test_onset.py
+++ librosa-0.9.2/tests/test_onset.py
@@ -3,6 +3,7 @@
# unit tests for librosa.onset
import pytest
+from unittest import SkipTest
from contextlib import nullcontext as dnr
# Disable cache
@@ -26,6 +27,8 @@ __EXAMPLE_FILE = os.path.join("tests", "
@pytest.fixture(scope="module")
def ysr():
+ if not os.path.exists(__EXAMPLE_FILE):
+ raise SkipTest()
return librosa.load(__EXAMPLE_FILE)
Index: librosa-0.9.2/tests/test_effects.py
===================================================================
--- librosa-0.9.2.orig/tests/test_effects.py
+++ librosa-0.9.2/tests/test_effects.py
@@ -3,6 +3,7 @@
"""Unit tests for the effects module"""
import warnings
+from unittest import SkipTest
# Disable cache
import os
@@ -22,11 +23,15 @@ __EXAMPLE_FILE = os.path.join("tests", "
@pytest.fixture(scope="module", params=["test1_44100.wav"])
def y_multi(request):
infile = request.param
+ if not os.path.exists(__EXAMPLE_FILE):
+ raise SkipTest()
return librosa.load(os.path.join("tests", "data", infile), sr=None, mono=False)
@pytest.fixture(scope="module", params=[22050, 44100])
def ysr(request):
+ if not os.path.exists(__EXAMPLE_FILE):
+ raise SkipTest()
return librosa.load(__EXAMPLE_FILE, sr=request.param)
Index: librosa-0.9.2/tests/test_decompose.py
===================================================================
--- librosa-0.9.2.orig/tests/test_decompose.py
+++ librosa-0.9.2/tests/test_decompose.py
@@ -4,6 +4,7 @@
# Disable cache
import os
+from unittest import SkipTest
try:
os.environ.pop("LIBROSA_CACHE_DIR")
@@ -100,7 +101,10 @@ def test_sorted_decompose():
@pytest.fixture
def y22050():
- y, _ = librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
+ filename = os.path.join("tests", "data", "test1_22050.wav")
+ if not os.path.exists(filename):
+ raise SkipTest()
+ y, _ = librosa.load(filename)
return y
@@ -199,8 +203,10 @@ def test_nn_filter_mean_rec_sparse():
@pytest.fixture(scope="module")
def s_multi():
- y, sr = librosa.load(os.path.join("tests", "data", "test1_44100.wav"),
- sr=None, mono=False)
+ filename = os.path.join("tests", "data", "test1_44100.wav")
+ if not os.path.exists(filename):
+ raise SkipTest()
+ y, sr = librosa.load(filename, sr=None, mono=False)
return np.abs(librosa.stft(y))
@pytest.mark.parametrize('useR,sparse', [(False, False), (True, False), (True, True)])
Index: librosa-0.9.2/tests/test_multichannel.py
===================================================================
--- librosa-0.9.2.orig/tests/test_multichannel.py
+++ librosa-0.9.2/tests/test_multichannel.py
@@ -17,7 +17,7 @@ import numpy as np
import scipy.io
import pytest
import warnings
-from unittest import mock
+from unittest import mock, SkipTest
from contextlib import nullcontext as dnr
from test_core import srand
@@ -26,7 +26,10 @@ from test_core import srand
@pytest.fixture(scope="module", params=["test1_44100.wav"])
def y_multi(request):
infile = request.param
- return librosa.load(os.path.join("tests", "data", infile), sr=None, mono=False)
+ filename = os.path.join("tests", "data", infile)
+ if not os.path.exists(filename):
+ raise SkipTest()
+ return librosa.load(filename, sr=None, mono=False)
@pytest.fixture(scope="module")
Index: librosa-0.9.2/tests/test_features.py
===================================================================
--- librosa-0.9.2.orig/tests/test_features.py
+++ librosa-0.9.2/tests/test_features.py
@@ -4,6 +4,7 @@
from __future__ import print_function
import warnings
import numpy as np
+from unittest import SkipTest
import pytest
@@ -256,7 +257,10 @@ def test_spectral_rolloff_errors(S, pct)
@pytest.fixture(scope="module")
def y_ex():
- return librosa.load(os.path.join("tests", "data", "test1_22050.wav"))
+ filename = os.path.join("tests", "data", "test1_22050.wav")
+ if not os.path.exists(filename):
+ raise SkipTest()
+ return librosa.load(filename)
def test_spectral_contrast_log(y_ex):
@@ -487,9 +491,10 @@ def test_tonnetz_cqt(y_ex):
def test_tonnetz_msaf():
# Use pre-computed chroma
- tonnetz_chroma = np.load(
- os.path.join("tests", "data", "feature-tonnetz-chroma.npy")
- )
+ filename = os.path.join("tests", "data", "feature-tonnetz-chroma.npy")
+ if not os.path.exists(filename):
+ raise SkipTest()
+ tonnetz_chroma = np.load(filename)
tonnetz_msaf = np.load(os.path.join("tests", "data", "feature-tonnetz-msaf.npy"))
tonnetz = librosa.feature.tonnetz(chroma=tonnetz_chroma)

View File

@ -1,281 +0,0 @@
Index: librosa-0.9.2/librosa/segment.py
===================================================================
--- librosa-0.9.2.orig/librosa/segment.py
+++ librosa-0.9.2/librosa/segment.py
@@ -255,7 +255,7 @@ def cross_similarity(
xsim.eliminate_zeros()
if mode == "connectivity":
- xsim = xsim.astype(np.bool)
+ xsim = xsim.astype(bool)
elif mode == "affinity":
if bandwidth is None:
bandwidth = np.nanmedian(xsim.max(axis=1).data)
@@ -519,7 +519,7 @@ def recurrence_matrix(
rec.eliminate_zeros()
if mode == "connectivity":
- rec = rec.astype(np.bool)
+ rec = rec.astype(bool)
elif mode == "affinity":
if bandwidth is None:
bandwidth = np.nanmedian(rec.max(axis=1).data)
Index: librosa-0.9.2/tests/test_display.py
===================================================================
--- librosa-0.9.2.orig/tests/test_display.py
+++ librosa-0.9.2/tests/test_display.py
@@ -630,7 +630,7 @@ def test_unknown_axis(S_abs, axis):
np.arange(1, 10.0), # strictly positive
-np.arange(1, 10.0), # strictly negative
np.arange(-3, 4.0), # signed,
- np.arange(2, dtype=np.bool),
+ np.arange(2, dtype=bool),
],
) # binary
def test_cmap_robust(data):
Index: librosa-0.9.2/tests/test_decompose.py
===================================================================
--- librosa-0.9.2.orig/tests/test_decompose.py
+++ librosa-0.9.2/tests/test_decompose.py
@@ -160,7 +160,7 @@ def test_nn_filter_mean():
X_filtered = librosa.decompose.nn_filter(X)
# Normalize the recurrence matrix so dotting computes an average
- rec = librosa.util.normalize(rec.astype(np.float), axis=0, norm=1)
+ rec = librosa.util.normalize(rec.astype(float), axis=0, norm=1)
assert np.allclose(X_filtered, X.dot(rec))
@@ -182,7 +182,7 @@ def test_nn_filter_mean_rec():
assert np.allclose(X_filtered[:, i], X[:, i])
# Normalize the recurrence matrix
- rec = librosa.util.normalize(rec.astype(np.float), axis=0, norm=1)
+ rec = librosa.util.normalize(rec.astype(float), axis=0, norm=1)
assert np.allclose(X_filtered[:, 3:], (X.dot(rec))[:, 3:])
@@ -197,7 +197,7 @@ def test_nn_filter_mean_rec_sparse():
X_filtered = librosa.decompose.nn_filter(X, rec=rec)
# Normalize the recurrence matrix
- rec = librosa.util.normalize(rec.toarray().astype(np.float), axis=0, norm=1)
+ rec = librosa.util.normalize(rec.toarray().astype(float), axis=0, norm=1)
assert np.allclose(X_filtered, (X.dot(rec)))
Index: librosa-0.9.2/tests/test_dtw.py
===================================================================
--- librosa-0.9.2.orig/tests/test_dtw.py
+++ librosa-0.9.2/tests/test_dtw.py
@@ -272,7 +272,7 @@ def test_dtw_global_inf():
# path-following to (0, 0)
# Construct a cost matrix where full alignment is impossible
- C = np.zeros((4, 4), dtype=np.float)
+ C = np.zeros((4, 4), dtype=float)
C[-1, -1] = np.inf
with pytest.raises(librosa.ParameterError):
librosa.sequence.dtw(C=C, subseq=False)
@@ -280,7 +280,7 @@ def test_dtw_global_inf():
def test_dtw_subseq_inf():
# Construct a cost matrix where partial alignment is impossible
- C = np.zeros((4, 4), dtype=np.float)
+ C = np.zeros((4, 4), dtype=float)
C[-1, :] = np.inf
with pytest.raises(librosa.ParameterError):
@@ -289,7 +289,7 @@ def test_dtw_subseq_inf():
def test_dtw_subseq_pass():
# Construct a cost matrix where partial alignment is possible
- C = np.zeros((4, 4), dtype=np.float)
+ C = np.zeros((4, 4), dtype=float)
C[-1, 2:] = np.inf
librosa.sequence.dtw(C=C, subseq=True)
Index: librosa-0.9.2/tests/test_effects.py
===================================================================
--- librosa-0.9.2.orig/tests/test_effects.py
+++ librosa-0.9.2/tests/test_effects.py
@@ -122,8 +122,8 @@ def test_pitch_shift_multi(y_multi):
def test_remix_mono(align_zeros):
# without zc alignment
- y = np.asarray([1, 1, -1, -1, 2, 2, -1, -1, 1, 1], dtype=np.float)
- y_t = np.asarray([-1, -1, -1, -1, 1, 1, 1, 1, 2, 2], dtype=np.float)
+ y = np.asarray([1, 1, -1, -1, 2, 2, -1, -1, 1, 1], dtype=float)
+ y_t = np.asarray([-1, -1, -1, -1, 1, 1, 1, 1, 2, 2], dtype=float)
intervals = np.asarray([[2, 4], [6, 8], [0, 2], [8, 10], [4, 6]])
y_out = librosa.effects.remix(y, intervals, align_zeros=align_zeros)
@@ -134,8 +134,8 @@ def test_remix_mono(align_zeros):
def test_remix_stereo(align_zeros):
# without zc alignment
- y = np.asarray([1, 1, -1, -1, 2, 2, -1, -1, 1, 1], dtype=np.float)
- y_t = np.asarray([-1, -1, -1, -1, 1, 1, 1, 1, 2, 2], dtype=np.float)
+ y = np.asarray([1, 1, -1, -1, 2, 2, -1, -1, 1, 1], dtype=float)
+ y_t = np.asarray([-1, -1, -1, -1, 1, 1, 1, 1, 2, 2], dtype=float)
y = np.vstack([y, y])
y_t = np.vstack([y_t, y_t])
Index: librosa-0.9.2/tests/test_multichannel.py
===================================================================
--- librosa-0.9.2.orig/tests/test_multichannel.py
+++ librosa-0.9.2/tests/test_multichannel.py
@@ -49,7 +49,7 @@ def tfr_multi(y_multi):
"ndim,axis", [(1, 0), (1, -1), (2, 0), (2, 1), (2, -1), (3, 0), (3, 2), (3, -1), (4, 0), (4, 3), (4, -1)]
)
def test_sync_multi(aggregate, ndim, axis):
- data = np.ones([6] * ndim, dtype=np.float)
+ data = np.ones([6] * ndim, dtype=float)
# Make some slices that don't fill the entire dimension
slices = [slice(1, 3), slice(3, 4)]
Index: librosa-0.9.2/tests/test_util.py
===================================================================
--- librosa-0.9.2.orig/tests/test_util.py
+++ librosa-0.9.2/tests/test_util.py
@@ -866,7 +866,7 @@ def test_index_to_slice(idx, idx_min, id
"ndim,axis", [(1, 0), (1, -1), (2, 0), (2, 1), (2, -1), (3, 0), (3, 2), (3, -1)]
)
def test_sync(aggregate, ndim, axis):
- data = np.ones([6] * ndim, dtype=np.float)
+ data = np.ones([6] * ndim, dtype=float)
# Make some slices that don't fill the entire dimension
slices = [slice(1, 3), slice(3, 4)]
Index: librosa-0.9.2/librosa/core/constantq.py
===================================================================
--- librosa-0.9.2.orig/librosa/core/constantq.py
+++ librosa-0.9.2/librosa/core/constantq.py
@@ -287,7 +287,7 @@ def hybrid_cqt(
Returns
-------
- CQT : np.ndarray [shape=(..., n_bins, t), dtype=np.float]
+ CQT : np.ndarray [shape=(..., n_bins, t), dtype=float]
Constant-Q energy for each frequency at each time.
See Also
@@ -468,7 +468,7 @@ def pseudo_cqt(
Returns
-------
- CQT : np.ndarray [shape=(..., n_bins, t), dtype=np.float]
+ CQT : np.ndarray [shape=(..., n_bins, t), dtype=float]
Pseudo Constant-Q energy for each frequency at each time.
Notes
@@ -622,7 +622,7 @@ def icqt(
Returns
-------
- y : np.ndarray, [shape=(..., n_samples), dtype=np.float]
+ y : np.ndarray, [shape=(..., n_samples), dtype=float]
Audio time-series reconstructed from the CQT representation.
See Also
@@ -889,7 +889,7 @@ def vqt(
Returns
-------
- VQT : np.ndarray [shape=(..., n_bins, t), dtype=np.complex]
+ VQT : np.ndarray [shape=(..., n_bins, t), dtype=complex]
Variable-Q value each frequency at each time.
See Also
Index: librosa-0.9.2/librosa/core/spectrum.py
===================================================================
--- librosa-0.9.2.orig/librosa/core/spectrum.py
+++ librosa-0.9.2/librosa/core/spectrum.py
@@ -2544,7 +2544,7 @@ def _spectrogram(
Returns
-------
- S_out : np.ndarray [dtype=np.float]
+ S_out : np.ndarray [dtype=float]
- If ``S`` is provided as input, then ``S_out == S``
- Else, ``S_out = |stft(y, ...)|**power``
n_fft : int > 0
Index: librosa-0.9.2/librosa/util/utils.py
===================================================================
--- librosa-0.9.2.orig/librosa/util/utils.py
+++ librosa-0.9.2/librosa/util/utils.py
@@ -2181,7 +2181,7 @@ def dtype_c2r(d, *, default=np.float32):
mapping = {
np.dtype(np.complex64): np.float32,
np.dtype(np.complex128): np.float64,
- np.dtype(complex): np.dtype(np.float).type,
+ np.dtype(complex): np.dtype(float).type,
}
# If we're given a real type already, return it
Index: librosa-0.9.2/tests/test_convert.py
===================================================================
--- librosa-0.9.2.orig/tests/test_convert.py
+++ librosa-0.9.2/tests/test_convert.py
@@ -531,7 +531,7 @@ def test_blocks_to_frames(blocks, block_
assert np.allclose(frames, block_length * np.asanyarray(blocks))
# Check dtype
- assert np.issubdtype(frames.dtype, np.int)
+ assert np.issubdtype(frames.dtype, int)
@pytest.mark.parametrize("blocks", [0, 1, [10, 20]])
@@ -548,7 +548,7 @@ def test_blocks_to_samples(blocks, block
assert np.allclose(samples, np.asanyarray(blocks) * hop_length * block_length)
# Check dtype
- assert np.issubdtype(samples.dtype, np.int)
+ assert np.issubdtype(samples.dtype, int)
@pytest.mark.parametrize("blocks", [0, 1, [10, 20]])
@@ -568,7 +568,7 @@ def test_blocks_to_time(blocks, block_le
)
# Check dtype
- assert np.issubdtype(times.dtype, np.float)
+ assert np.issubdtype(times.dtype, float)
@pytest.mark.parametrize("abbr", [False, True])
Index: librosa-0.9.2/tests/test_failures.py
===================================================================
--- librosa-0.9.2.orig/tests/test_failures.py
+++ librosa-0.9.2/tests/test_failures.py
@@ -24,7 +24,7 @@ def test_mono_valid_stereo():
@pytest.mark.xfail(raises=librosa.ParameterError)
def test_valid_audio_int():
- y = np.zeros(10, dtype=np.int)
+ y = np.zeros(10, dtype=int)
librosa.util.valid_audio(y)
Index: librosa-0.9.2/tests/test_core.py
===================================================================
--- librosa-0.9.2.orig/tests/test_core.py
+++ librosa-0.9.2/tests/test_core.py
@@ -1347,7 +1347,7 @@ def test_amplitude_to_db_complex():
x = np.abs(np.random.randn(1000)) + NOISE_FLOOR
with warnings.catch_warnings(record=True) as out:
- db1 = librosa.amplitude_to_db(x.astype(np.complex), top_db=None)
+ db1 = librosa.amplitude_to_db(x.astype(complex), top_db=None)
assert len(out) > 0
assert "complex" in str(out[0].message).lower()
@@ -1883,7 +1883,7 @@ def test_pcen_drc(S_pcen, bias, power):
def test_pcen_complex():
- S = np.ones((9, 30), dtype=np.complex)
+ S = np.ones((9, 30), dtype=complex)
Pexp = np.ones((9, 30))
with warnings.catch_warnings(record=True) as out:

View File

@ -1,66 +0,0 @@
From 5dd212036667a524cf29480d5351ee5e5eca5693 Mon Sep 17 00:00:00 2001
From: Brian McFee <brian.mcfee@nyu.edu>
Date: Mon, 26 Sep 2022 13:26:26 -0400
Subject: [PATCH] updated tests for numpy 1.23 compatibility
---
tests/test_core.py | 2 ++
tests/test_multichannel.py | 6 +++---
tests/test_util.py | 6 +++---
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/tests/test_core.py b/tests/test_core.py
index 57c3458aee..d83f5b6e5a 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -2122,6 +2122,8 @@ def test_pcen_stream_multi(axis):
slice2 = [slice(None)] * x.ndim
slice2[axis] = slice(10, None)
+ slice1 = tuple(slice1)
+ slice2 = tuple(slice2)
# Compute pcen piecewise
p1, zf1 = librosa.pcen(x[slice1], return_zf=True, axis=axis)
p2, zf2 = librosa.pcen(x[slice2], zi=zf1, return_zf=True, axis=axis)
diff --git a/tests/test_multichannel.py b/tests/test_multichannel.py
index 19531842fd..8a0490bd82 100644
--- a/tests/test_multichannel.py
+++ b/tests/test_multichannel.py
@@ -65,13 +65,13 @@ def test_sync_multi(aggregate, ndim, axis):
idx = [slice(None)] * ndim
idx[axis] = 0
if aggregate is np.sum:
- assert np.allclose(dsync[idx], 2)
+ assert np.allclose(dsync[tuple(idx)], 2)
else:
- assert np.allclose(dsync[idx], 1)
+ assert np.allclose(dsync[tuple(idx)], 1)
# The second slice will sum to 1 and have mean 1
idx[axis] = 1
- assert np.allclose(dsync[idx], 1)
+ assert np.allclose(dsync[tuple(idx)], 1)
def test_stft_multi(y_multi):
diff --git a/tests/test_util.py b/tests/test_util.py
index 1b90087611..eebbf432c2 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -877,13 +877,13 @@ def test_sync(aggregate, ndim, axis):
idx = [slice(None)] * ndim
idx[axis] = 0
if aggregate is np.sum:
- assert np.allclose(dsync[idx], 2)
+ assert np.allclose(dsync[tuple(idx)], 2)
else:
- assert np.allclose(dsync[idx], 1)
+ assert np.allclose(dsync[tuple(idx)], 1)
# The second slice will sum to 1 and have mean 1
idx[axis] = 1
- assert np.allclose(dsync[idx], 1)
+ assert np.allclose(dsync[tuple(idx)], 1)
@pytest.mark.parametrize("aggregate", [np.mean, np.max])