-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.2.3 -> 0.3.0 shims #153
Merged
Merged
0.2.3 -> 0.3.0 shims #153
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1529c6f
deprecating jamsframe to_interval_values
bmcfee a7303f4
continuing deprecation march
bmcfee 44e768a
continuing deprecation march
bmcfee 5b9fa66
added observation and observation iterator
bmcfee 3b315cd
test coverage for observation iterator
bmcfee 3aba29a
documentation and version updates
bmcfee a54a040
added python 3.6 to build matrix
bmcfee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,8 +104,8 @@ def beat(ref, est, **kwargs): | |
namespace = 'beat' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_interval, _ = ref.data.to_interval_values() | ||
est_interval, _ = est.data.to_interval_values() | ||
ref_interval, _ = ref.to_interval_values() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohgeez this is so much cleaner. |
||
est_interval, _ = est.to_interval_values() | ||
|
||
return mir_eval.beat.evaluate(ref_interval[:, 0], est_interval[:, 0], **kwargs) | ||
|
||
|
@@ -145,8 +145,8 @@ def onset(ref, est, **kwargs): | |
namespace = 'onset' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_interval, _ = ref.data.to_interval_values() | ||
est_interval, _ = est.data.to_interval_values() | ||
ref_interval, _ = ref.to_interval_values() | ||
est_interval, _ = est.to_interval_values() | ||
|
||
return mir_eval.onset.evaluate(ref_interval[:, 0], est_interval[:, 0], **kwargs) | ||
|
||
|
@@ -187,8 +187,8 @@ def chord(ref, est, **kwargs): | |
namespace = 'chord' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_interval, ref_value = ref.data.to_interval_values() | ||
est_interval, est_value = est.data.to_interval_values() | ||
ref_interval, ref_value = ref.to_interval_values() | ||
est_interval, est_value = est.to_interval_values() | ||
|
||
return mir_eval.chord.evaluate(ref_interval, ref_value, | ||
est_interval, est_value, **kwargs) | ||
|
@@ -229,8 +229,8 @@ def segment(ref, est, **kwargs): | |
namespace = 'segment_open' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_interval, ref_value = ref.data.to_interval_values() | ||
est_interval, est_value = est.data.to_interval_values() | ||
ref_interval, ref_value = ref.to_interval_values() | ||
est_interval, est_value = est.to_interval_values() | ||
|
||
return mir_eval.segment.evaluate(ref_interval, ref_value, | ||
est_interval, est_value, **kwargs) | ||
|
@@ -253,7 +253,7 @@ def hierarchy_flatten(annotation): | |
A list of lists of labels, ordered by increasing specificity. | ||
''' | ||
|
||
intervals, values = annotation.data.to_interval_values() | ||
intervals, values = annotation.to_interval_values() | ||
|
||
ordering = dict() | ||
|
||
|
@@ -394,8 +394,8 @@ def melody(ref, est, **kwargs): | |
namespace = 'pitch_contour' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_interval, ref_p = ref.data.to_interval_values() | ||
est_interval, est_p = est.data.to_interval_values() | ||
ref_interval, ref_p = ref.to_interval_values() | ||
est_interval, est_p = est.to_interval_values() | ||
|
||
ref_freq = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in ref_p]) | ||
est_freq = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in est_p]) | ||
|
@@ -432,7 +432,7 @@ def pattern_to_mireval(ann): | |
patterns = defaultdict(lambda: defaultdict(list)) | ||
|
||
# Iterate over the data in interval-value format | ||
for interval, observation in zip(*ann.data.to_interval_values()): | ||
for interval, observation in zip(*ann.to_interval_values()): | ||
|
||
pattern_id = observation['pattern_id'] | ||
occurrence_id = observation['occurrence_id'] | ||
|
@@ -525,8 +525,8 @@ def transcription(ref, est, **kwargs): | |
namespace = 'pitch_contour' | ||
ref = coerce_annotation(ref, namespace) | ||
est = coerce_annotation(est, namespace) | ||
ref_intervals, ref_p = ref.data.to_interval_values() | ||
est_intervals, est_p = est.data.to_interval_values() | ||
ref_intervals, ref_p = ref.to_interval_values() | ||
est_intervals, est_p = est.to_interval_values() | ||
|
||
ref_pitches = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in ref_p]) | ||
est_pitches = np.asarray([p['frequency'] * (-1)**(~p['voiced']) for p in est_p]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
smkdirs | ||
filebase | ||
find_with_extension | ||
_deprecated | ||
""" | ||
|
||
import os | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,10 +211,16 @@ def test_jamsframe_interval_values(): | |
|
||
jf = jams.JamsFrame.from_dataframe(df) | ||
|
||
intervals, values = jf.to_interval_values() | ||
warnings.resetwarnings() | ||
warnings.simplefilter('always') | ||
with warnings.catch_warnings(record=True) as out: | ||
intervals, values = jf.to_interval_values() | ||
assert len(out) > 0 | ||
assert out[0].category is DeprecationWarning | ||
assert 'deprecated' in str(out[0].message).lower() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
|
||
assert np.allclose(intervals, np.array([[0.0, 1.0], [1.0, 3.0]])) | ||
eq_(values, ['a', 'b']) | ||
assert np.allclose(intervals, np.array([[0.0, 1.0], [1.0, 3.0]])) | ||
eq_(values, ['a', 'b']) | ||
|
||
|
||
def test_jamsframe_serialize(): | ||
|
@@ -369,6 +375,21 @@ def test_annotation_eq(): | |
|
||
assert not (ann1 == ann2) | ||
|
||
|
||
def test_annotation_interval_values(): | ||
|
||
data = dict(time=[0.0, 1.0], | ||
duration=[1., 2.0], | ||
value=['a', 'b'], | ||
confidence=[0.9, 0.9]) | ||
|
||
ann = jams.Annotation(namespace='tag_open', data=data) | ||
|
||
intervals, values = ann.to_interval_values() | ||
|
||
assert np.allclose(intervals, np.array([[0.0, 1.0], [1.0, 3.0]])) | ||
eq_(values, ['a', 'b']) | ||
|
||
# FileMetadata | ||
|
||
def test_filemetadata(): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
np.vstack
overnp.array
..?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to concatenate them along the second axis; historical style holdover from the days before arbitary concat support.
but this is getting wiped in #149 also.