Repository navigation
3. User guide ‐ Run in PyCharm
PyCharm is the preferred software within the MRC Epidemiology Unit for conducting command-line tasks. It is a free integrated development environment (IDE) available for both Windows and Linux machines. PyCharm simplifies the command-line workflow, making it accessible even for users less familiar with the command line. The steps below need to be completed to run Acc Post Processing using PyCharm.
To successfully run the Acc Post Processing code in PyCharm, ensure that both Python and PyCharm (community - free edition) are installed on your computer. If they are not already installed, please use the links below to download and install them. Be sure to select the correct version for your operating system.
It is recommended to install Python 3.12. Future versions may be incompatible, though compatibility will be tested as new versions are released.
Create the following folders in your study directory (if they haven't already been created when running Wave/Pampro). While you can use different names, the following structure and naming is recommended:
-
_analysis: Store the Python script here after downloading it from GitHub. -
_data: This folder contains the data being processed (Used when processing through Wave/Pampro) _feedback-
_logs: When running Acc Post Processing, you have the option to run verification checks. The results of these checks will be logged and saved in this folder. -
_releases: Final release files, along with a data dictionary, will be saved in this folder. -
_results: The output from processing through Wave/Pampro should be saved here. Subfolders will be created automatically during Acc Post Processing to organise the results.
If the code is run on Pampro output you will furthermore have to create the following folder:
*_anomalies: Anomalies found through processing accelerometry files through Pampro will be saved here.
It is recommended to set up a virtual environment in PyCharm to run the script. A virtual environment isolates the project's dependencies from the global Python environment, ensuring that the correct libraries and versions are used exclusively for this project.
- Open PyCharm
- Navigate to
Menu > File > New Project
- Leave the
Namefield empty. - For
Location, navigate to the_analysisfolder and save the virtual environment here.
- Under
Interpreter type, select Custom environment. - Choose Generate new in the
Environmentsection. - In
Type, select Virtualenv. - In
Base python, select the Python interpreter (You'll recognise it by the directory that includespython.exe). - In
Location, make sure the virtual environment (.venv) is saved inside the_analysisfolder. - Make sure that all other checkboxes remain unticked.
- Click
Create.
- If a pop-up window appears asking whether to open the project in
This WindoworNew Window, chooseThis Window.
- Navigate to the Acc Post Processing main page on GitHub here.
- Click
, then select Download ZIP. - The ZIP file containing the Acc Post Processing project will be saved in you
Downloadsfolder. - Move the downloaded zip file to the
_analysisfolder inside your study directory. - Unzip the folder and ensure it is named Acc_Post_Processing-master.
- Make sure the extraction process does not create an additional nested folder (e.g.,
Acc_Post_Processing-master/Acc_Post_Processing-master). To avoid this, clickBrowse, choose a destination, and select the_analysisfolder as the location for the extracted files.
- Make sure the extraction process does not create an additional nested folder (e.g.,
- After unzipping, you can delete the original ZIP file.
To run the script, you will need to install some Python packages. Follow the steps below to do this:
- In PyCharm, navigate to the
Terminaltab located at the bottom-left corner. This will open a terminal window displaying the directory for the virtual environment. - Navigate to the folder you downloaded from GitHub (Acc_Post_Processing-master, unless renamed) by typing
cd Acc_Post-Processing-masterand press enter.

- Ensure that you have the
pippackage manager installed by typingpython -m ensurepipand press enter.- This will check if
pipis installed and download it if necessary. -
Pipis a tool that simplifies the process of downloading, installing and updating Python packages.
- This will check if
- Once
pipis installed, run the following command to install all necessary packages:pip install -r requirements.txtand press Enter.

- The
requirements.txtfile contains a list of all the packages needed to run the script. - The terminal will display the installation process, showing the packages being downloaded and installed into you virtual environment.
- The installation is complete once the terminal returns to the original directory path with a
>symbol at the end. This process may take a few minutes.
- At this point, all the required packages have been installed, and you will not need to repeat this step for this project.
Project specific settings for post processing should be edited before executing the script. The only files in the project that may require editing are Config.py and Acc_Post_Processing_Orchestra.py.
To edit these files in PyCharm:
- Open the left-hand side of PyCharm, locate the project folder structure.
- Navigate to the Acc_Post_Processing-master folder, which contains all the project's
.pyfiles. - Double-click on the file you wish to open (either
Config.pyorAcc_Post_Processing_Orchestra.py) to view and edit it in the PyCharm editor.

The Config.py file contains all study-specific settings for post processing. The settings are commented to explain their use, with variables that should be edited clearly marked with EDIT, and those that do not need editing marked with DO NOT EDIT.
- Open
Config.pyin PyCharm -
Modify variables:
- The following variables should be edited as a minimum. Use forward slashes
/in the path, e.g., 'H:study_name/_analysis/Acc_Post_Processing-master'.:-
PROJECT→ Enter the name of the project for which data is being processed.
-
PROCESSING→ Specify if the files were processed through Wave or Pampro.
-
ROOT_FOLDER→ Provide the folder path to the main project directory. This directory should contain the_results,_analysis,_logs,_releases,_feedbackand_datafolders.
-
TIMEZONE→ If you need to adjust for local clock changes, set this variable to the local time zone where the data was collected. Refer to the documentation on Timezones for more details.
-
- The following variables should be edited as a minimum. Use forward slashes
-
Save your changes:
- Once all changes have been made, save the file by pressing
Ctrl + sor by selectingFile > Save All.
- Once all changes have been made, save the file by pressing
The config.py file is now updated with project-specific settings. It should not need further editing unless you wish to make change to the settings throughout the study.
After editing the config.py file, open the Wave_PostProcessingOrchestra.py file.
The Acc_Post_Processing_Orchestra.py file controls which parts of the post-processing code will run. You need to specify which sections of the code you want to execute.
- Open
Acc_Post_Processing_Orchestra.pyin PyCharm. -
Edit the
SWTICHESsection:- In the
SWITCHESsection, change theRUN_variables to'Yes'if you want to run this part of the code, or'No'if you do not want to run this part. Some parts of the code can run independently, while others depend on prior sections being executed. Refer to the explanation of code for a description of each part.
- In the

-
Save your changes:
- Once all changes have been made, save the file by pressing
Ctrl + sor by selectingFile > Save All.
- Once all changes have been made, save the file by pressing
The script is now configured and ready to run.
- Open the
Acc_Post_Processing_Orchestra.pyfile in PyCharm (If it's not already open). - To run the script click the Run icon
at the top of the PyCharm window.

- Alternatively, you can navigate to Run in the menu bar and select Run Acc_Post_Processing_Orchestra.py.

- As the script runs, progress messages will appear in the terminal window at the bottom of PyCharm, showing the script's execution through various stages.
- Once the script has completed, a message indicating the end of the process will be displayed. After this, you can safely close PyCharm.

The process generates release files of the post-processed accelerometer data. It can produce release files on minute-level, 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.