A Python package for musculoskeletal modelling (version 0.4.0)
Project description
msk_modelling_python v0.4.0
A Python package for musculoskeletal modelling.
Author: Basilio Goncalves, PhD, University of Vienna, 2024 https://ufind.univie.ac.at/de/person.html?id=1004543 https://github.com/basgoncalves
Pre-requisites for Installation
-
Download a Code Interpreter
I recommend Visual Studio Code, but use your preferred one. -
Download and Install Python (>= 3.8)
Make sure it is the correct bit version: Python 3.8 -
Download and Install OpenSim (suggest >=4.3)
OpenSim Downloads -
Install Rapid Env Editor (optional)
Rapid Env Editor -
MOKKA (optional / only Windows users) Open-source and cross-platform software to easily analyze biomechanical data
Pip installation (works for python 3.8)
(for later versions try OpenSim using Conda) https://pypi.org/project/msk-modelling-python/0.4.0/
Activate your Virtual Environment**
cd <your project folder>
python -m venv msk
Note: replace 'msk' if you want a different name
.\msk\Scripts\activate
Install uv package manager
pip install uv
Install msk-modelling-python
uv pip install msk-modelling-python
Test usage
This launches the GUI.
python -m msk_modelling_python
To run in batch mode:
python -m msk_modelling_python -b msk_modelling_python/settings.py
Work with the code
- Activate your virtual enviroment (assume name 'msk')
.\msk\Scripts\activate
- Clone this Module "msk_modelling_python" to your virtual environment
cd .\msk\Lib\site-packages
Note: Ensure the name of the package is exactly "msk_modelling_python"git clone https://github.com/basgoncalves/msk_modelling_python.git
-
Run OpenSim Setup from Installation Folder
See OpenSim Scripting in Pythoncd 'C:\OpenSim 4.5\sdk\Python'
python setup_win_python38.pypython -m pip install .
Note: run commands from shell or terminal
- Add the Path to the OpenSim Libraries to Your Environment Variables
Add the following paths to yourPATHvariable:
Note: see for help https://answers.microsoft.com/en-us/windows/forum/all/change-system-variables-on-windows-11/f172c29e-fd9e-4f0b-949d-c4696bd656b8C:\OpenSim 4.5\bin C:\OpenSim 4.5\lib
- Verify the OpenSim Installation.
python
import opensim as osim model = osim.Model()
- Install requirements (in the terminal)
cd .\msk\Lib\site-packages\msk_modelling_python pip install -r requirements.txt
- Launch msk_modelling_python
python -m msk_modelling_python
Note: to configure batch processing, editmsk_modelling_python\settings.py(seeBatchSettingsandCEINMSSettingsclasses)
-
Basic Usage
GUI mode (default):
python -m msk_modelling_python
Batch mode — configure
msk_modelling_python\settings.pyfirst, then:python -m msk_modelling_python -b msk_modelling_python/settings.py
Key settings to configure in
settings.py:
- Use Example Scripts Use example scripts in the "ExampleScripts" directory to get started with common tasks and workflows.
This package includes a combination of other packages and custom functions to manipulate and analyze biomechanical data. Originally inspired by the MATLAB version of BOPS (Batch OpenSim Processing Scripts) - BOPS
Tools to be Included:
- BTK
BTK Documentation - c3dServer
c3dServer - OpenSim
OpenSim Scripting in Python - 3D Slicer
3D Slicer - FEbioStudio
FEbioStudio - MeshLab 2023.12
MeshLab - Genesis
Genesis
Code Structure
-
msk_modelling_python — main package entry point; run with
python -m msk_modelling_python -
settings.py — central configuration file; edit
BatchSettings,CEINMSSettings,UISettings, andRecordingSettingsclasses to control all pipeline behaviour -
gui/ — PyQt-based graphical interface (launched by default); widgets for batch processing, C3D export, EMG, CEINMS calibration, and results viewing
-
utils/ — core processing functions: OpenSim (IK, ID, SO, MA), CEINMS, EMG normalisation, model scaling, C3D export, and XML helpers
-
core/ — session and analysis runner logic used by both GUI and batch modes
-
config/ — config manager for loading/saving settings
-
record/ — video recording and camera utilities for motion capture sessions
Examples
Launch the GUI for interactive use:
python -m msk_modelling_python
For scripted/batch pipelines, configure msk_modelling_python\settings.py and run:
python -m msk_modelling_python -b msk_modelling_python/settings.py
The pipeline supports: C3D export → model scaling → IK → ID → SO → muscle analysis → CEINMS calibration → CEINMS execution.
Contact
For any questions or inquiries, please contact:
- Name: Basilio Goncalves
- Email: basilio.goncalves@univie.ac.at
- ResearchGate: Basilio Goncalves
References
Thelen, D. G. -2003- J. Biomech. Eng. 125, 70–77
Lloyd, D. G. et al. -2003- J. Biomech. 36, 765–776
Delp, S. L. et al. -2007- IEEE Trans. Biomed. Eng. 54, 1940–1950
Pizzolato, C. et al. -2015- J. Biomech. 48, 3929–3936
Hicks, J. L. et al. -2015- J. Biomech. Eng. 137,
Rajagopal, A. et al. -2016- IEEE Trans. Biomed. Eng. 63, 2068–2079
Goncalves, B. A. M. et al. -2023- Gait Posture 106, S68
Goncalves, B. A. M. et al. -2024- Med. Sci. Sport. Exerc. 56, 402–410
Version updates 0.0.17
- Version bump with new images and path adjustments in classes
Version updates 0.0.20
- Attempted CEINMS2 integration via pip packaging
Version updates 0.3.6
- Updated utils
- Added CEINMS support with troubleshooting functions and executables for hybrid and synergy calibrations
Version updates 0.4.0
- Improved app and batch processing with new settings and GUI entry point
- Cleaned up stale files and moved CEINMS settings
- Added n8n-inspired workflow pipeline system with a complete OpenSim batch processing example and quick-start guide
Version: 0.4.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file msk_modelling_python-0.4.0-py3-none-any.whl.
File metadata
- Download URL: msk_modelling_python-0.4.0-py3-none-any.whl
- Upload date:
- Size: 81.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae7b02a81e8847f3abe54da3a6d3470a4a93550e43504d9b9ac319083333ff52
|
|
| MD5 |
2c5fca2ec2d9e4cef327bf54836d6ceb
|
|
| BLAKE2b-256 |
648367b54bcde6306e00491be503b57146cb0720282f87650a9c3b938dfb980b
|