This is a Python-based command-line tool that converts Cyclus2 .c2d files into standard data formats (TSV and JSON) that you can easily import into R, or any other analysis software you like.
c2dpyparse extracts measurement data and metadata from compressed Cyclus2 .c2d files (from Wingate anaerobic capacity tests) and converts them into:
- TSV file: Tab-separated measurement data (e.g., readable by R's
read.table()) - JSON file: Structured metadata about the test (e.g., readable with R's
jsonlitepackage)
You need Python installed on your computer. Don't worry - you don't need to write any Python code!
Open your terminal/command prompt and type:
python --versionIf you see something like Python 3.8.x or higher, you're good to go.
If not, install Python:
- Windows: Download from python.org
- macOS:
brew install python3(if you have Homebrew) or download from python.org - Linux:
sudo apt install python3 python3-pip(Ubuntu/Debian)
Clone or download the c2dpyparse package to your computer
git clone FIXME: URL to public repo
cd c2dPyParseIf you don't have git: Download the package as a ZIP file and extract it.
Open your terminal/command prompt in the package directory and run:
pip install -e .Common Issues and Solutions:
- "pip not found": Try
python -m pip install -e .instead - Permission errors on macOS/Linux: Try
pip install --user -e . - Multiple Python versions: Try
python3 -m pip install -e .
Test that the command works:
c2dpyparse --helpYou should see help text describing the available options.
If you get "command not found": Try using the module approach instead:
python -m c2dpyparse.c2d_cli --helpc2dpyparse path/to/your/file.c2d --output-dir results/c2dpyparse "C:\Users\YourName\Desktop\report_Wingate.c2d" --output-dir "C:\Users\YourName\Desktop\results"<file path>(required): Path to your.c2dfile--output-dir(required): Directory where output files will be saved--task(optional): Task name for file naming (default: "wingate")--sections(optional): Which metadata sections to extract (default: Athlete CycleData Protocol)
Custom task name
c2dpyparse data/test.c2d --output-dir results/ --task baselineTo extract specific metadata sections, use
c2dpyparse data/test.c2d --output-dir results/ --sections Athlete ProtocolTo extract multiple sections, use
c2dpyparse data/test.c2d --output-dir results/ --sections Athlete CycleData Protocol EquipmentFor an input file named report_Wingate.c2d, the tool creates:
sub-Wingate_task-wingate_physio.tsv, containing the measurement data over timesub-Wingate_task-wingate_physio.json, containing metadata about the participant and settings
measurement_data <- read.table("sub-Wingate_task-wingate_physio.tsv",
sep = "\t",
header = TRUE,
na.strings = "n/a")library(jsonlite)
metadata <- fromJSON("sub-Wingate_task-wingate_physio.json")head(measurement_data)
str(metadata)The TSV file typically contains:
Time [ms]: Timestamp in millisecondsPower [W]: Power output in wattsHeart Rate [1/min]: Heart rate in beats per minuteCadence [1/min]: Pedaling cadence in RPMSpeed [km/h]: Speed in kilometers per hour- ...and more, depending on your test setup
Problem: c2dpyparse: command not found
Solution:
- Make sure you installed the package:
pip install -e . - Try the module approach:
python -m c2dpyparse.cli [your arguments] - Check your
$PATHenvironment variable, or restart your terminal
Problem: ModuleNotFoundError: No module named 'c2dpyparse'
Solution:
- Make sure you're in the correct directory
- Reinstall:
pip uninstall c2dpyparse && pip install -e . - Check if you're using the correct Python environment
Problem: FileNotFoundError when processing .c2d files
Solution:
- Use absolute paths, starting at the top level containing the file:
"C:\full\path\to\file.c2d" - Check that the file exists and is readable
- Make sure the file is actually a
.c2dfile
Problem: Permission denied errors
Solution:
- Make sure you have write permissions to the output directory
- Try running as administrator (Windows) or with
sudo(macOS/Linux) - Choose a different output directory
Problem: Empty or corrupted output files
Solution:
- Check that your .c2d file is valid and not corrupted
- Try with a different .c2d file
- Check the terminal output for error messages
If you encounter issues:
- Check the help:
c2dpyparse --help - Use verbose output: Add error checking to see what's happening
- Try a test file: Start with a known working .c2d file
- Check file paths: Use absolute paths to avoid confusion
-
Navigate to your data directory, e.g.,
cd "C:\Users\YourName\Desktop\WingateData"
-
Create output directory
mkdir results
-
Process the file
c2dpyparse report_Wingate.c2d --output-dir results/
-
Check if the files were created, e.g.,
ls results/
@echo off
for %%f in (*.c2d) do (
c2dpyparse "%%f" --output-dir "results/"
)- Python >= 3.8
- pandas >= 1.5.0
- lxml >= 4.9.0
These are installed automatically when you run pip install -e .
This project is licensed under the European Union Public License (EUPL-1.2). See full license text in English in LICENSES/EUPL-1.2.txt; for other languages, see https://interoperable-europe.ec.europa.eu/collection/eupl/eupl-text-eupl-12.