Skip to content

About

Post processing of accelerometry data after running PAMPRO stage 1

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

187 Commits

Folders and files

Repository files navigation

Introduction

Acc Post Processing is a Python project designed to post-process accelerometry data that has been processed through Wave or Pampro. The Acc Post Processing project can be executed either through PyCharm or via a batch file. It is recommended to set up a virtual environment in a Python interpreter (PyCharm is used within the MRC Epidemiology Unit) and run the project through this. Follow the user guides for instructions on how to setup, prepare and run the project using both approaches.

For detailed user guides on setting up and running the script, refer to the repository wiki.

Prerequisites

  • Output from accelerometer files processed through Wave or Pampro.
  • Python version 3.12 or higher
  • PyCharm Community Edition (optional; while the script can also be run through a batch file, installation of PyCharm is recommended as it facilitates setting up a virtual environment and managing dependencies more easily).

Further notes

  • This process has been developed on Windows and has NOT been tested on other operating systems, such as macOS.
  • The script has been tested on Python version 3.12. Future versions may be incompatible, but testing will occur as new versions are released.
  • The script assumes that ID will be the first part of filename. It can extra the ID from filenames formatted as either ID or ID_DeviceNumber (It can be other details than the device number, but it is importaint that ID and additional details are seperated by an underscore). If your filename differs, you will need to edit the code to accomodate this. The section to modify can be found in Collapse_Results.py under Creating id variable if it doesn't already exist.
  • The script can create minute level, hourly, daily and summary release files. NOTE: If you useg the minute-level output, you can only create the minute-level release file. These files cannot be used to generate hourly, daily and summary files. To generate the hourly, daily and summary release files, you must use the hourly-level output. Modify the following variables in the config file to specify the processing level:
    • SUB_SET_PREFIXES
      • ["1h", "metadata"] → To create hourly, daily and summary release files.
      • ["1m", "metadata"] → To create minute-level release files.
    • count_prefixes
      • ['1h'] → To create hourly, daily and summary release files.
      • ['1m'] → To create minute-level release files.

Downloading and preparing the environment

Set up folder structure

Create the following folder structure in your project directory:

  • _analysis
  • _data
  • _feedback
  • _logs
  • _releases
  • _results

If the code is run on Pampro output you will furthermore have to create the following folder:

  • _anomalies

Store the accelerometer files in the _data folder, while the output from Wave or Pampro processing should be placed in the _results folder (Which should be set up when running Wave or Pampro).

Download the code

  1. Navigate to the Acc Post Processing repository here.
  2. Click image and select Download ZIP.
  3. Extract the ZIP file into the _analysis folder, ensuring it extracts to a single level of subfolders.

Install dependencies

Certain Python modules are required to run the code. A requirements.txt it included within the downloaded ZIP file, which contains all necessary dependencies for the project. See the User Guides on GitHub wiki for detailed instructions on installing these dependencies.

Preparing script to run

For a description of the different parts of the Acc Post Processing script see Explanation of code.

Before executing the script, some variables must be edited to study specific settings. The two files that require editing are config.py and the Acc_Post_Processing_Orchestra.py. For in-depth instructions on how to edit and run the script, see the GitHub Wiki.

Output

The process generates release files of the post-processed accelerometry data. It can produce release files on minute, hourly, daily and summary level. Each file will include data for all files/participants appended together. These files will be saved in the _releases folder. Each file will have an accompanying data dictionary. All files will be in CSV format.

If the RUN_VERIFICATION_CHECKS is activated to run in the Acc_Post_Processing_Orchestra.py file, a verification log will be produced. The log will be saved in the _logs folder. It provides summaries of the post processed data and notes any issues encountered during the processing of accelerometer files. Review the log to identify any files that may need removal before finalising the release files.

About

Post processing of accelerometry data after running PAMPRO stage 1

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages