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

shorten! sets wrong maxlag #69

Closed
tclements opened this issue Feb 3, 2021 · 0 comments
Closed

shorten! sets wrong maxlag #69

tclements opened this issue Feb 3, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tclements
Copy link
Collaborator

When using shorten! to subset a CorrData, if the newlag value is not a multiple of the sampling rate, the new maxlag should be set to the nearest common multiple of the sampling rate that is less than newlag e.g. C.maxlag = newlag - (newlag % (1/C.fs)).

MWE:

julia> C = load_corr(corrfile,comp);

julia> C.fs
40.0

julia> C.maxlag
20.0

julia> newlag = 16.01
16.01

julia> newlag % (1/C.fs) # newlag is off sampling period by 0.01 seconds
0.010000000000000675

julia> shorten!(C,newlag)

julia> C.maxlag
16.01

julia> C.maxlag == newlag 
true

In this example, the true value for C.maxlag should be 16.0.

@tclements tclements added the bug Something isn't working label Feb 3, 2021
@tclements tclements self-assigned this Feb 3, 2021
@tclements tclements mentioned this issue Jul 21, 2021
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant