wadpac / GGIRread

Functions for reading accelerometer data files
https://CRAN.R-project.org/package=GGIRread
Apache License 2.0
5 stars 3 forks source link

GENEActiv_testfile - should this be able to be read? #66

Closed muschellij2 closed 3 months ago

muschellij2 commented 3 months ago

I was using GENEActiv_testfile.bin to do some testing, but it seems like readGENEActiv doesn't read it correctly? Should this file be able to be read?

file = system.file("testfiles", "GENEActiv_testfile.bin", package = "GGIR")

res = GGIRread::readGENEActiv(file)
#> WARNING: numBlocksTotal read in from header is negative, file corrupted?
print(res)
#> $header
#> $header$serial_number
#> [1] NA
#> 
#> $header$firmware
#> [1] NA
#> 
#> $header$tzone
#> [1] NA
#> 
#> $header$ReadOK
#> [1] 1
#> 
#> $header$SampleRate
#> [1] -1
#> 
#> $header$ReadErrors
#> [1] 0
#> 
#> $header$numBlocksTotal
#> [1] 1.844674e+19
#> 
#> $header$StarTime
#> [1] NA
#> 
#> $header$Handedness
#> [1] NA
#> 
#> $header$RecordingID
#> [1] NA
#> 
#> $header$DeviceLocation
#> [1] NA
#> 
#> $header$DeviceModel
#> [1] NA
#> 
#> 
#> $data.out
#> [1] time        x           y           z           light       temperature
#> <0 rows> (or 0-length row.names)

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] Github (wadpac/GGIRread@fc0bf08) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
vincentvanhees commented 3 months ago

Sorry, the file is not an actual complete recording. It is a .bin file where I deleted all data after page 16. I did this to make the file small enough to fit inside the package and still useful for testing read functionality of the first couple of pages.

Ok, I think this needs to be better communicated:

muschellij2 commented 3 months ago

Ahh that's interesting, it reads the data if an endpoint is specified (other than Inf), but doesn't give any data if it encounters an error?

muschellij2 commented 3 months ago

Nvm - it turns out this may be due to

file = system.file("testfiles", "GENEActiv_testfile.bin", package = "GGIR")

should be

file = system.file("testfiles", "GENEActiv_testfile.bin", package = "GGIRread")
muschellij2 commented 3 months ago

My overall issue is that the reader had changed significantly similar to https://github.com/wadpac/GGIRread/issues/67. I'll track down the version differences similar to that issue.

Edit: It may be the file changed, not the reader.

muschellij2 commented 3 months ago

OK - I figured out how to show the difference.

Current version of reading (3.1-1)

fname = "GENEActiv_testfile.bin"
# remotes::install_version("GGIR", "2.0-0")
file = system.file("testfiles", fname,
                     package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      3.1-1   2024-06-04 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
mean(out$P$data$x)
#> [1] 0.09041546
readr::write_rds(out, "~/Desktop/new_out.rds")

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIR 3.1-1 2024-06-04 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

From GGIR 2.0-0

fname = "GENEActiv_testfile.bin"
file = system.file("testfiles", fname,
                   package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      2.0-0   2020-05-01 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
#> Number of pages in binary file: 222048
#> Warning in readLines(fc2, n = headlines): line 26 appears to contain an
#> embedded nul
#> Warning in readLines(fc2, n = headlines): line 27 appears to contain an
#> embedded nul
#> Warning in readLines(fc2, n = headlines): line 28 appears to contain an
#> embedded nul
#> Warning in readLines(fc2, n = headlines): line 29 appears to contain an
#> embedded nul
#> Warning in readLines(fc2, n = headlines): line 39 appears to contain an
#> embedded nul
#> Warning in readLines(fc2, n = headlines): line 45 appears to contain an
#> embedded nul
#> Processing...
#> ================================================================================
#> Processing took: 0.003 secs .
#> Loaded 900 records (Approx  0 MB of RAM)
#> 13-05-30 10:12:54.500 (Thu)  to  13-05-30 10:13:04.990 (Thu)
mean(out$P$data.out[, "x"])
#> [1] -0.1942759
new_out = readr::read_rds("~/Desktop/new_out.rds")
all.equal(out, new_out)
#>  [1] "Names: 1 string mismatch"                                                                       
#>  [2] "Length mismatch: comparison on first 4 components"                                              
#>  [3] "Component \"P\": Names: 2 string mismatches"                                                    
#>  [4] "Component \"P\": Attributes: < names for target but not for current >"                          
#>  [5] "Component \"P\": Attributes: < Length mismatch: comparison on first 0 components >"             
#>  [6] "Component \"P\": Length mismatch: comparison on first 2 components"                             
#>  [7] "Component \"P\": Component 1: Modes: numeric, list"                                             
#>  [8] "Component \"P\": Component 1: Lengths: 6300, 12"                                                
#>  [9] "Component \"P\": Component 1: names for current but not for target"                             
#> [10] "Component \"P\": Component 1: Attributes: < names for target but not for current >"             
#> [11] "Component \"P\": Component 1: Attributes: < Length mismatch: comparison on first 0 components >"
#> [12] "Component \"P\": Component 1: target is matrix, current is list"                                
#> [13] "Component \"P\": Component 2: 'current' is not a POSIXt"                                        
#> [14] "Component 3: Modes: numeric, logical"                                                           
#> [15] "Component 3: target is numeric, current is logical"                                             
#> [16] "Component \"endpage\": Mean relative difference: 0.3333333"

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> bitops 1.0-7 2021-04-24 [1] CRAN (R 4.4.0) #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GENEAread 2.0.10 2024-03-06 [1] CRAN (R 4.4.0) #> GGIR 2.0-0 2020-05-01 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> mmap 0.6-22 2023-12-08 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

Version 2.10-1

fname = "GENEActiv_testfile.bin"
file = system.file("testfiles", fname,
                   package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      2.10-1  2023-08-10 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
mean(out$P$data.out[, "x"])
#> [1] -0.1942759
new_out = readr::read_rds("~/Desktop/new_out.rds")
mean(new_out$P$data[, "x"])
#> [1] 0.09041546
all.equal(out, new_out)
#>  [1] "Names: 1 string mismatch"                                                                                 
#>  [2] "Component \"P\": Names: 1 string mismatch"                                                                
#>  [3] "Component \"P\": Component 2: Attributes: < Component \"row.names\": Numeric: lengths (900, 600) differ >"
#>  [4] "Component \"P\": Component 2: Component \"time\": Numeric: lengths (900, 600) differ"                     
#>  [5] "Component \"P\": Component 2: Component \"x\": Numeric: lengths (900, 600) differ"                        
#>  [6] "Component \"P\": Component 2: Component \"y\": Numeric: lengths (900, 600) differ"                        
#>  [7] "Component \"P\": Component 2: Component \"z\": Numeric: lengths (900, 600) differ"                        
#>  [8] "Component \"P\": Component 2: Component \"light\": Numeric: lengths (900, 600) differ"                    
#>  [9] "Component \"P\": Component 2: Component \"temperature\": Numeric: lengths (900, 600) differ"              
#> [10] "Component 3: Modes: numeric, logical"                                                                     
#> [11] "Component 3: target is numeric, current is logical"                                                       
#> [12] "Component \"endpage\": Mean relative difference: 0.3333333"

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIR 2.10-1 2023-08-10 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

Version 3.0-0

fname = "GENEActiv_testfile.bin"
file = system.file("testfiles", fname,
                   package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      3.0-0   2023-10-16 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
mean(out$P$data.out[, "x"])
#> [1] -0.1942759
new_out = readr::read_rds("~/Desktop/new_out.rds")
mean(new_out$P$data[, "x"])
#> [1] 0.09041546
all.equal(out, new_out)
#>  [1] "Names: 1 string mismatch"                                                                                 
#>  [2] "Component \"P\": Names: 1 string mismatch"                                                                
#>  [3] "Component \"P\": Component 2: Attributes: < Component \"row.names\": Numeric: lengths (900, 600) differ >"
#>  [4] "Component \"P\": Component 2: Component \"time\": Numeric: lengths (900, 600) differ"                     
#>  [5] "Component \"P\": Component 2: Component \"x\": Numeric: lengths (900, 600) differ"                        
#>  [6] "Component \"P\": Component 2: Component \"y\": Numeric: lengths (900, 600) differ"                        
#>  [7] "Component \"P\": Component 2: Component \"z\": Numeric: lengths (900, 600) differ"                        
#>  [8] "Component \"P\": Component 2: Component \"light\": Numeric: lengths (900, 600) differ"                    
#>  [9] "Component \"P\": Component 2: Component \"temperature\": Numeric: lengths (900, 600) differ"              
#> [10] "Component 3: Modes: numeric, logical"                                                                     
#> [11] "Component 3: target is numeric, current is logical"                                                       
#> [12] "Component \"endpage\": Mean relative difference: 0.3333333"

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIR 3.0-0 2023-10-16 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

3.0-3

fname = "GENEActiv_testfile.bin"
file = system.file("testfiles", fname,
                   package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      3.0-3   2024-01-11 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
mean(out$P$data.out[, "x"])
#> [1] -0.1942759
new_out = readr::read_rds("~/Desktop/new_out.rds")
mean(new_out$P$data[, "x"])
#> [1] 0.09041546
all.equal(out, new_out)
#>  [1] "Names: 1 string mismatch"                                                                                 
#>  [2] "Component \"P\": Names: 1 string mismatch"                                                                
#>  [3] "Component \"P\": Component 2: Attributes: < Component \"row.names\": Numeric: lengths (900, 600) differ >"
#>  [4] "Component \"P\": Component 2: Component \"time\": Numeric: lengths (900, 600) differ"                     
#>  [5] "Component \"P\": Component 2: Component \"x\": Numeric: lengths (900, 600) differ"                        
#>  [6] "Component \"P\": Component 2: Component \"y\": Numeric: lengths (900, 600) differ"                        
#>  [7] "Component \"P\": Component 2: Component \"z\": Numeric: lengths (900, 600) differ"                        
#>  [8] "Component \"P\": Component 2: Component \"light\": Numeric: lengths (900, 600) differ"                    
#>  [9] "Component \"P\": Component 2: Component \"temperature\": Numeric: lengths (900, 600) differ"              
#> [10] "Component 3: Modes: numeric, logical"                                                                     
#> [11] "Component 3: target is numeric, current is logical"                                                       
#> [12] "Component \"endpage\": Mean relative difference: 0.3333333"

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIR 3.0-3 2024-01-11 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

3.0-5

fname = "GENEActiv_testfile.bin"
file = system.file("testfiles", fname,
                   package = "GGIRread")
sessioninfo::package_info("GGIRread", dependencies = FALSE)
#>  package  * version date (UTC) lib source
#>  GGIRread   1.0.1   2024-06-03 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
sessioninfo::package_info("GGIR", dependencies = FALSE)
#>  package * version date (UTC) lib source
#>  GGIR      3.0-5   2024-02-02 [1] CRAN (R 4.4.0)
#> 
#>  [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library
inspectfileobject = GGIR::g.inspectfile(file)
out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)
mean(out$P$data[, "x"])
#> [1] -0.1942759
new_out = readr::read_rds("~/Desktop/new_out.rds")
mean(new_out$P$data[, "x"])
#> [1] 0.09041546
all.equal(out, new_out)
#>  [1] "Names: 1 string mismatch"                                                                                 
#>  [2] "Component \"P\": Names: 1 string mismatch"                                                                
#>  [3] "Component \"P\": Component 2: Attributes: < Component \"row.names\": Numeric: lengths (900, 600) differ >"
#>  [4] "Component \"P\": Component 2: Component \"time\": Numeric: lengths (900, 600) differ"                     
#>  [5] "Component \"P\": Component 2: Component \"x\": Numeric: lengths (900, 600) differ"                        
#>  [6] "Component \"P\": Component 2: Component \"y\": Numeric: lengths (900, 600) differ"                        
#>  [7] "Component \"P\": Component 2: Component \"z\": Numeric: lengths (900, 600) differ"                        
#>  [8] "Component \"P\": Component 2: Component \"light\": Numeric: lengths (900, 600) differ"                    
#>  [9] "Component \"P\": Component 2: Component \"temperature\": Numeric: lengths (900, 600) differ"              
#> [10] "Component 3: Modes: numeric, logical"                                                                     
#> [11] "Component 3: target is numeric, current is logical"                                                       
#> [12] "Component \"endpage\": Mean relative difference: 0.3333333"

Created on 2024-06-06 with reprex v2.1.0

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.4.0 (2024-04-24) #> os macOS Sonoma 14.4.1 #> system x86_64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2024-06-06 #> pandoc 3.1.11.1 @ /usr/local/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> cli 3.6.2 2023-12-11 [1] CRAN (R 4.4.0) #> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0) #> digest 0.6.35 2024-03-11 [1] CRAN (R 4.4.0) #> evaluate 0.23 2023-11-01 [1] CRAN (R 4.4.0) #> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0) #> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0) #> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0) #> GGIR 3.0-5 2024-02-02 [1] CRAN (R 4.4.0) #> GGIRread 1.0.1 2024-06-03 [1] CRAN (R 4.4.0) #> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0) #> hms 1.1.3 2023-03-21 [1] CRAN (R 4.4.0) #> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0) #> knitr 1.46 2024-04-06 [1] CRAN (R 4.4.0) #> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0) #> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0) #> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0) #> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.4.0) #> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.4.0) #> R.oo 1.26.0 2024-01-24 [1] CRAN (R 4.4.0) #> R.utils 2.12.3 2023-11-18 [1] CRAN (R 4.4.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0) #> Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.4.0) #> readr 2.1.5 2024-01-10 [1] CRAN (R 4.4.0) #> reprex 2.1.0 2024-01-11 [1] CRAN (R 4.4.0) #> rlang 1.1.3 2024-01-10 [1] CRAN (R 4.4.0) #> rmarkdown 2.27 2024-05-17 [1] CRAN (R 4.4.0) #> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0) #> styler 1.10.3 2024-04-07 [1] CRAN (R 4.4.0) #> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0) #> tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.4.0) #> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0) #> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0) #> withr 3.0.0 2024-01-16 [1] CRAN (R 4.4.0) #> xfun 0.44 2024-05-15 [1] CRAN (R 4.4.0) #> yaml 2.3.8 2023-12-11 [1] CRAN (R 4.4.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
muschellij2 commented 3 months ago

This is likely a GGIR issue not a GGIRread issue, but the output is still quite troubling.

muschellij2 commented 3 months ago

Looks like this change happened between 3.0-6 and 3.0-9

vincentvanhees commented 3 months ago

GGIR function g.part1 and all its underlying functions, including g.readaccfile, went through a major review and tidy-up by Lena in 2023/2024. A few of these updates were implemented in 3.0-3 but most were merged in GGIR 3.0-6. In 3.0-3 there was even a bug fix that would only be visible in R >=4.3.0 which explains why we never spotted it before. For details see: https://cran.r-project.org/web/packages/GGIR/news/news.html

I know the version number increments are not intuitive, but I hope the changelog will clarify where consistency breaking changes can be expected. I usually clarify which part of GGIR the change happend which should help to assess whether it was reading related (part 1) or otherwise.

For your information: I am currently doing a major revision of the GGIR vignettes where I migrate and restructure a lot of the text to the gh-pages. Next big project would be to review and tidy-up other parts of GGIR code, and where necessary migrate parts to their own package. The ultimate goal would be to make it all more accessible for users and code contributors. However, without structural funding it is a slow process depending on voluntary efforts.

file = system.file("testfiles", "GENEActiv_testfile.bin", package = "GGIRread")

Yes, I moved the test file from GGIR to GGIRread to concentrate all read-related functions and unit testing there. I may have replaced the file, not sure now.

muschellij2 commented 3 months ago

Got it - I think most users don't regularly peruse the change log, which can make it hard to see these, but there's not much better solutions from what I can tell. Looking over the change log, it's not clear which record would have indicated this type of change. Can you point to which part of the change log indicates this?

vincentvanhees commented 3 months ago

From 3.0-6 in https://cran.r-project.org/web/packages/GGIR/news/news.html:

Part 1:

  • Improved readability and maintainability of the code #1027
  • Improved processing speed for Axivity .cwa, GENEActiv .bin, and Movisens files
  • Made sure that g.readaccfile() reads timestamps in the correct timezone, configtz, for all monitor types
  • Note: there will be small differences in both metalong and metashort metrics calculated by this GGIR version, compared to prior versions. This is due to small improvements in the management of timestamps, calibration coefficients, and input data block boundaries.
  • Fix handling of ad hoc csv file header in g.inspectfile() #1057
  • Improved g.calibrate to better handle scenario when no non-movement periods are found in the entire recording #1032
  • Improved documentation for the need to specify rmc.firstrow.acc when working with ad-hoc csv file format and read.myacc.csv now produces an error when used directly while user forgets to specify rmc.firstrow.acc #1034.

Most of which was part of https://github.com/wadpac/GGIR/pull/1027 Further, the other PRs by l-k- in the past year are probably also related to the changes.

I hope this helps.

muschellij2 commented 3 months ago

I see the note about increased processing speed, but I don’t see anything in there that would indicate breaking changes. The meta data indicates it’d be changed, but this isn’t a metadata change. The changes “

is about timestamps but not rows of the data. I’m not trying to be labor the point too much but I just want to get an understanding of when I can upgrade GGIR and be confident the results can be reproduced in the future versions of code and how stable it is for use in research.

Best, John

On Fri, Jun 7, 2024 at 10:47 AM Vincent van Hees @.***> wrote:

From 3.0-6 in https://cran.r-project.org/web/packages/GGIR/news/news.html:

Part 1:

  • Improved readability and maintainability of the code #1027
  • Improved processing speed for Axivity .cwa, GENEActiv .bin, and Movisens files
  • Made sure that g.readaccfile() reads timestamps in the correct timezone, configtz, for all monitor types
  • Note: there will be small differences in both metalong and metashort metrics calculated by this GGIR version, compared to prior versions. This is due to small improvements in the management of timestamps, calibration coefficients, and input data block boundaries.
  • Fix handling of ad hoc csv file header in g.inspectfile() #1057
  • Improved g.calibrate to better handle scenario when no non-movement periods are found in the entire recording #1032
  • Improved documentation for the need to specify rmc.firstrow.acc when working with ad-hoc csv file format and read.myacc.csv now produces an error when used directly while user forgets to specify rmc.firstrow.acc

    1034.

Most of which was part of wadpac/GGIR#1027 https://github.com/wadpac/GGIR/pull/1027 but basically all the PRs by l-k- in the past year are related to improving the code.

I hope this helps.

— Reply to this email directly, view it on GitHub https://github.com/wadpac/GGIRread/issues/66#issuecomment-2154999311, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIGPLVGYPUOPTAEGIDKSLDZGHBZXAVCNFSM6AAAAABI4WZTQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJUHE4TSMZRGE . You are receiving this because you authored the thread.Message ID: @.***>

vincentvanhees commented 3 months ago

I remember that for GENEActiv recordings we discovered that they can start half way a second. Previously the code missed / rounded the time to the nearest second. So, probably if you shift the time series by half a second you will see that the values match again. Plotting the data probably also helps to spot the shift. I am afraid I do not have time to dive deeper into this. Happy to do so if someone would pay me for it.

when I can upgrade GGIR and be confident the results can be reproduced in the future versions of code and how stable it is for use in research.

I am afraid this is an unrealistic expectation. See also my recent post in the GGIR google group: https://groups.google.com/g/RpackageGGIR/c/nvI-gZQ2LzI/m/8sL750TVBwAJ

If this is a problem then the researchers you work with, and others, have three options:

l-k- commented 3 months ago

@muschellij2 prior to https://github.com/wadpac/GGIR/pull/1027, for GENEActiv .bin files, g.readaccfile((...,blocksize, ...) was actually reading blocksize+1 number of pages, not blocksize number of pages as one would expect. So in GGIR versions before 3.0-6, your call

out = GGIR::g.readaccfile(
  file, inspectfileobject = inspectfileobject,
  blocksize = 2, blocknumber = 1, ws = 3, 
  desiredtz = "UTC", 
  filequality = list(filecorrupt = FALSE, filetooshort = FALSE)
)

is actually getting you 3 pages worth of data, not 2. With GGIR 3.0-6 and later, you get a 2-page block.

This happened because in the call to GGIRread::readGENEActiv(..., start, end, ...), page selection is defined from start to end including end -- but we were treating this call as if the end was excluded.

Here's the relevant commit, and this change was identified in the PR description ("for monitor types for which the file is read till endpage including the endpage, we used to read (blocksize + 1) samples at a time, instead of blocksize samples as was requested.")

This is one of the changes that were collectively referred to as "improvements in the management of <...> input data block boundaries" in 3.0-6 release notes. I didn't think many GGIR users have a need to call g.readaccfile() directly, so the concern was that describing the exact changes to this module would have buried users in too much detail and discouraged them from reading release notes. If one runs GGIR() on a whole file, the effect of this change on GGIR output is minor.