-
Notifications
You must be signed in to change notification settings - Fork 64
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
CWA reading - skipping time #81
Comments
Hi @muschellij2 - thanks for raising this. To help us investigate the potential accProcess time skipping issue - can you show what the output is for "csv[22655995:22656020,]" before converting the raw input to an R object ? Many thanks, |
What do you mean? You want to just read the lines in? |
I would like to see the lines 22655995:22656020 from your 'csv' dataframe printed out before converting to an R datetime object. Thanks, Aiden |
Created on 2020-10-21 by the reprex package (v0.3.0.9001) |
The last CSV is from |
GGIR
biobankAccelerometerAnalysis
cwa-convertfrom https://github.com/digitalinteraction/openmovement/tree/master/Software/AX3/cwa-convert
Comparison
Created on 2020-10-21 by the reprex package (v0.3.0.9001) Session info
|
Hi @muschellij2 - thanks for sharing this. Given the different lengths of the raw data files read by each package - it is possible that there exists a faulty time block header within this particular CWA file - that the different packages deal with differently. Would it be possible to share a copy of this individual file with us so that we can look at it in greater depth? It would be best to email a secure link to either myself ([email protected]) or @chanshing ([email protected]) |
... this was surprising because I and others have processed that demofile with GGIR without problems in the past. So, file corruption was also what I thought. |
I believe it still persists - just tried on the dev version of GGIR.
GGIRLook at row 16 on:
biobankAccelerometerAnalysisWe see a day jump almost from rows 5 to 6.
cwa-convertfrom https://github.com/digitalinteraction/openmovement/tree/master/Software/AX3/cwa-convert
Comparison
Created on 2020-10-22 by the reprex package (v0.3.0.9001) Session info
|
Hi @muschellij2 Sorry for the late reply. So I looked into the file you mentioned. The skips mean that there were interrupts during the wear. This can happen if the person plugged the device into a computer, or worst case scenario the device malfunctioned. In this case, it does seem that the device probably malfunctioned. Here's a plot of predicted activities. Yellow means missing (interrupts or non-wear): Do yo have outputs for the openmovement software? I'd be interested to see what happens after |
This should mirror what cwa-convert does from open-movement I believe. I wrapped th C code into an R package. We see the same breaks in time. There are I think there is still an issue in library(read.cwa)
x = read.cwa::read_cwa("example_90001_0_0.cwa.gz")
#> Converting the CWA to CSV
#> Reading 243712 sectors (offset 0, file 243712)...
#> [MD].
#> Wrote 1507159295 bytes of data (29245200 samples).
#> Reading in the CSV: /var/folders/1s/wrtqcpxn685_zk570bnx9_rr0000gr/T//RtmpBoGhAU/file73e134f6a875.csv
as.data.frame(x$data[22241005:(22241005+100),])
#> time X Y Z
#> 1 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 2 2015-06-22 00:56:02 -0.500000 0.359375 0.593750
#> 3 2015-06-22 00:56:02 -0.500000 0.359375 0.593750
#> 4 2015-06-22 00:56:02 -0.484375 0.359375 0.609375
#> 5 2015-06-22 00:56:02 -0.484375 0.359375 0.593750
#> 6 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 7 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 8 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 9 2015-06-22 00:56:02 -0.500000 0.359375 0.593750
#> 10 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 11 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 12 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 13 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 14 2015-06-22 00:56:02 -0.484375 0.359375 0.609375
#> 15 2015-06-22 00:56:02 -0.484375 0.359375 0.609375
#> 16 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 17 2015-06-22 00:56:02 -0.500000 0.359375 0.609375
#> 18 2015-06-22 00:56:03 -0.500000 0.359375 0.593750
#> 19 2015-06-22 00:56:03 -0.500000 0.359375 0.593750
#> 20 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 21 2015-06-22 00:56:03 -0.500000 0.359375 0.593750
#> 22 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 23 2015-06-22 00:56:03 -0.484375 0.359375 0.593750
#> 24 2015-06-22 00:56:03 -0.484375 0.359375 0.609375
#> 25 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 26 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 27 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 28 2015-06-22 00:56:03 -0.500000 0.359375 0.593750
#> 29 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 30 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 31 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 32 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 33 2015-06-22 00:56:03 -0.500000 0.359375 0.609375
#> 34 2015-06-22 00:56:03 -0.484375 0.359375 0.593750
#> 35 2015-06-22 00:56:03 -0.500000 0.359375 0.593750
#> 36 2015-06-22 00:56:03 -0.484375 0.359375 0.609375
#> 37 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 38 2015-06-23 12:46:32 -0.875000 -0.312500 -0.468750
#> 39 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 40 2015-06-23 12:46:32 -0.921875 -0.312500 -0.484375
#> 41 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 42 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 43 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 44 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 45 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 46 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 47 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 48 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 49 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 50 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 51 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 52 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 53 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 54 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 55 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 56 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 57 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 58 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 59 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 60 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 61 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 62 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 63 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 64 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 65 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 66 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 67 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 68 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 69 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 70 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 71 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 72 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 73 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 74 2015-06-23 12:46:32 -0.921875 -0.328125 -0.484375
#> 75 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 76 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 77 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 78 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 79 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 80 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 81 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 82 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 83 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 84 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 85 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 86 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 87 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 88 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 89 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 90 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 91 2015-06-23 12:46:32 -0.921875 -0.328125 -0.500000
#> 92 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 93 2015-06-23 12:46:33 -0.921875 -0.328125 -0.484375
#> 94 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 95 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 96 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 97 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 98 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 99 2015-06-23 12:46:33 -0.921875 -0.328125 -0.484375
#> 100 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000
#> 101 2015-06-23 12:46:33 -0.921875 -0.328125 -0.500000 Created on 2020-12-18 by the reprex package (v0.3.0.9001) Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.0.2 (2020-06-22)
#> os macOS Catalina 10.15.7
#> system x86_64, darwin17.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/New_York
#> date 2020-12-18
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 4.0.0)
#> backports 1.2.0 2020-11-02 [1] CRAN (R 4.0.2)
#> cli 2.2.0 2020-11-20 [1] CRAN (R 4.0.2)
#> crayon 1.3.4 2017-09-16 [2] CRAN (R 4.0.0)
#> data.table 1.13.2 2020-10-19 [1] CRAN (R 4.0.2)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.2)
#> ellipsis 0.3.1 2020-05-15 [2] CRAN (R 4.0.0)
#> evaluate 0.14 2019-05-28 [2] CRAN (R 4.0.0)
#> fansi 0.4.1 2020-01-08 [2] CRAN (R 4.0.0)
#> fs 1.5.0 2020-07-31 [2] CRAN (R 4.0.2)
#> GGIR 2.1-3 2020-11-10 [1] Github (wadpac/GGIR@2bd6b40)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2)
#> highr 0.8 2019-03-20 [2] CRAN (R 4.0.0)
#> hms 0.5.3 2020-01-08 [2] CRAN (R 4.0.0)
#> htmltools 0.5.0 2020-06-16 [2] CRAN (R 4.0.0)
#> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.2)
#> lifecycle 0.2.0 2020-03-06 [2] CRAN (R 4.0.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.2)
#> pillar 1.4.7 2020-11-20 [1] CRAN (R 4.0.2)
#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.0.0)
#> purrr 0.3.4 2020-04-17 [2] CRAN (R 4.0.0)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.0.2)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.0.2)
#> R.utils 2.10.1 2020-08-26 [1] CRAN (R 4.0.2)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.2)
#> Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
#> read.cwa * 0.2.1 2020-10-26 [1] local
#> readr 1.4.0 2020-10-05 [1] CRAN (R 4.0.2)
#> reprex 0.3.0.9001 2020-09-30 [1] Github (tidyverse/reprex@d3fc4b8)
#> rlang 0.4.9.9000 2020-12-11 [1] Github (r-lib/rlang@1939a71)
#> rmarkdown 2.5 2020-10-21 [1] CRAN (R 4.0.2)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.2)
#> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 4.0.0)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2)
#> stringr 1.4.0 2019-02-10 [2] CRAN (R 4.0.0)
#> styler 1.3.2 2020-02-23 [2] CRAN (R 4.0.0)
#> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.2)
#> vctrs 0.3.5 2020-11-17 [1] CRAN (R 4.0.2)
#> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2)
#> xfun 0.19 2020-10-30 [1] CRAN (R 4.0.2)
#> yaml 2.2.1 2020-02-01 [2] CRAN (R 4.0.0)
#>
#> [1] /Users/johnmuschelli/Library/R/4.0/library
#> [2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library |
Interesting, so there's a difference of about 2% number of rows. This is just a guess but it might be due to buffer size differences and the many interrupts in this cwa. When a buffer of data is read and doesn't pass some quality checks the whole buffer is discarded. Would be interested to see if this happens with nonfaulty cwas. |
Closing due to inactivity, but please reopen if the problem persists. |
Does this mean you checked that the resampling algorithm in biobankAccelerometerAnalysis is correct? The observations I shared in wadpac/GGIR#369 (comment) indicated to me that the resampling algorithm as implemented in OMGUI/cwa-convert and biobankAccelerometerAnalysis might have a bug. For OMGU/cwa-convert I could confirm this with a test. For biobankAccelerometerAnalysis the output is similar to OMGUI, which would give the impression that it has the same bug... or am I somehow making a mistake? Note that this issue may not apply to all cwa data, I only observed it in the cwa demofile that Axivity has on their website not in data collected with more recent AX3 devices. |
Hi @vincentvanhees |
hi @chanshing My comment relates to item 2 at the top of this thread, which is why I replied here and didn't create a new issue. Initially it appeared as if it was a GGIR issue, but I came to the conclusion that it must be an OMGUI issue and possibly also biobankAccelerometerAnalysis. Note that OMGUI uses cwa-convert internally and has the option to export raw data with or without resampling. I did both and compared them as I discuss in wadpac/GGIR#369 (comment). Well, hopefully it is all a misunderstanding but if it truly is a bug than it will impact other analysis. This is why I am trying to raise attention to it. For example, I am wondering whether this could be the cause underlying the comparability problem @aidendoherty and Scott Small observed in their recent pre-print: https://www.medrxiv.org/content/10.1101/2020.10.22.20217927v1.full. |
Many thanks for your suggestions @vincentvanhees Finally, this part of the code will soon be redundant as @chanshing is working on a major refactor of the codebase to reduce our reliance on Java. This will allow us to more easily piggy back on standard signal processing libraries (in python). |
I'm going to open one here and at wadpac/GGIR#369
Below I show 3 things:
GGIR
accProcess from biobankAccelerometerAnalysis
After running
we get the CSV, and read it in:
Making time an actual time object
Goes from 12:56AM to 12:46PM the next day - I'm not sure why this would be or if this is correct, but seems odd.
Created on 2020-10-21 by the reprex package (v0.3.0.9001)
Session info
The text was updated successfully, but these errors were encountered: