Estimate sleep with asleep in an isolated Python process
Source:R/acti_sleep_models.R
py_acti_asleep.RdUses asleep::py_asleep() to run the same asleep model as
acti_asleep() in a callr subprocess. This keeps Python package
requirements separate from the current R session.
Usage
py_acti_asleep(
data,
min_wear_hours = 22L,
time_shift = "0",
report_light_and_temp = FALSE,
pytorch_device = c("cpu", "cuda:0"),
sample_rate = NULL,
verbose = TRUE,
force_download = FALSE,
pyenv_function = function() asleep::py_require_asleep(),
show = FALSE
)Arguments
- data
A data frame containing timestamps and triaxial acceleration, or a readable accelerometry file path. File paths are passed unchanged to
asleep::asleep().- min_wear_hours
Minimum daily wear time used by
asleepsummaries.- time_shift
Clock-time correction passed to
asleep::asleep().- report_light_and_temp
Whether to request light and temperature output.
- pytorch_device
Device used for prediction.
- sample_rate
Optional input sample rate.
- verbose
Whether
asleepprints progress messages.- force_download
Whether to re-download
asleepmodel files.- pyenv_function
Function that configures Python in the subprocess.
- show
Whether to stream subprocess output.
Value
An acti_sleep_estimate tibble; see acti_asleep().