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

Create time vector for different sampling frequencies #10

Open
Trybnetic opened this issue Apr 27, 2021 · 1 comment
Open

Create time vector for different sampling frequencies #10

Trybnetic opened this issue Apr 27, 2021 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@Trybnetic
Copy link
Owner

So far, the time vector can only be created for certain sampling frequencies. This is fine for the ActiGraph data, but a more generic solution would be nice.

If someone wants to fix this problem, feel free to open a pull request. For the time being, I will add a NotImplementedError to paat.io._create_time_array() and paat.io._create_time_vector(), which will refer to this issue.

@Trybnetic
Copy link
Owner Author

The functions now raise NotImplementedError when the second can not be divided by the sampling rate without a remainder. However, it is questionable whether it wouldn't be easier to just round on millisecond level precision.

One way might be to follow this line of thinking:

import numpy as np

start = 1619568000000 # np.asarray(np.datetime64('today'), dtype="datetime64[ms]").astype(int)
hz = 33
n_samples = hz * 60

# round step size
time_data = np.asarray(np.arange(start, start + n_samples * hz, 1e3 // hz), dtype='datetime64[ms]')

# round when converting to datetime64
time_data = np.asarray(np.arange(start, start + n_samples * hz, 1e3 / hz), dtype='datetime64[ms]')

However, I did not test that and just leave it here for later use as this issue does not have a high priority currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant