Calibration error of accelerometer data in mg

49 views
Skip to first unread message

Cecilie Agergaard sørensen

unread,
Apr 11, 2024, 4:05:38 PMApr 11
to R package GGIR

Hello,

I am using GGIR version: 3.0.9. I am trying to process accelerometer data in csv format using the read.myacc.csv within the GGIR function. I am trying to process a 7-day file  with accelerometer data in mg but it won’t calibrate. In my output summary file I get the message “recalibration not done because not enough points on all sides of the sphere”. I have tried to convert the data to g and then the calibration works.

Below is the code I have used when trying to process the data in mg. Is there any arguments that I am missing, that I need to specify for it to be able to calibrate and process the data in mg?

Any advice is greatly appreciated.

Thank you,

Cecilie

 ____________________________________________________________________________

library(GGIR)

GGIR(mode=c(1,2,3,4,5),

     datadir="C:/Users/data/filename.csv",

     outputdir="C:/Users/results",

     studyname = "test",

     do.report=c(2,4,5),

     #=====================

     # read.myacc.csv arguments

     #=====================

     rmc.nrow = Inf,

     rmc.dec = ".",

     rmc.firstrow.acc = 2,

     rmc.col.acc = 10:12,

     rmc.col.time=5,

     rmc.unit.acc = "mg",

     #rmc.scalefactor.acc = 1,

     rmc.unit.time = "POSIX",

     rmc.format.time = "%Y-%m-%d %H:%M:%OS",

     configtz = NULL,

     desiredtz = "Europe/London",

     rmc.sf = 25,

     rmc.noise = 13,

     #=====================

     # Part 2

     #=====================

     data_masking_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)

Vincent van Hees

unread,
Apr 16, 2024, 11:16:58 AMApr 16
to Cecilie Agergaard sørensen, R package GGIR
Hi Cecilie,

Does the rest of the GGIR output look normal? For example, does it have more than a day of data where the accelerometer has clearly been worn for most of the time? If not, then that could mean that the recording was too short.

Another explanation might be that there was more noise than you specified. For example, you specify 13, but if the noise was higher than GGIR will struggle to find non-movement periods. What happens if you increase the rmc.noise value?

Hoe does data_quality_report.csv look like? How many hour of data were loaded, did it actually find any point on the sphere?

Vincent
--
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/8fccf2a3-01b4-4cb7-8316-3c3eb2da807bn%40googlegroups.com.

Cecilie Agergaard sørensen

unread,
Apr 17, 2024, 5:55:07 AMApr 17
to R package GGIR
Hi Vincent, 

Thank you for your reply. 

The accelerometer file has data from around 6 days. In the data quality report the file.too.short variable says "False", it has 151 hours considered but only 83 10 seconds bouts. The device does not measure temperature. I have attached the data quality report here. I have run the exact same dataset through GGIR but where I have converted the accelerometer data into g rather than mg. For this file I get the Message  "recalibration done, no problems detected". For this file only 84 hours are considered but 17002 10 seconds bouts. So it seems that it is the format of the accelerometer file in mg that is causing the problem. 

I have tried to both increase and decrease the rmc.noise value from 0.013 to 20 but this did not change anything. 

Do you have any suggestions to what could be causing this error when trying to calibrate the accelerometer file in mg? 
Let me know if you need any further information from me. 
Many thanks, 
Cecilie 
data_quality_report.csv

Vincent van Hees

unread,
Apr 18, 2024, 5:33:46 AMApr 18
to Cecilie Agergaard sørensen, R package GGIR
Hi Cecilie,

Oh, this sounds like a bug. I now see in the code that we multiply by 1000 if unit is mg, which should be a division by 1000.

I guess nobody has used this functionality over the years, which is probably why the issue has not been spotted previously...

I will prepare a fix now, to be included in the next release.

Thanks,

Vincent

Cecilie Agergaard sørensen

unread,
Apr 18, 2024, 5:40:36 AMApr 18
to R package GGIR
Hi Vincent, 

Thank you for looking into this and for preparing a fix for the next release. That will be great. Do you know when the next release will be? 

Many thanks, 
Cecilie 

Vincent van Hees

unread,
Apr 18, 2024, 6:01:43 AMApr 18
to Cecilie Agergaard sørensen, R package GGIR
For the time being you can install the fix I just implemented via:

remotes::install_github("wadpac/GGIR", ref = "issue1110_handling_mg_readmyaccsv")

My plan is to make new GGIR release (3.0-10) for GitHub next week.
If there are no big issues after that a few weeks later will follow 3.1-0 release on both GitHub and CRAN.

Vincent

Vincent van Hees

unread,
Apr 19, 2024, 4:36:07 AMApr 19
to Vincent van Hees, Cecilie Agergaard sørensen, R package GGIR
Just release 3.0-10 on GitHub only:
remotes::install_github("wadpac/GGIR", ref = "3.0-10")

Vincent

Cecilie Agergaard sørensen

unread,
Apr 19, 2024, 5:00:50 AMApr 19
to R package GGIR
Hi Vincent, 
Thank you so much. The calibration of my accelerometer data in mg is now working. 
Thank you for your help,
Cecilie 

Reply all
Reply to author
Forward
0 new messages