-
Notifications
You must be signed in to change notification settings - Fork 27
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
jams.Annotation.trim()
doesn't include events with 0 duration that's on the trim boundary
#203
Comments
Oy this is a delicate one. It ultimately comes down to the semantics around time intervals. I've long advocated for a half-open interpretation I think you've highlighted the right part of the code for fixing this, but I'm not 100% clear on what the correct logic should be here. Maybe making both sides of the comparison include the boundary conditions? |
I would lean slightly toward a In any case, I think annotations that happen exactly at |
If we take that interpretation, then the semantics of trim should be that any observation starting at or after The only wrinkle that I can see (and I think this is where @justinsalamon was coming from previously) is in the interpretation of densely sampled annotations, eg, f0 contours. These annotations typically have duration 0 for each observation already, so trimming to duration 0 doesn't necessarily introduce any new errors here. To reheat an old argument, the problem with duration-0 observations is that they're inconsistent with the half-open interval property: One way that we could reconcile this is to say that non-0 intervals are always interpreted as half-open, and that includes annotation start/duration. So when we trim an annotation, it's slicing down to a given interval |
Going back to @tomxi 's original example:
All observations have start time
Only the first two observations are in the trim interval, the last one starts at time
Again, this should only include the first two observations. |
This issue is about jams.Annotation.trim()
Reproduciable code is below:
Current Output:
Desired Output:
I took a look at the source code, and I think it's down to maybe adding some equal signs in this line:
jams/jams/core.py
Line 919 in 6bc2d2e
But I'm not sure if it will break other things.
Is this intended behavior? Right now it's impossible to slice or trim out the first beat of this annotation.
The text was updated successfully, but these errors were encountered: