ShimmerEngineering / Verisense-Toolbox

Tools and utilities to analyse Verisense data
8 stars 12 forks source link

Bug report specific to using the algorithm on data without peaks #8

Open vincentvanhees opened 4 months ago

vincentvanhees commented 4 months ago

The algorithm code seems not able to handle data segments without peaks, which I find in ActiGraph data where large time segments can represent a constant as a result of the idle sleep mode, but maybe it also affects other sensor brands that have a similar behaviour. I get error message incorrect number of dimensions with reference to $call peak_info[, 3]

To address this revise this code segment from

peak_info <- peak_info[peak_info[,4] > sim_thres,]  # filter based on sim_thres
peak_info <- peak_info[is.na(peak_info[,1])!=TRUE,] # previous statement can result in an NA in col-1

to

peak_info <- peak_info[peak_info[,4] > sim_thres, , drop = FALSE]  # filter based on sim_thres
peak_info <- peak_info[is.na(peak_info[,1])!=TRUE,  , drop = FALSE] # previous statement can result in an NA in col-1

With these changes I am able to process the problematic file again.