{"action":"created","comment":{"url":"https://api.github.com/repos/craffel/mir_eval/pulls/comments/66707434","id":66707434,"diff_hunk":"@@ -0,0 +1,672 @@\n+# -*- encoding: utf-8 -*-\n+'''Display functions'''\n+\n+import numpy as np\n+from scipy.signal import spectrogram\n+\n+import matplotlib.pyplot as plt\n+from matplotlib.patches import Rectangle, Patch\n+from matplotlib.ticker import FuncFormatter, MultipleLocator\n+from matplotlib.colors import LinearSegmentedColormap, LogNorm\n+\n+from .melody import freq_to_voicing\n+from .util import midi_to_hz, hz_to_midi\n+\n+\n+def __expand_limits(ax, limits, which='x'):\n+    '''Helper function to expand axis limits'''\n+\n+    if which == 'x':\n+        getter, setter = ax.get_xlim, ax.set_xlim\n+    elif which == 'y':\n+        getter, setter = ax.get_ylim, ax.set_ylim\n+    else:\n+        raise ValueError('invalid axis: {}'.format(which))\n+\n+    old_lims = getter()\n+    new_lims = list(limits)\n+\n+    if np.isfinite(old_lims[0]):\n+        new_lims[0] = min(old_lims[0], limits[0])\n+\n+    if np.isfinite(old_lims[1]):\n+        new_lims[1] = max(old_lims[1], limits[1])\n+\n+    setter(new_lims)\n+\n+\n+def segments(intervals, labels, base=None, height=None, text=False,\n+             text_kw=None, ax=None, **kwargs):\n+    '''Plot a segmentation as a set of disjoint rectangles.\n+\n+    Parameters\n+    ----------\n+    intervals : np.ndarray, shape=(n, 2)\n+        segment intervals, in the format returned by\n+        :func:`mir_eval.io.load_intervals` or\n+        :func:`mir_eval.io.load_labeled_intervals`.\n+\n+    labels : list, shape=(n,)\n+        reference segment labels, in the format returned by\n+        :func:`mir_eval.io.load_labeled_intervals`.\n+\n+    base : number\n+        The vertical position of the base of the rectangles.\n+        By default, this will be the bottom of the plot.\n+\n+    height : number\n+        The height of the base of the rectangles.","path":"mir_eval/display.py","position":58,"original_position":58,"commit_id":"5da485a654fba730f0604c2b1a58050c2560260a","original_commit_id":"5da485a654fba730f0604c2b1a58050c2560260a","user":{"login":"bmcfee","id":1190540,"avatar_url":"https://avatars.githubusercontent.com/u/1190540?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcfee","html_url":"https://github.com/bmcfee","followers_url":"https://api.github.com/users/bmcfee/followers","following_url":"https://api.github.com/users/bmcfee/following{/other_user}","gists_url":"https://api.github.com/users/bmcfee/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcfee/subscriptions","organizations_url":"https://api.github.com/users/bmcfee/orgs","repos_url":"https://api.github.com/users/bmcfee/repos","events_url":"https://api.github.com/users/bmcfee/events{/privacy}","received_events_url":"https://api.github.com/users/bmcfee/received_events","type":"User","site_admin":false},"body":"Good catch, yes.","created_at":"2016-06-11T15:41:32Z","updated_at":"2016-06-11T15:41:32Z","html_url":"https://github.com/craffel/mir_eval/pull/196#discussion_r66707434","pull_request_url":"https://api.github.com/repos/craffel/mir_eval/pulls/196","_links":{"self":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/comments/66707434"},"html":{"href":"https://github.com/craffel/mir_eval/pull/196#discussion_r66707434"},"pull_request":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/196"}}},"pull_request":{"url":"https://api.github.com/repos/craffel/mir_eval/pulls/196","id":71813141,"html_url":"https://github.com/craffel/mir_eval/pull/196","diff_url":"https://github.com/craffel/mir_eval/pull/196.diff","patch_url":"https://github.com/craffel/mir_eval/pull/196.patch","issue_url":"https://api.github.com/repos/craffel/mir_eval/issues/196","number":196,"state":"open","locked":false,"title":"display submodule","user":{"login":"bmcfee","id":1190540,"avatar_url":"https://avatars.githubusercontent.com/u/1190540?v=3","gravatar_id":"","url":"https://api.github.com/users/bmcfee","html_url":"https://github.com/bmcfee","followers_url":"https://api.github.com/users/bmcfee/followers","following_url":"https://api.github.com/users/bmcfee/following{/other_user}","gists_url":"https://api.github.com/users/bmcfee/gists{/gist_id}","starred_url":"https://api.github.com/users/bmcfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmcfee/subscriptions","organizations_url":"https://api.github.com/users/bmcfee/orgs","repos_url":"https://api.github.com/users/bmcfee/repos","events_url":"https://api.github.com/users/bmcfee/events{/privacy}","received_events_url":"https://api.github.com/users/bmcfee/received_events","type":"User","site_admin":false},"body":"This implements #28 \r\n\r\nTODO:\r\n\r\n- [x] segments\r\n- [x] intervals\r\n- [x] segment hierarchy\r\n- [x] notes\r\n- [x] contours\r\n- [x] source separation\r\n- [x] tests","created_at":"2016-05-28T22:30:21Z","updated_at":"2016-06-11T15:41:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4b5805475ae6453ea095ea86e385b1173afaf391","assignee":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/craffel/mir_eval/milestones/7","html_url":"https://github.com/craffel/mir_eval/milestones/0.4","labels_url":"https://api.github.com/repos/craffel/mir_eval/milestones/7/labels","id":1802634,"number":7,"title":"0.4","description":"","creator":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":0,"state":"open","created_at":"2016-06-01T15:26:21Z","updated_at":"2016-06-10T15:37:20Z","due_on":"2016-08-05T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/craffel/mir_eval/pulls/196/commits","review_comments_url":"https://api.github.com/repos/craffel/mir_eval/pulls/196/comments","review_comment_url":"https://api.github.com/repos/craffel/mir_eval/pulls/comments{/number}","comments_url":"https://api.github.com/repos/craffel/mir_eval/issues/196/comments","statuses_url":"https://api.github.com/repos/craffel/mir_eval/statuses/5da485a654fba730f0604c2b1a58050c2560260a","head":{"label":"craffel:display","ref":"display","sha":"5da485a654fba730f0604c2b1a58050c2560260a","user":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"repo":{"id":11929631,"name":"mir_eval","full_name":"craffel/mir_eval","owner":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/craffel/mir_eval","description":"Evaluation functions for music/audio information retrieval/signal processing algorithms.","fork":false,"url":"https://api.github.com/repos/craffel/mir_eval","forks_url":"https://api.github.com/repos/craffel/mir_eval/forks","keys_url":"https://api.github.com/repos/craffel/mir_eval/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craffel/mir_eval/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craffel/mir_eval/teams","hooks_url":"https://api.github.com/repos/craffel/mir_eval/hooks","issue_events_url":"https://api.github.com/repos/craffel/mir_eval/issues/events{/number}","events_url":"https://api.github.com/repos/craffel/mir_eval/events","assignees_url":"https://api.github.com/repos/craffel/mir_eval/assignees{/user}","branches_url":"https://api.github.com/repos/craffel/mir_eval/branches{/branch}","tags_url":"https://api.github.com/repos/craffel/mir_eval/tags","blobs_url":"https://api.github.com/repos/craffel/mir_eval/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craffel/mir_eval/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craffel/mir_eval/git/refs{/sha}","trees_url":"https://api.github.com/repos/craffel/mir_eval/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craffel/mir_eval/statuses/{sha}","languages_url":"https://api.github.com/repos/craffel/mir_eval/languages","stargazers_url":"https://api.github.com/repos/craffel/mir_eval/stargazers","contributors_url":"https://api.github.com/repos/craffel/mir_eval/contributors","subscribers_url":"https://api.github.com/repos/craffel/mir_eval/subscribers","subscription_url":"https://api.github.com/repos/craffel/mir_eval/subscription","commits_url":"https://api.github.com/repos/craffel/mir_eval/commits{/sha}","git_commits_url":"https://api.github.com/repos/craffel/mir_eval/git/commits{/sha}","comments_url":"https://api.github.com/repos/craffel/mir_eval/comments{/number}","issue_comment_url":"https://api.github.com/repos/craffel/mir_eval/issues/comments{/number}","contents_url":"https://api.github.com/repos/craffel/mir_eval/contents/{+path}","compare_url":"https://api.github.com/repos/craffel/mir_eval/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craffel/mir_eval/merges","archive_url":"https://api.github.com/repos/craffel/mir_eval/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craffel/mir_eval/downloads","issues_url":"https://api.github.com/repos/craffel/mir_eval/issues{/number}","pulls_url":"https://api.github.com/repos/craffel/mir_eval/pulls{/number}","milestones_url":"https://api.github.com/repos/craffel/mir_eval/milestones{/number}","notifications_url":"https://api.github.com/repos/craffel/mir_eval/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craffel/mir_eval/labels{/name}","releases_url":"https://api.github.com/repos/craffel/mir_eval/releases{/id}","deployments_url":"https://api.github.com/repos/craffel/mir_eval/deployments","created_at":"2013-08-06T17:04:10Z","updated_at":"2016-06-04T17:22:08Z","pushed_at":"2016-06-10T17:13:11Z","git_url":"git://github.com/craffel/mir_eval.git","ssh_url":"git@github.com:craffel/mir_eval.git","clone_url":"https://github.com/craffel/mir_eval.git","svn_url":"https://github.com/craffel/mir_eval","homepage":null,"size":13440,"stargazers_count":61,"watchers_count":61,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":22,"mirror_url":null,"open_issues_count":18,"forks":22,"open_issues":18,"watchers":61,"default_branch":"master"}},"base":{"label":"craffel:master","ref":"master","sha":"bc537aeb2de73544b97723bfcb0f94a23262232b","user":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"repo":{"id":11929631,"name":"mir_eval","full_name":"craffel/mir_eval","owner":{"login":"craffel","id":417568,"avatar_url":"https://avatars.githubusercontent.com/u/417568?v=3","gravatar_id":"","url":"https://api.github.com/users/craffel","html_url":"https://github.com/craffel","followers_url":"https://api.github.com/users/craffel/followers","following_url":"https://api.github.com/users/craffel/following{/other_user}","gists_url":"https://api.github.com/users/craffel/gists{/gist_id}","starred_url":"https://api.github.com/users/craffel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craffel/subscriptions","organizations_url":"https://api.github.com/users/craffel/orgs","repos_url":"https://api.github.com/users/craffel/repos","events_url":"https://api.github.com/users/craffel/events{/privacy}","received_events_url":"https://api.github.com/users/craffel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/craffel/mir_eval","description":"Evaluation functions for music/audio information retrieval/signal processing algorithms.","fork":false,"url":"https://api.github.com/repos/craffel/mir_eval","forks_url":"https://api.github.com/repos/craffel/mir_eval/forks","keys_url":"https://api.github.com/repos/craffel/mir_eval/keys{/key_id}","collaborators_url":"https://api.github.com/repos/craffel/mir_eval/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/craffel/mir_eval/teams","hooks_url":"https://api.github.com/repos/craffel/mir_eval/hooks","issue_events_url":"https://api.github.com/repos/craffel/mir_eval/issues/events{/number}","events_url":"https://api.github.com/repos/craffel/mir_eval/events","assignees_url":"https://api.github.com/repos/craffel/mir_eval/assignees{/user}","branches_url":"https://api.github.com/repos/craffel/mir_eval/branches{/branch}","tags_url":"https://api.github.com/repos/craffel/mir_eval/tags","blobs_url":"https://api.github.com/repos/craffel/mir_eval/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/craffel/mir_eval/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/craffel/mir_eval/git/refs{/sha}","trees_url":"https://api.github.com/repos/craffel/mir_eval/git/trees{/sha}","statuses_url":"https://api.github.com/repos/craffel/mir_eval/statuses/{sha}","languages_url":"https://api.github.com/repos/craffel/mir_eval/languages","stargazers_url":"https://api.github.com/repos/craffel/mir_eval/stargazers","contributors_url":"https://api.github.com/repos/craffel/mir_eval/contributors","subscribers_url":"https://api.github.com/repos/craffel/mir_eval/subscribers","subscription_url":"https://api.github.com/repos/craffel/mir_eval/subscription","commits_url":"https://api.github.com/repos/craffel/mir_eval/commits{/sha}","git_commits_url":"https://api.github.com/repos/craffel/mir_eval/git/commits{/sha}","comments_url":"https://api.github.com/repos/craffel/mir_eval/comments{/number}","issue_comment_url":"https://api.github.com/repos/craffel/mir_eval/issues/comments{/number}","contents_url":"https://api.github.com/repos/craffel/mir_eval/contents/{+path}","compare_url":"https://api.github.com/repos/craffel/mir_eval/compare/{base}...{head}","merges_url":"https://api.github.com/repos/craffel/mir_eval/merges","archive_url":"https://api.github.com/repos/craffel/mir_eval/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/craffel/mir_eval/downloads","issues_url":"https://api.github.com/repos/craffel/mir_eval/issues{/number}","pulls_url":"https://api.github.com/repos/craffel/mir_eval/pulls{/number}","milestones_url":"https://api.github.com/repos/craffel/mir_eval/milestones{/number}","notifications_url":"https://api.github.com/repos/craffel/mir_eval/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/craffel/mir_eval/labels{/name}","releases_url":"https://api.github.com/repos/craffel/mir_eval/releases{/id}","deployments_url":"https://api.github.com/repos/craffel/mir_eval/deployments","created_at":"2013-08-06T17:04:10Z","updated_at":"2016-06-04T17:22:08Z","pushed_at":"2016-06-10T17:13:11Z","git_url":"git://github.com/craffel/mir_eval.git","ssh_url":"git@github.com:craffel/mir_eval.git","clone_url":"https://github.com/craffel/mir_eval.git","svn_url":"https://github.com/craffel/mir_eval","homepage":null,"size":13440,"stargazers_count":61,"watchers_count":61,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":22,"mirror_url":null,"open_issues_count":18,"forks":22,"open_issues":18,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/196"},"html":{"href":"https://github.com/craffel/mir_eval/pull/196"},"issue":{"href":"https://api.github.com/repos/craffel/mir_eval/issues/196"},"comments":{"href":"https://api.github.com/repos/craffel/mir_eval/issues/196/comments"},"review_comments":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/196/comments"},"review_comment":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/craffel/mir_eval/pulls/196/commits"},"statuses":{"href":"https://api.github.com/repos/craffel/mir_eval/statuses/5da485a654fba730f0604c2b1a58050c2560260a"}}}}
{"actor":{"display_login":"bmcfee"}}