error in Part 1

209 views
Skip to first unread message

Joshua Wiley

unread,
Aug 21, 2023, 12:10:40 PM8/21/23
to R package GGIR
Hi All,

I'm stuck with an error and unsure how to troubleshoot. We use old Actigraph w3gtx devices. Download and export the data to CSV format without timestamps. Actigraphs are mailed, worn for 2 weeks, off for 2 weeks and then worn again for 2 weeks before being mailed back and data downloaded. I took data from two quite compliant participants to use for testing. Folder structure like this:
Screenshot 2023-08-21 at 4.30.45 pm.png
I've checked and the CSV files definitely contain data. Here is a sample from the less command.
Screenshot 2023-08-21 at 4.32.00 pm.png
Whenever I try to run GGIR, I get the following:

_________________________________________________
 Part 1
Checking that user has read access permission for all files in data directory: Yes
Checking that user has write access permission for directory specified by argument outputdir: Yes
 Busy processing ... see /Users/wileyj/tmpcsv/scored/output_raw/meta/basic for progress
Errors and warnings for SC02 (2021-01-29)RAW.csv$message
[1] "cannot open the connection"
$call
gzfile(file, "wb")
Errors and warnings for SC03 (2021-02-12)RAW.csv$message
[1] "cannot open the connection"
$call
gzfile(file, "wb")
_______________________________________________________________
 Part 2
1 Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning messages:
1: In dir.create(file.path(metadatadir, ms2.out)) :
  cannot create dir '/Users/wileyj/tmpcsv/scored/output_raw//meta/ms2.out', reason 'No such file or directory'
2: In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file '/Users/wileyj/tmpcsv/scored/output_raw/meta/basic/NA', probable reason 'No such file or directory'


The files are definitely present. They are in my user folder with read/write permissions. I have current versions of GGIR and GGIRread from CRAN. Here is SessionInfo()

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] GGIRread_0.3.0 GGIR_2.10-1  

loaded via a namespace (and not attached):
 [1] compiler_4.2.2    parallel_4.2.2    tools_4.2.2       Rcpp_1.0.10      
 [5] codetools_0.2-19  doParallel_1.0.17 iterators_1.0.14  foreach_1.5.2    
 [9] data.table_1.14.8 tcltk_4.2.2 
    

I'm at a loss for best next steps. I'm not worried about the Part 2 as clearly Part 1 is failing. Because of how many layers GGIR has, I'm not sure the best steps even to try to debug this and figure out what / where it is failing. Any thoughts / suggestions on things to try or even debugging steps to take would be welcome. The GGIR call is provided at the end.

Many thanks,

Josh



datadir <- "/Users/wileyj/tmpcsv/raw"
outputdir <- "/Users/wileyj/tmpcsv/scored"
loglocation <- "/Users/wileyj/tmpcsv/sleeplog.csv"

GGIR(mode=c(1,2,3,4,5),
      datadir = datadir,
      outputdir = outputdir,
      do.report=c(2,4,5),
      #=====================
      # Part 2
      #=====================
      strategy = 1,
      hrs.del.start = 0,          hrs.del.end = 0,
      maxdur = 9,                 includedaycrit = 16,
      qwindow=c(0,24),
      mvpathreshold =c(100),
      excludefirstlast = FALSE,
      includenightcrit = 16,
      #=====================
      # Part 3 + 4
      #=====================
      def.noc.sleep = 1,
      outliers.only = TRUE,
      criterror = 4,
      do.visual = TRUE,
      #=====================
      # Part 5
      #=====================
      threshold.lig = c(30), threshold.mod = c(100),  threshold.vig = c(400),
      boutcriter = 0.8,      boutcriter.in = 0.9,     boutcriter.lig = 0.8,
      boutcriter.mvpa = 0.8, boutdur.in = c(1,10,30), boutdur.lig = c(1,10),
      boutdur.mvpa = c(1),
      includedaycrit.part5 = 2/3,
      #=====================
      # Visual report
      #=====================
      timewindow = c("WW"),
      visualreport=TRUE)





marcuslop...@gmail.com

unread,
Aug 21, 2023, 12:23:32 PM8/21/23
to R package GGIR
Hi Josh,

GGIR did not find the meta files derived from your CSV. Try including the argument "overwrite = TRUE" in your GGIR script.

Best,
Marcus

Joshua Wiley

unread,
Aug 22, 2023, 9:53:03 PM8/22/23
to R package GGIR
Hi All,

Thanks to Marcus for the suggestion. Setting overwrite = TRUE did not help.
However, running it on another computer (Win 11 Pro, x64 Intel I9 13900ks cpu) did work.
I'm glad it is running somewhere, but I would still appreciate any thoughts on how to debug. It would be helpful to be isolate exactly what code from GGIR is failing to see if its possible to understand why and thus a fix for it to work across systems.

Cheers,

Josh

Vincent van Hees

unread,
Aug 29, 2023, 11:45:31 AM8/29/23
to Joshua Wiley, R package GGIR
Hi Josh,

Sorry to hear about your struggles. GGIR is auto tested on macos 12, ubuntu and windows, and we have not seen issues there. I will now add macos-13 like you have to the workflow for to see whether that can replicate the issue.

In the meantime could you try:
  • Make sure all dependencies are up to date (Check for pack updates in RStudio)
  • Simply try again because in the days that you were trying to run your code a new GGIR version was being released. The CRAN release process sometimes gives issues during the days when old CRAN binaries are replaced by new binaries and package version number has already been updated.
  • Set do.parallel = FALSE which will process the files serially and tends to provide easier to read error messages.
  • Set mode = 1 to avoid the part 2 output for the time being.
  • Investigate whether the issue is specific to some files or all your files.

Best,
Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image

------- Original Message -------
--
You received this message because you are subscribed to the Google Groups "R package GGIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/959a087b-b973-4133-b985-b8e8c2c32a89n%40googlegroups.com.

Joshua Wiley

unread,
Aug 31, 2023, 2:47:03 AM8/31/23
to R package GGIR
Dear Vincent,

Thank you for that feedback. I had updated all my R packages and ensured dependencies were installed.
However, I did this again today, re-ran and --- its working!
I suppose I could have tried building packages and dependencies from source maybe. Anyways, it all appears to be operational at the moment. The feedback on do.parallel for more informative error messages is also a good tip.

Thank you very much,

Josh
Reply all
Reply to author
Forward
0 new messages