Sage-Bionetworks / mhealthtools

A modular R package for extracting features from mobile sensor data
Apache License 2.0
13 stars 10 forks source link

IMF transformation breaks with small inputs #181

Open philerooski opened 5 years ago

philerooski commented 5 years ago

From @itismeghasyam:

# Data that is DISMAL < i.e say ~10 samples)
miniAccel <- mhealthtools::accelerometer_data %>% 
  dplyr::filter(t < 0.1)
miniGyro <- mhealthtools::gyroscope_data %>% 
  dplyr::filter(t < 0.1)

# This should also be an empty feature list, with an error, but
# throws a different error than before and does not execute.
# The issue here is from the IMF parameter, if that is removed
# no problems, runs smoothly
tremorFeatures <- mhealthtools::get_tremor_features(
  accelerometer_data = miniAccel,
  gyroscope_data = miniGyro,
  IMF = 2)

A simplified example:

accelerometer_data %>%
    mhealthtools:::tidy_sensor_data() %>%
    dplyr::filter(t < 0.1) %>%
    mhealthtools:::transformation_imf_window(window_length = 256,
                                             window_overlap = 0.5,
                                             max_imf = 2)()
philerooski commented 5 years ago

See #180 (Error 4)