OpenSim/Python Read/Write TRC Compatibility

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Emily Eichenlaub
Posts: 2
Joined: Fri Oct 15, 2021 10:37 am

OpenSim/Python Read/Write TRC Compatibility

Post by Emily Eichenlaub » Thu Dec 07, 2023 9:46 am

I am in the process of creating a Python pipeline to batch process and analyze data. I convert my marker data from .c3d to .trc. When I preview my experimental data in OpenSim, my markers are incorrect. However, if I manually open the .trc file, save it, and then reload it in OpenSim, they are in correct locations. Is there a solution to this incompatibility without manually opening and saving .trc files for each trial? Thank you in advance!

Tags:

User avatar
Mohammadreza Rezaie
Posts: 378
Joined: Fri Nov 24, 2017 12:48 am

Re: OpenSim/Python Read/Write TRC Compatibility

Post by Mohammadreza Rezaie » Fri Dec 08, 2023 1:21 pm

When I preview my experimental data in OpenSim, my markers are incorrect. However, if I manually open the .trc file, save it, and then reload it in OpenSim, they are in correct locations.
Hi, could you please elaborate the incompatibility? In which software do you open the TRC file?

Are you using C3DFileAdapter and TRCFileAdapter classes?

User avatar
Emily Eichenlaub
Posts: 2
Joined: Fri Oct 15, 2021 10:37 am

Re: OpenSim/Python Read/Write TRC Compatibility

Post by Emily Eichenlaub » Sun Dec 10, 2023 10:12 am

Hello, thank you for your response. I am working with OpenSim 4.4, so I am trying to work with ezc3d, as recommended by OpenSim.

User avatar
Mohammadreza Rezaie
Posts: 378
Joined: Fri Nov 24, 2017 12:48 am

Re: OpenSim/Python Read/Write TRC Compatibility

Post by Mohammadreza Rezaie » Sun Dec 10, 2023 10:42 am

The issue might be related to the way you write TRC files. If you share this part of your code, troubleshooting would be much easier. Something may be wrong with the headers or delimiters, for example.

OpenSim uses EZC3D internally via C3DFileAdapter. Also TRCFileAdapter and STOFileAdapter classes can be used for writing data (markers, GRF, and EMG) to TRC and MOT/STO files, respectively. They really make things easier. Here you can find some examples on how to use them: https://github.com/opensim-org/opensim- ... Adapter.py

POST REPLY