Page 1 of 1

OpenSim/Python Read/Write TRC Compatibility

Posted: Thu Dec 07, 2023 9:46 am
by emeichenlaub
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!

Re: OpenSim/Python Read/Write TRC Compatibility

Posted: Fri Dec 08, 2023 1:21 pm
by kernalnet
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?

Re: OpenSim/Python Read/Write TRC Compatibility

Posted: Sun Dec 10, 2023 10:12 am
by emeichenlaub
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.

Re: OpenSim/Python Read/Write TRC Compatibility

Posted: Sun Dec 10, 2023 10:42 am
by kernalnet
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