PAAT - Physical Activity Analysis Toolbox

The physical activity analysis toolbox (PAAT) is a comprehensive toolbox to analyze raw acceleration data. We developed all code mainly for analyzing ActiGraph data (GT3X files) in large sample study settings where manual annotation and analysis is not feasible.

This package has been developed and is maintained by researchers at UiT - the arctic university of Norway and was supported by the High Northern Population Studies, an interdisciplinary initiative to improve the health of future generations. The purpose of this package is to make our research on raw accelerometry easier accessible to other researchers. Most methods implemented in this package have been described in scientific papers which are usually cited in the function’s description. If you are using any of these methods in your research, we would be grateful if you cite the corresponding original paper(s).

Quickstart

Installation

At the moment, the easiest way to install paat directly from GitHub by running:

pip install git+https://github.com/Trybnetic/paat.git

Usage

For now, several functions to work with raw data from ActiGraph devices are implemented while others are still work in progress. The following code snippet should give you a brief overview and idea on how to use this package. Further examples and more information on the functions can be found in the documentation.

# Load data from file
data, sample_freq = paat.read_gt3x('path/to/gt3x/file')

# Detect non-wear time
data.loc[:, "Non Wear Time"] = paat.detect_non_wear_time_hees2011(data, sample_freq)

# Detect sleep episodes
data.loc[:, "Sleep"] = paat.detect_time_in_bed_weitz2024(data, sample_freq)

# Classify moderate-to-vigorous and sedentary behavior
data.loc[:, ["MVPA", "SB"]] = paat.calculate_pa_levels(data, sample_freq)

# Merge the activity columns into one labelled column. columns indicates the
# importance of the columns, later names are more important and will be kept
data.loc[:, "Activity"] = paat.create_activity_column(data, columns=["SB", "MVPA", "Sleep", "Non Wear Time"])

# Remove the other columns after merging
data =  data[["X", "Y", "Z", "Activity"]]

Note

Note that these are only examples. There are multiple methods implemented in PAAT and the processing pipeline can easily be adjusted to individual needs. More examples can be found in the examples section.