Skip to main content

A Python package for musculoskeletal modelling (version 0.3.5)

Project description

msk_modelling_python (pre-release)

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

  1. Download a Code Interpreter
    I recommend Visual Studio Code, but use your preferred one.

  2. Download and Install Python (>= 3.8)
    Make sure it is the correct bit version: Python 3.8

  3. Download and Install OpenSim (suggest >=4.3)
    OpenSim Downloads

  4. Install Rapid Env Editor (optional)
    Rapid Env Editor

  5. 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)

Create a 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

import msk_modelling_python as msk
msk.bops.greet()

Install opensim

import msk_modelling_python as msk
msk.install_opensim.run()

Work with the code

  1. Activate your virtual enviroment (assume name 'msk')
    .\msk\Scripts\activate
    

  1. Clone this Module "msk_modelling_python" to your virtual environment
    cd .\msk\Lib\site-packages
    
    git clone https://github.com/basgoncalves/msk_modelling_python.git
    
    Note: Ensure the name of the package is exactly "msk_modelling_python"

  1. Run OpenSim Setup from Installation Folder
    See OpenSim Scripting in Python

    cd 'C:\OpenSim 4.5\sdk\Python'
    
    python setup_win_python38.py
    
    python -m pip install .
    

    Note: run commands from shell or terminal


  1. Add the Path to the OpenSim Libraries to Your Environment Variables
    Add the following paths to your PATH variable:
    C:\OpenSim 4.5\bin
    C:\OpenSim 4.5\lib
    
    Note: see for help https://answers.microsoft.com/en-us/windows/forum/all/change-system-variables-on-windows-11/f172c29e-fd9e-4f0b-949d-c4696bd656b8

  1. Verify the OpenSim Installation.
    python 
    
    import opensim as osim
    model = osim.Model()
    

  1. Install requirements (in the terminal)
    cd .\msk\Lib\site-packages\msk_modelling_python
    pip install -r requirements.txt
    

  1. Testing msk_modelling_python (in python)
    import msk_modelling_python as msk
    msk.run_bops()
    
    Note: to change the performance of msk.run_bops() edit the settings file in .\msk_modelling_python\src\bops\settings.json

  1. Basic Usage
    import msk_modelling_python as msk
    
    # export c3d
    c3d_file_path = r'path\to\your\file.c3d'
    msk.bops.export_c3d(c3d_file_path)
    
    # run IK
    trial = msk.Project
    

  1. 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. Inspired by the MATLAB version of BOPS (Batch OpenSim Processing Scripts) - BOPS

Tools to be Included:


Code Structure

  1. msk_modelling_python This is the main package including all the modules needed for msk modelling, stats, data_processing, etc. This package contains subpackages that can be used independently.

  2. bops Batch Opensim Processing Software
    Package with functions and classes to use Opensim, CEINMS, stats, and others for easier processing.

  3. main


Examples

Find examples under ".\example_data\example_modules".

Workflow Examples: See example_data/workflow_example.py for complete pipeline examples including:

  • OpenSim analysis pipelines (IK -> ID -> SO -> JRA)
  • Batch processing workflows
  • Data processing pipelines

Contact

For any questions or inquiries, please contact:

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.2.1

  • include openSim function with functions to improve opensim management

Version updates 0.3.0

  • include ceinms and other plotting utils

Version: 0.3.5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

msk_modelling_python-0.3.5.tar.gz (372.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

msk_modelling_python-0.3.5-py3-none-any.whl (370.6 kB view details)

Uploaded Python 3

File details

Details for the file msk_modelling_python-0.3.5.tar.gz.

File metadata

  • Download URL: msk_modelling_python-0.3.5.tar.gz
  • Upload date:
  • Size: 372.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for msk_modelling_python-0.3.5.tar.gz
Algorithm Hash digest
SHA256 f6bb600790574dbfbe8868403af94ec3c012a3a56cb6fdfe56bcc199bb8c620e
MD5 f0da072f75edf4130fcc14e7cea12254
BLAKE2b-256 2f442150ac7462dc228edae57e66687bd748f83e48ed76f662d4f660aca75c5f

See more details on using hashes here.

File details

Details for the file msk_modelling_python-0.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for msk_modelling_python-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 22c09c88cbe51c461b29a6010531468bd101892301aa3dabf4b16c00b19ca4e7
MD5 0ec4ffffbf87a64147655240fee74b2a
BLAKE2b-256 dc7c77c3815fe56820c6e16578b0cc5ce4837bb5fef4ead613f9d852b40e99b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page