actigraph / agcounts

Code for the technical report on the ActiLife counts algorithm.
GNU General Public License v3.0
32 stars 13 forks source link

Time of generated counts not correspond to that of raw data #17

Closed Fan-loewe closed 1 year ago

Fan-loewe commented 1 year ago

Dear developer,

thank you for your great commitment on this python package!

I am collecting data using Actigraph wGT3X-BT for several days, and use this package to calculate activity counts. While my raw data starts from 2023-04-13 16:15:38 and ends at 2023-04-17 16:56:06. The calculated activity data starts from 2023-04-13 16:16:00 and ends at 2023-04-17 13:11:00.

I suppose the reason is in the raw data, some timepoint is missing (I don't know the reason for that, I would be grateful if you can indicate in which circumstance Actigraph stops collecting data).

If I understand correctly, this package is processing timestamp outside the pipeline using: if time_column is not None: ts = raw[time_column] ts = pd.to_datetime(ts) time_freq = str(epoch) + "S" ts = ts.dt.round(time_freq) ts = ts.unique() ts = pd.DataFrame(ts, columns=[time_column])

ts = ts[0 : counts.shape[0]]

I am wondering if it is better to deal with the timestamp inside _extract method? I doubt using round and delete the rest of data to fit to the correct sample size is the most accurate way to deal with time.

Thank you for your time and best regards, Fan

rouzbeh commented 1 year ago

Hi Fan!

I am not sure what can be done here. This packages doesn't deal with timestamps. Indeed if you have gaps in your data, you probably need to do something more involved when calculating timestamps. Or better yet, fill the gaps (possibly with 0) before passing the data to agcounts. But in any case, because it is far from trivial, managing gaps is not in the scope of this package.

Reasons for gaps can be diverse. Is Idle Sleep mode activated on your device? What file format is being used? How are you reading the data?

Fan-loewe commented 1 year ago

Hi Ali, thank you very much for your answer! I just realised I forget to respond. Yes, I filled the gaps and obtained the activity counts. The existence of gaps should be because I was using "Idle Sleep mode", now I get it. Thank you!