Repository navigation
4. User guide ‐ Run as batch
It is recommended to set up a virtual environment and run the project through this. Creating a virtual environment isolates the project's dependencies from the global python environment and ensures that the project only uses the required libraries in the correct versions. A virtual environment helps avoid conflicts between different projects on the same system.
To set up a virtual environment, you can use a Python IDE. In MRC Epidemiology Unit we recommend PyCharm. Follow the instructions in 3. User Guide - Run in PyCharm for downloading PyCharm and setting up a virtual environment. Complete the steps up to and including 'Installing requirements'. Once you have done these initial preparations, you can set up a batch script to run the project, so you don't have to interact with PyCharm when executing the script.
It is also possible to run the script through a batch file without having to download PyCharm. In this case, you would need to install the project's requirements through the Command Prompt using a command like pip install -r requirements.txt. This installs the dependencies directly into the global Python environment. This means the packages, including their versions, will be installed system-wide and could affect other Python projects and cause conflicts if different projects require different versions of the same packages.
For this reason we recommend setting up a virtual environment to keep project's dependencies isolated. Since we recommend using a virtual environment, further instructions on setting up the batch file without one are not provided.
A batch file is a text file that contains a list of commands for your computer to execute automatically. These files have a .bat extension. By double-clicking the batch file, your computer will run the Python scripts without needing to interact with a Python IDE (e.g., PyCharm).
Before running the script through the batch file, you will need to edit it to run the project-specific code. Follow the instructions below to modify the batch file:
-
Open the "Acc_Post_Processing_Bat.bat" file:
- Navigate to the
_analysisfolder where the "Acc_Post_Processing_Bat.bat" file is located. - Right click on the file and select one of the following options:
-
Edit with Notepad (++)(or any text editor of your choise) -
Edit(this will automatically open the file in Notepad)
-
- Navigate to the

-
Edit the Python Interpreter path:
- Within the batch file, you will see two sets of
"". The first set is where you will place the path to the Python interpreter. - To locate the Python interpreter (i.e., python.exe) for the virtual environment:
- Navigate to the project's
_analysisfolder, then go to.venv.→Scripts. - Copy the full path to this folder, including
python.exe, and paste it inside the first set of"".
- Navigate to the project's
- Within the batch file, you will see two sets of

-
Edit the Python Script path:
- In the second set of
" ", you will place the path to theAcc_Post_Processing_Orchestra.pyscript. To find this path:- Navigate to the location of the
Acc_Post_Processing_Orchestra.pyfile within the project. - Copy the full path, including the script name, and paste it inside the second set of
"".
- Navigate to the location of the
- In the second set of
-
Save the Batch File:
- Once you have edited the paths, the batch file should not need editing again.
- Save the batch file by pressing
Ctrl + sor navigate toFile > Save. - Close the text editor.
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. Follow the steps below to edit these files.
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 Notepad:- Right-click on the
Config.pyfile and selectEdit with Notepad(any version of notepad is fine).
- Right-click on the
-
Modify variables:
- The following variables should be edited as a minimum. Use forward slashes
/in the path, e.g., 'H:study_name/_analysis/Wave_PostProcessing-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. - Close Notepad.
- 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.
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 Notepad:- Right-click on the
Acc_Post_Processing_Orchestra.pyfile and selectEdit with Notepad(any version of notepad is fine).
- Right-click on the
-
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. - Close Notepad.
- Once all changes have been made, save the file by pressing
The script is now configured and ready to run.
To execute the script, follow these steps:
-
Run the batch file:
- Double click the
Acc_Post_Processing_Bat.batfile to start the script. - If a pop up window appears asking whether you are sure you want to run the script/app, click "Run anyway" to proceed.
- Double click the
-
Monitor progress:
- The batch script will execute the Acc Post Processing code. During this process, messages will appear in the Command Prompt window, showing the progress of the script as it runs through different parts of the file.
-
Completion:
- Once the script has finished running, a message will be displayed that the process is complete. Press 'Enter' to close the Command Prompt window.

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.