Skip to content

Commit

Permalink
Merge 8e95180 into dff4432
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcfee committed Feb 20, 2020
2 parents dff4432 + 8e95180 commit 68996a9
Show file tree
Hide file tree
Showing 43 changed files with 3,845 additions and 4,666 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
@@ -1,5 +1,3 @@
sudo: false

cache:
directories:
- $HOME/env
Expand All @@ -9,17 +7,21 @@ language: python
notifications:
email: false

python:
- 3.6

matrix:
jobs:
include:
- python: 3.6
os: linux
dist: xenial
- python: 3.7
os: linux
dist: xenial
- os: osx
language: generic
osx_image: xcode11

before_install:
- bash .travis_dependencies.sh
- export PATH="$HOME/env/miniconda$TRAVIS_PYTHON_VERSION/bin:$PATH";
- export PATH="$HOME/env/miniconda-$TRAVIS_OS_NAME$TRAVIS_PYTHON_VERSION/bin:$PATH";
- hash -r
- source activate test-environment
- conda list
Expand Down
12 changes: 8 additions & 4 deletions .travis_dependencies.sh
Expand Up @@ -17,14 +17,18 @@ conda_create ()
conda update --all
}

src="$HOME/env/miniconda$TRAVIS_PYTHON_VERSION"
src="$HOME/env/miniconda-$TRAVIS_OS_NAME$TRAVIS_PYTHON_VERSION"
if [ ! -d "$src" ]; then
mkdir -p $HOME/env
pushd $HOME/env

# Download miniconda packages
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;

if [ "$TRAVIS_OS_NAME" = "osx" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O miniconda.sh;
fi
if [ "$TRAVIS_OS_NAME" = "linux" ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
# Install both environments
bash miniconda.sh -b -p $src

Expand All @@ -33,7 +37,7 @@ if [ ! -d "$src" ]; then

source activate $ENV_NAME

conda install -c conda-forge ffmpeg pysoundfile python-coveralls
conda install -c conda-forge ffmpeg pysoundfile coveralls

source deactivate
popd
Expand Down
3 changes: 3 additions & 0 deletions librosa/display.py
Expand Up @@ -950,6 +950,9 @@ def __decorate_axis(axis, ax_type):
axis.set_label_text('')
axis.set_ticks([])

else:
raise ParameterError('Unsupported axis type: {}'.format(ax_type))


def __coord_fft_hz(n, sr=22050, **_kwargs):
'''Get the frequencies for FFT bins'''
Expand Down
4 changes: 1 addition & 3 deletions librosa/feature/spectral.py
Expand Up @@ -838,8 +838,6 @@ def rms(y=None, S=None, frame_length=2048, hop_length=512,
>>> plt.show()
'''
if y is not None and S is not None:
raise ValueError('Either `y` or `S` should be input.')
if y is not None:
y = to_mono(y)
if center:
Expand Down Expand Up @@ -873,7 +871,7 @@ def rms(y=None, S=None, frame_length=2048, hop_length=512,
# Calculate power
power = 2 * np.sum(x, axis=0, keepdims=True) / frame_length**2
else:
raise ValueError('Either `y` or `S` must be input.')
raise ParameterError('Either `y` or `S` must be input.')

return np.sqrt(power)

Expand Down
2 changes: 1 addition & 1 deletion librosa/filters.py
Expand Up @@ -199,7 +199,7 @@ def mel(sr, n_fft, n_mels=128, fmin=0.0, fmax=None, htk=False,
FutureWarning)

elif norm not in (None, 1, 'slaney', np.inf):
raise ParameterError("Unsupported norm={}, must be one of: {None, 1, 'slaney', np.inf}".format(repr(norm)))
raise ParameterError("Unsupported norm={}, must be one of: None, 1, 'slaney', np.inf".format(repr(norm)))

# Initialize the weights
n_mels = int(n_mels)
Expand Down
2 changes: 1 addition & 1 deletion librosa/segment.py
Expand Up @@ -161,7 +161,7 @@ def cross_similarity(data, data_ref, k=None, metric='euclidean',
data = np.atleast_2d(data)

if data_ref.shape[0] != data.shape[0]:
raise ValueError("data_ref and data must have the same first dimension")
raise ParameterError("data_ref and data must have the same first dimension")

# swap data axes so the feature axis is last
data_ref = np.swapaxes(data_ref, -1, 0)
Expand Down
4 changes: 2 additions & 2 deletions librosa/sequence.py
Expand Up @@ -939,7 +939,7 @@ def viterbi(prob, transition, p_init=None, return_logp=False):
if p_init is None:
p_init = np.empty(n_states)
p_init.fill(1./n_states)
elif np.any(p_init < 0) or not np.allclose(p_init.sum(), 1):
elif np.any(p_init < 0) or not np.allclose(p_init.sum(), 1) or p_init.shape != (n_states,):
raise ParameterError('Invalid initial state distribution: '
'p_init={}'.format(p_init))

Expand Down Expand Up @@ -1126,7 +1126,7 @@ def viterbi_discriminative(prob, transition, p_state=None, p_init=None, return_l
if p_init is None:
p_init = np.empty(n_states)
p_init.fill(1./n_states)
elif np.any(p_init < 0) or not np.allclose(p_init.sum(), 1):
elif np.any(p_init < 0) or not np.allclose(p_init.sum(), 1) or p_init.shape != (n_states,):
raise ParameterError('Invalid initial state distribution: '
'p_init={}'.format(p_init))

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -57,7 +57,8 @@
'mock',
'pytest-mpl',
'pytest-cov',
'pytest < 4'],
'pytest',
'contextlib2'],
'display': ['matplotlib >= 1.5'],
}
)
Binary file added tests/data/core-lpcburg-001.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-002.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-003.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-004.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-005.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-006.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-007.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-008.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-009.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-010.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-011.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-012.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-013.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-014.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-015.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-016.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-017.mat
Binary file not shown.
Binary file added tests/data/core-lpcburg-018.mat
Binary file not shown.

0 comments on commit 68996a9

Please sign in to comment.