Skip to content
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

Minor bug fixes in note features and Uniformity in Loading Score objects #207

Merged
merged 13 commits into from
Jun 9, 2023

Conversation

manoskary
Copy link
Member

This PR addresses fixing uniformity in note features and Performance codec to accept ScoreLike objects and part merging for scores. It also adds the optional flag on note features to yield fixed size features.

@codecov-commenter
Copy link

codecov-commenter commented Feb 21, 2023

Codecov Report

Patch coverage: 44.09% and project coverage change: +0.21 🎉

Comparison is base (59cbe3a) 85.00% compared to head (1fbab4d) 85.22%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #207      +/-   ##
===========================================
+ Coverage    85.00%   85.22%   +0.21%     
===========================================
  Files           72       75       +3     
  Lines        12653    12942     +289     
===========================================
+ Hits         10756    11030     +274     
- Misses        1897     1912      +15     
Impacted Files Coverage Δ
partitura/io/importmatch.py 78.78% <14.28%> (-3.29%) ⬇️
partitura/musicanalysis/note_features.py 63.22% <46.57%> (-7.03%) ⬇️
partitura/musicanalysis/performance_codec.py 87.03% <100.00%> (+1.47%) ⬆️

... and 13 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@manoskary
Copy link
Member Author

Codecov Report

Base: 84.83% // Head: 84.49% // Decreases project coverage by -0.35% warning

Coverage data is based on head (7278b9c) compared to base (1014d91).
Patch coverage: 48.97% of modified lines in pull request are covered.

Additional details and impacted files

umbrella View full report at Codecov. loudspeaker Do you have feedback about the report comment? Let us know in this issue.

Should add some tests.

Copy link
Member

@sildater sildater left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice addition. In a small test with two musicxml files I noticed that the number of note features can still be different because of metrical features. Can these be added or is this exploding the number of features?

continue
# continue introduces inconsistency when save_match
# continue
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this open for a less hacky fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes definitely.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a proper fix, even after the PR is merged.

partitura/musicanalysis/performance_codec.py Outdated Show resolved Hide resolved
@manoskary
Copy link
Member Author

Very nice addition. In a small test with two musicxml files I noticed that the number of note features can still be different because of metrical features. Can these be added or is this exploding the number of features?

This was not so easy to do because it depends on the numerator and denominator of the time signature. I think this feature should be changed completely, maybe partially replaced by the metrical position features of the note array.

@manoskary
Copy link
Member Author

Also, add link fix for issue #217

# Conflicts:
#	partitura/musicanalysis/performance_codec.py
@manoskary manoskary self-assigned this Jun 1, 2023
@manoskary manoskary requested a review from sildater June 2, 2023 19:20
Comment on lines 680 to 687
# Check if the note is tied and if so, add the tie information
if is_tied:
for el in part.iter_all(end=offset_divs):
if isinstance(el, score.Note):
if el.step == note_attributes["step"] and el.octave == note_attributes["octave"]:
el.tie_next = part_note
part_note.tie_prev = el

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice solution! some minor problems:

  • the loop should break when a note is found
  • the accidentals should be checked too for pitch matching
  • the notes should only be tied if the end/start points match, maybe iter_ending is the way to go
  • somehow handle cases without found note (drop note? add? warn?)
  • the indentation level seems one too high

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, points 1,2 are super important I will fix them ASAP
end=offset_divs should already cover the third point.
Warning would be the way to go for no note found.

Copy link
Member Author

@manoskary manoskary Jun 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For your last point, currently, it only searches for ties when a note is added. The other clause already ties notes, so I am not sure that it should be there.

feature_functions: Union[List, str],
add_idx: bool = False,
include_empty_features: bool = True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function now breaks if include_empty_features is False but no features can be found. Is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a test file? So I can test while fixing it?

@sildater
Copy link
Member

sildater commented Jun 7, 2023

This PR addresses the following:

New features

  • note_features can be forced to fixed size
  • empty note_features can be returned

Bug fixes and related issues

TODO

Other changes

  • several improvements in note feature extraction

@manoskary manoskary added the bug Something isn't working label Jun 7, 2023
@sildater sildater merged commit 89dacc9 into develop Jun 9, 2023
@manoskary manoskary mentioned this pull request Jun 9, 2023
@sildater sildater deleted the pcodec_bug branch July 19, 2023 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment