From 1162ac74eab2e39d2a1cead4bc3d943f16f98f28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Mon, 12 Aug 2024 14:08:17 +0530 Subject: [PATCH 1/6] Change BrokenBarHCollection to PolyCollection --- mir_eval/display.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mir_eval/display.py b/mir_eval/display.py index f5d5e1ef..a01e8848 100644 --- a/mir_eval/display.py +++ b/mir_eval/display.py @@ -12,7 +12,7 @@ from matplotlib.ticker import FuncFormatter, MultipleLocator from matplotlib.ticker import Formatter from matplotlib.colors import LinearSegmentedColormap, LogNorm, ColorConverter -from matplotlib.collections import BrokenBarHCollection +from matplotlib.collections import PolyCollection as BrokenBarHCollection from matplotlib.transforms import Bbox, TransformedBbox from .melody import freq_to_voicing @@ -264,7 +264,7 @@ def labeled_intervals( **kwargs Additional keyword arguments to pass to - `matplotlib.collection.BrokenBarHCollection`. + `matplotlib.collection.PolyCollection`. Returns ------- From a18baed26aa8a7d5d8047d8a8edc885e193dcbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Mon, 12 Aug 2024 21:56:35 +0530 Subject: [PATCH 2/6] Remove unused import --- mir_eval/display.py | 1 - 1 file changed, 1 deletion(-) diff --git a/mir_eval/display.py b/mir_eval/display.py index a01e8848..3a28f078 100644 --- a/mir_eval/display.py +++ b/mir_eval/display.py @@ -12,7 +12,6 @@ from matplotlib.ticker import FuncFormatter, MultipleLocator from matplotlib.ticker import Formatter from matplotlib.colors import LinearSegmentedColormap, LogNorm, ColorConverter -from matplotlib.collections import PolyCollection as BrokenBarHCollection from matplotlib.transforms import Bbox, TransformedBbox from .melody import freq_to_voicing From ae44fd75728a384c9f312b77d8fdf03d945e1d64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Mon, 12 Aug 2024 22:00:20 +0530 Subject: [PATCH 3/6] np.Inf -> np.inf --- mir_eval/separation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mir_eval/separation.py b/mir_eval/separation.py index 0bb0704e..96570eaf 100644 --- a/mir_eval/separation.py +++ b/mir_eval/separation.py @@ -837,7 +837,7 @@ def _safe_db(num, den): be 0. """ if den == 0: - return np.Inf + return np.inf return 10 * np.log10(num / den) From c99a66fe4c019c90351878963d5d372b4f433872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Thu, 15 Aug 2024 16:20:22 +0530 Subject: [PATCH 4/6] Use `ann.set_clip_path` --- mir_eval/display.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mir_eval/display.py b/mir_eval/display.py index 3a28f078..0dee99c4 100644 --- a/mir_eval/display.py +++ b/mir_eval/display.py @@ -183,18 +183,15 @@ def segments( seg_map[lab].pop("label", None) if text: - bbox = Bbox.from_extents(ival[0], base, ival[1], height) - tbbox = TransformedBbox(bbox, transform) ann = ax.annotate( lab, xy=(ival[0], height), xycoords=transform, xytext=(8, -10), textcoords="offset points", - clip_path=rect, - clip_box=tbbox, **text_kw ) + ann.set_clip_path(rect) return ax From b398fa67986bafd3b72232b9a80d91f75c44367d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Thu, 15 Aug 2024 16:27:03 +0530 Subject: [PATCH 5/6] Set expected legend location --- tests/test_display.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_display.py b/tests/test_display.py index d2c254b0..c87cdcd4 100644 --- a/tests/test_display.py +++ b/tests/test_display.py @@ -151,7 +151,7 @@ def test_display_labeled_intervals_compare_noextend(): est_int, est_labels, extend_labels=False, alpha=0.5, label="Estimate" ) - plt.legend() + plt.legend(loc='upper right') return plt.gcf() @@ -178,7 +178,7 @@ def test_display_labeled_intervals_compare_common(): est_int, est_labels, label_set=label_set, alpha=0.5, label="Estimate" ) - plt.legend() + plt.legend(loc='upper right') return plt.gcf() @@ -344,7 +344,7 @@ def test_display_piano_roll(): est_t, est_p, label="Estimate", alpha=0.5, facecolor="r" ) - plt.legend() + plt.legend(loc='upper right') return plt.gcf() @@ -367,7 +367,7 @@ def test_display_piano_roll_midi(): est_t, midi=est_midi, label="Estimate", alpha=0.5, facecolor="r" ) - plt.legend() + plt.legend(loc='upper right') return plt.gcf() From 45a55b46df32d7f02b5db4ff28d42cfdbc9cd340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20Thom=C3=A9?= Date: Thu, 15 Aug 2024 16:43:17 +0530 Subject: [PATCH 6/6] Run black --- tests/test_display.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_display.py b/tests/test_display.py index c87cdcd4..943a6674 100644 --- a/tests/test_display.py +++ b/tests/test_display.py @@ -151,7 +151,7 @@ def test_display_labeled_intervals_compare_noextend(): est_int, est_labels, extend_labels=False, alpha=0.5, label="Estimate" ) - plt.legend(loc='upper right') + plt.legend(loc="upper right") return plt.gcf() @@ -178,7 +178,7 @@ def test_display_labeled_intervals_compare_common(): est_int, est_labels, label_set=label_set, alpha=0.5, label="Estimate" ) - plt.legend(loc='upper right') + plt.legend(loc="upper right") return plt.gcf() @@ -344,7 +344,7 @@ def test_display_piano_roll(): est_t, est_p, label="Estimate", alpha=0.5, facecolor="r" ) - plt.legend(loc='upper right') + plt.legend(loc="upper right") return plt.gcf() @@ -367,7 +367,7 @@ def test_display_piano_roll_midi(): est_t, midi=est_midi, label="Estimate", alpha=0.5, facecolor="r" ) - plt.legend(loc='upper right') + plt.legend(loc="upper right") return plt.gcf()