Add MultiAnnotator class - #515
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #515 +/- ##
=======================================
Coverage 97.05% 97.06%
=======================================
Files 68 68
Lines 7363 7383 +20
=======================================
+ Hits 7146 7166 +20
Misses 217 217 🚀 New features to boost your workflow:
|
nkundiushuti
left a comment
There was a problem hiding this comment.
maybe add something to the contributing documentation?
| array_like (array-like): object to validate | ||
| expected_type (type): expected type, either list or np.ndarray | ||
| expected_dtype (type): expected dtype | ||
| check_child (bool): if True, checks if all elements of array are children of expected_dtype |
There was a problem hiding this comment.
what happens if there are multiple children with different expected dtypes (e.g a beat annotation with ints for the beat positions and floats for the time stamps?)
There was a problem hiding this comment.
here we're only checking if the list is composed of BeatData, ChordData, etc. The checks within the annotation type are done for each annotation type independently
| annotations (list): list of annotations (e.g. [annotations.BeatData, annotations.ChordData] | ||
| """ | ||
|
|
||
| def __init__(self, annotators, annotations) -> None: |
There was a problem hiding this comment.
I think these two inputs would be better as a single dictionary:
{ 'annotator-id': Annotation }
same with how it's stored, self.annotations = {'annotator1': ... , 'annotator2', ...}
because it will make it easier to look up a specific dictionary instead of having to look for matching indexes.
There was a problem hiding this comment.
I tried this out and noticed that some tracks have the same annotator id for different annotations in the same track (which might be a bit weird actually... but it's there :/). Also the sintax gets a bit messy, since I have to iterate in the keys each time I want to access an annotation because the annotator id changes from track to track. So I changed back to what was before for now. Let me know what you think
nkundiushuti
left a comment
There was a problem hiding this comment.
this looks great! thanks, @magdalenafuentes !
|
Will wait for @rabitt to see if she has any other comments/edits. Otherwise @nkundiushuti or @rabitt feel free to merge since I will be offline starting today! |
This PR adds the MultiAnnotator class to group annotations of same track by different annotators in a smooth and clear way.
IMPORTANT: this PR deprecates the API for the
salamiloader, but is still compatible to it.