We use cookies and other tools to enhance your experience on our website and to analyze our web traffic.
For more information about these cookies and the data collected, please refer to our Privacy Policy.

pyActigraphy: Open-source Python Software for Actigraphy and Light Data Analysis

Guest blogger: Grégory Hammad, Ir, PhD GIGA-CRC in vivo imaging, University of Liège, Liège, Belgium, Chair of Neurogenetics, Faculty of Medicine, Technical University of Munich, Munich, Germany


PyActigraphy is an open-source Python software for actigraphy and light data analysis. Its functionalities range from data cleaning, and calculations of rest-activity rhythm variables up to more advanced data processing techniques such as functional linear modeling, detrended fluctuation analysis, or singular spectrum analysis.

What is the tool being discussed?

Our software, pyActigraphy, is an open-source Python software for the analysis of actigraphy and light recordings made with various devices. Its functionalities range from data cleaning, and calculations of rest-activity rhythm variables up to more advanced data processing techniques such as functional linear modeling, detrended fluctuation analysis, and singular spectrum analysis.

What was the approach or how does the tool work?

The development of pyActigraphy was triggered by the fact that almost all actigraphy datasets acquired in our lab were hardly re-usable as they were acquired with different devices, leading to various file formats linked to different proprietary softwares. Some of them were not supported by their initial company anymore, and there was quite a significant amount of manual processing work before getting to the analysis, which hampered the analysis of large datasets.

The goal of pyActigraphy is thus to alleviate the burden of manual data processing and analysis for small and large datasets in a reproducible way.

How can researchers use/benefit from the tool?

Various file formats are supported by pyActigraphy, all leading to the same unified software interface. This means that the same analysis can seamlessly run on datasets collected with different devices. Furthermore, the software offers functions to clean the data, a crucial step that is often overlooked. Non-wear periods can easily be tracked and removed from subsequent analyses. Usual rest-activity rhythm variables (IS, IV, L5, M10, RA, etc) can be computed with different resampling and binarisation settings, as well as activity or rest fragmentation via state transition probability. Reports on physical activity can also be generated. Several automatic rest period detection algorithms are also available, allowing researchers to easily compare results obtained with different algorithms. In addition, the software provides easy access to more advanced analysis techniques such as singular spectrum analysis for signal decomposition. Finally, given the impact of light on rest-activity activity patterns, we also developed a module, pyLight, for specific light data analysis that can be used independently or to analyze light data collected by actigraphy devices supported by pyActigraphy.

Recently, the package has been used in a broad range of contexts; investigation of daytime rest in normal aging (Reyt et al., 2022), rest-activity patterns in insomnia (Rösler et al., 2022), identification of traits in individuals with schizophrenia or at risk from mental disorders using machine learning (Ferreira and Daly, 2022; Nagy et al., 2023) or sleep-wake behaviour in Parkinson’s disease (Baumgartner et al., 2023).

What NSRR data were used or how could the tool be utilized by researchers with NSRR data?

With the latest release, we added support for the actigraphy file format used in the MESA dataset. In addition to the summary metrics already computed and made available by the NSRR about the MESA data, researchers can now read and analyse the raw actigraphy and light data and compute any metric or run multiple rest period detection algorithms. For example, in Reyt et al., 2022, the authors were able to run an alternative rest period detection algorithm and compute its performance over the entire MESA dataset. They could thus verify that the sensitivity and specificity were both as high as expected and constant over multiple times of day.

We believe that having access to both pre-computed metrics and an analysis software will benefit a larger community of researchers with different coding skills.

Anything else to add?

Data banking initiatives like the NSRR offer wonderful new opportunities for research and we are looking forward to new datasets being available. We believe that, to fully benefit from the efforts put by these initiatives to deliver larger and larger datasets, we also need to make efforts in the development of open-source analysis tools. That is what we tried to do with pyActigraphy and we hope it is useful to our research community. So feel free to contact us if you want to contribute to this project. All kinds of contributions (new feature requests, bug report, documentation, etc) are welcome.


A companion paper has been published in PLOS Computational Biology:

Hammad G, Reyt M, Beliy N, Baillet M, Deantoni M, et al. (2021) pyActigraphy: Open-source python package for actigraphy data visualization and analysis. PLOS Computational Biology 17(10): e1009514. https://doi.org/10.1371/journal.pcbi.1009514.

The source code can be accessed on GitHub and can be used to build the software locally if needed. However, the python package is already accessible on the Python Package Index (PyPI) repository. The software documentation is available online. It also contains a series of tutorials that illustrate the various software functionalities. These tutorial notebooks are actually freely accessible within the source code and offer researchers an interactive way to experiment how the software works.

Here is also a link to a talk I gave at the “Physics of Life ” UK workshop in November 2021 about open-source softwares for actigraphy analysis, briefly highlighting the functionalities of pyActigraphy and other packages.

By szhivotovsky on May 1, 2023 May 1, 2023 in Guest Blogger
no comments
· sorted by
Write a Reply