Skip to content

Commit

Permalink
580 mirdata multiple fixes (#581)
Browse files Browse the repository at this point in the history
* Fix tox for formatting test

* Pin black version to 23.1.0

* Upgrade librosa version and ensure python3.6 compatibility

* Black formatting with new 23.1.0 version

* Fixing egfxset expected return value

* Mock pandas import at sphinx autodoc

* Fix black version for python3.6
  • Loading branch information
guillemcortes authored Mar 7, 2023
1 parent c9fd249 commit 0620b8c
Show file tree
Hide file tree
Showing 38 changed files with 15 additions and 52 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"scipy",
"smart_open",
"openpyxl",
"pandas",
]

# # -- General configuration ---------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions mirdata/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,6 @@ def _remove_duplicates(self):
self.confidence = self.confidence[unq_idx]

def __add__(self, other):

if other is None:
return self

Expand Down Expand Up @@ -1006,7 +1005,6 @@ def to_multif0(
frequency_list: List[List[float]] = [[] for _ in times]
confidence_list: List[List[float]] = [[] for _ in times]
if self.confidence is not None:

for t0, t1, pch, conf in zip(
intervals[:, 0], intervals[:, 1], self.pitches, self.confidence
):
Expand Down Expand Up @@ -1288,7 +1286,9 @@ def _from_hz(pitches_hz, target_pitch_unit):
return pitches_midi

if target_pitch_unit == "note_name":
return librosa.hz_to_note(pitches_hz)
# cast to np.array for compatibility with legacy python3.6 and
# librosa 0.9.2. It is redundant for librosa 0.10
return np.array(librosa.hz_to_note(pitches_hz))

raise NotImplementedError

Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/billboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ def load_named_sections(fpath: str):


def _load_sections(fpath: str, section_type: str):

timed_sections = _parse_timed_sections(fpath)
assert timed_sections is not None

Expand Down
2 changes: 0 additions & 2 deletions mirdata/datasets/dagstuhl_choirset.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class Track(core.Track):
"""

def __init__(self, track_id, data_home, dataset_name, index, metadata):

super().__init__(
track_id=track_id,
data_home=data_home,
Expand Down Expand Up @@ -265,7 +264,6 @@ class MultiTrack(core.MultiTrack):
def __init__(
self, mtrack_id, data_home, dataset_name, index, track_class, metadata
):

super().__init__(
mtrack_id=mtrack_id,
data_home=data_home,
Expand Down
3 changes: 1 addition & 2 deletions mirdata/datasets/egfxset.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Track(core.Track):
setting (list): the setting of the effect recorded or "None" when the recording is a clean effect sound
Cached Properties:
note_name (list): a list with the note name annotation of the audio file (e.g. "Ab5", "C6", etc.)
note_name (ndarray): a list with the note name annotation of the audio file (e.g. "Ab5", "C6", etc.)
midinote (NoteData): the midinote annotation of the audio file
"""

Expand Down Expand Up @@ -337,7 +337,6 @@ def _metadata(self):
indexname.append(name["Effect "].split(" ")[0])

for track in tracknames:

if track[:3] == "RAT":
trackiden = track[:3].lower()

Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/filosax.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ class Track(core.Track):
"""

def __init__(self, track_id, data_home, dataset_name, index, metadata):

super().__init__(
track_id,
data_home,
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/orchset.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ def __init__(self, data_home=None, version="default"):

@core.cached_property
def _metadata(self):

predominant_inst_path = os.path.join(
self.data_home, "Orchset - Predominant Melodic Instruments.csv"
)
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/rwc_classical.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,6 @@ def __init__(self, data_home=None, version="default"):

@core.cached_property
def _metadata(self):

metadata_path = os.path.join(self.data_home, "metadata-master", "rwc-c.csv")

try:
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/rwc_jazz.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def __init__(self, data_home=None, version="default"):

@core.cached_property
def _metadata(self):

metadata_path = os.path.join(self.data_home, "metadata-master", "rwc-j.csv")

try:
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/rwc_popular.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ def __init__(self, data_home=None, version="default"):

@core.cached_property
def _metadata(self):

metadata_path = os.path.join(self.data_home, "metadata-master", "rwc-p.csv")

try:
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/salami.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def __init__(self, data_home=None, version="default"):

@core.cached_property
def _metadata(self):

metadata_path = os.path.join(
self.data_home,
os.path.join(
Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/saraga_hindustani.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ def load_tempo(fhandle):

reader = csv.reader(fhandle, delimiter=",")
for line in reader:

if "NaN" in line or " NaN" in line or "NaN " in line:
return None

Expand Down
1 change: 0 additions & 1 deletion mirdata/datasets/slakh.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ class Track(core.Track):
"""

def __init__(self, track_id, data_home, dataset_name, index, metadata):

super().__init__(
track_id,
data_home,
Expand Down
1 change: 0 additions & 1 deletion mirdata/download_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ def downloader(

if remotes[k].unpack_directories:
for src_dir in remotes[k].unpack_directories:

# path to destination directory
destination_dir = (
os.path.join(save_dir, remotes[k].destination_dir)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
keywords="mir dataset loader audio",
license="BSD-3-Clause",
install_requires=[
"black == 22.8.0", # last version for python3.6
"tqdm",
"librosa >= 0.8.0",
"librosa >= 0.9.2",
"numpy>=1.16",
"jams",
"requests",
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_acousticbrainz_genre.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def test_to_jams():


def test_filter_index():

data_home = os.path.normpath("tests/resources/mir_datasets/acousticbrainz_genre")
dataset = acousticbrainz_genre.Dataset(data_home, version="test")
index = dataset.load_all_train()
Expand All @@ -84,7 +83,6 @@ def test_filter_index():


def test_download(httpserver):

data_home = os.path.normpath(
"tests/resources/mir_datasets/acousticbrainz_genre_download"
)
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_beatles.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def test_track():


def test_to_jams():

data_home = os.path.normpath("tests/resources/mir_datasets/beatles")
dataset = beatles.Dataset(data_home)
track = dataset.track("0111")
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_billboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


def test_track():

default_trackid = "3"
data_home = "tests/resources/mir_datasets/billboard"
dataset = billboard.Dataset(data_home)
Expand Down Expand Up @@ -71,7 +70,6 @@ def test_track():


def test_to_jams():

default_trackid = "3"
data_home = "tests/resources/mir_datasets/billboard"
dataset = billboard.Dataset(data_home)
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_dagstuhl_choirset.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ def test_load_f0():


def test_load_score():

score_path = "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_scorerepresentation/DCS_LI_QuartetB_Take04_Stereo_STM_B.csv"
score = dagstuhl_choirset.load_score(score_path)
assert isinstance(score, annotations.NoteData)
Expand Down Expand Up @@ -194,7 +193,6 @@ def test_load_score():


def test_load_beat():

beat_path = "tests/resources/mir_datasets/dagstuhl_choirset/annotations_csv_beat/DCS_LI_QuartetB_Take04_Stereo_STM.csv"
beat = dagstuhl_choirset.load_beat(beat_path)
assert isinstance(beat, annotations.BeatData)
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_dali.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


def test_track():

default_trackid = "4b196e6c99574dd49ad00d56e132712b"
data_home = os.path.normpath("tests/resources/mir_datasets/dali")
dataset = dali.Dataset(data_home)
Expand Down
6 changes: 3 additions & 3 deletions tests/datasets/test_egfxset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import numpy as np
from mirdata import annotations
from mirdata.datasets import egfxset
from tests.test_utils import run_track_tests
Expand Down Expand Up @@ -35,7 +36,7 @@ def test_track():

expected_property_types = {
"audio": tuple,
"note_name": list,
"note_name": np.ndarray,
"midinote": annotations.NoteData,
}

Expand Down Expand Up @@ -74,7 +75,7 @@ def test_track():

expected_property_types = {
"audio": tuple,
"note_name": list,
"note_name": np.ndarray,
"midinote": annotations.NoteData,
}

Expand All @@ -95,7 +96,6 @@ def test_track():


def test_to_jams():

data_home = os.path.normpath("tests/resources/mir_datasets/egfxset")
dataset = egfxset.Dataset(data_home, version="test")

Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_ikala.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/ikala"
default_trackid = "10161_chorus"
dataset = ikala.Dataset(data_home)
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_medley_solos_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/medley_solos_db"
dataset = medley_solos_db.Dataset(data_home)
track = dataset.track("d07b1fc0-567d-52c2-fef4-239f31c9d40e")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_medleydb_melody.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/medleydb_melody"
dataset = medleydb_melody.Dataset(data_home)
track = dataset.track("MusicDelta_Beethoven")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_medleydb_pitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/medleydb_pitch"
dataset = medleydb_pitch.Dataset(data_home)
track = dataset.track("AClassicEducation_NightOwl_STEM_08")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_mtg_jamendo_autotagging_moodtheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def test_to_jams():


def test_get_track_splits():

dataset = mtg_jamendo_autotagging_moodtheme.Dataset(
"tests/resources/mir_datasets/mtg_jamendo_autotagging_moodtheme"
)
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_orchset.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/orchset"
dataset = orchset.Dataset(data_home)
track = dataset.track("Beethoven-S3-I-ex1")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_rwc_classical.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/rwc_classical"
dataset = rwc_classical.Dataset(data_home)
track = dataset.track("RM-C003")
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_rwc_jazz.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


def test_track():

default_trackid = "RM-J004"
data_home = os.path.normpath("tests/resources/mir_datasets/rwc_jazz")
dataset = rwc_jazz.Dataset(data_home)
Expand Down Expand Up @@ -50,7 +49,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/rwc_jazz"
dataset = rwc_jazz.Dataset(data_home)
track = dataset.track("RM-J004")
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_rwc_popular.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def test_track():

default_trackid = "RM-P001"
data_home = os.path.normpath("tests/resources/mir_datasets/rwc_popular")
dataset = rwc_popular.Dataset(data_home)
Expand Down Expand Up @@ -64,7 +63,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/rwc_popular"
dataset = rwc_popular.Dataset(data_home)
track = dataset.track("RM-P001")
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_salami.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


def test_track():

default_trackid = "2"
data_home = os.path.normpath("tests/resources/mir_datasets/salami")
dataset = salami.Dataset(data_home)
Expand Down Expand Up @@ -122,7 +121,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/salami"
dataset = salami.Dataset(data_home)
track = dataset.track("2")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_saraga_hindustani.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


def test_track():

default_trackid = "50_Irani_Bhairavi_Thumri"
data_home = os.path.normpath("tests/resources/mir_datasets/saraga_hindustani")
dataset = saraga_hindustani.Dataset(data_home)
Expand Down
2 changes: 0 additions & 2 deletions tests/datasets/test_slakh.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def test_load_tracks():


def test_to_jams():

default_trackid = "Track00001-S00"
data_home = "tests/resources/mir_datasets/slakh"
dataset = slakh.Dataset(data_home, version="test")
Expand Down Expand Up @@ -269,7 +268,6 @@ def test_multitrack():


def test_multitrack_to_jams():

default_mtrackid = "Track00001"
data_home = "tests/resources/mir_datasets/slakh"
dataset = slakh.Dataset(data_home, version="test")
Expand Down
1 change: 0 additions & 1 deletion tests/datasets/test_vocadito.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def test_track():


def test_to_jams():

data_home = "tests/resources/mir_datasets/vocadito"
default_trackid = "1"
dataset = vocadito.Dataset(data_home)
Expand Down
1 change: 1 addition & 0 deletions tests/resources/tmp_download_test/remote.wav
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a test file. It is validated using checksum. Do not change the contents of this file.
Loading

0 comments on commit 0620b8c

Please sign in to comment.