ojwalch / sleep_classifiers

Classify sleep from heart rate and acceleration via Apple Watch
183 stars 84 forks source link

Should the motion data be rearranged? #2

Closed wenh06 closed 4 years ago

wenh06 commented 4 years ago

The first ''column'', which recorded the measured time, of these data has negative diff values. Should they be sorted by this ''column'' when using?

ojwalch commented 4 years ago

Yes. Right now, that should happen in the remove_repeats function in utils.py. If you’re using the data for your own purposes, you want to sort by timestamp.

On Jan 2, 2020, at 8:31 PM, WEN Hao notifications@github.com wrote:

The first column'', which recorded the measured time, of these data has negative diff values. Should they be sorted by this column'' when using?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ojwalch/sleep_classifiers/issues/2?email_source=notifications&email_token=AB6WIZNUJGEEUSUNYMS53D3Q32IQLA5CNFSM4KCIQV7KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IDZH62A, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WIZN2NT72NMEL3JK74A3Q32IQLANCNFSM4KCIQV7A.

wenh06 commented 4 years ago

The dominant diff in measured time is 20ms, so I guess the sampling frequency of the triaxial accelerometer of these apple watches are 50Hz. Most other values in diff in measured time should have been affected by other tasks when using the watches, I believe. As for large gaps of time, either negative or positive, I guess the user synchronized time of its watch with some internet server? Or other possibilities?

ojwalch commented 4 years ago

The 50 Hz was set by me-- you can sample motion from the Apple Watch accelerometer at different rates (see the ojwalch/sleep_accel repo). Any gaps much larger than that were caused by issues on the server end with writing the data to file (acceleration was sent to the server in real time as it was collected), so you'll want to exclude those epochs from consideration.

On Thu, Jan 2, 2020 at 9:28 PM WEN Hao notifications@github.com wrote:

The dominant diff in measured time is 20ms, so I guess the sampling frequency of the triaxial accelerometer of these apple watches are 50Hz. Most other values in diff in measured time should have been affected by other tasks when using the watches, I believe. As for large gaps of time, either negative or positive, I guess the user synchronized time of its watch with some internet server? Or other possibilities?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ojwalch/sleep_classifiers/issues/2?email_source=notifications&email_token=AB6WIZPFUA4YU5FT7MIIAADQ32PE7A5CNFSM4KCIQV7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIADHEA#issuecomment-570438544, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6WIZI3FJPLFQGR3EEOKJ3Q32PE7ANCNFSM4KCIQV7A .

wenh06 commented 4 years ago

I suggest you leave two columns for time, one measure_time which means the time the value was measured, one create_time which means the time the value was written into the database. You can gather data into one row, every n second(s). I hope that you can fetch the measure_time directly from the apple watch, which should be created by the device itself. I hope this would help. By the way, I named your dataset as sleep_accel without knowing the existence of your sleep_accel repository. You could consider making it the official short name of your dataset?

ojwalch commented 4 years ago

The time stamp is already measure_time: it’s the UNIX time corresponding to the acceleration sample, taken from the Apple Watch.

On Jan 3, 2020, at 1:03 AM, WEN Hao notifications@github.com wrote:

 I suggest you leave two columns for time, one measure_time which means the time the value was measured, one create_time which means the time the value was written into the database. I hope that you can fetch the measure_time directly from the apple watch, which should be created by the device itself.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.