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

Document semantics of TimeSpans.index_from_time(sample_rate, span::TimeSpan) #27

Open
ericphanson opened this issue Jan 25, 2022 · 0 comments

Comments

@ericphanson
Copy link
Member

The current implementation of index_from_time(sample_rate, span::TimeSpan) makes an undocumented choice of semantics, which is to round-down the endpoints, and ensure the right endpoint of the span is excluded.

What do I mean this is undocumented? Well,

integer index of the most recent sample taken at sample_time

documents the index_from_time(sample_rate, time) method. That isn't sufficient to learn the semantics of the span method, since we do something other than simply call index_from_time on each endpoint, re

j = i == j ? j : (j - 1)

and we only document the span method as

Return the `UnitRange` of indices corresponding to `span` given `sample_rate` in Hz:

which leaves it unclear exactly what UnitRange we're talking about.

Originally posted by @ericphanson in #26 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant