Hi!
I tried to force python script from here (https://simtk-confluence.stanford.edu:8 ... c3d)+Files) to work with no success.
Fixed some minor bugs (here - https://github.com/IISCI/c3d_2_sto), but stuck on markers.flatten() method of AbstractDataTable, it is not implemented in that class.
Any suggestions?
Python c3d to STO force and markers conversion
- GEORGIY TOKUNOV
- Posts: 6
- Joined: Fri Feb 15, 2019 11:59 am
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Python c3d to STO force and markers conversion
I haven't tried your script, but maybe you can get a copy of the immutable data structure (e.g., import copy, copy.copy(table['markers'])).
- GEORGIY TOKUNOV
- Posts: 6
- Joined: Fri Feb 15, 2019 11:59 am
Re: Python c3d to STO force and markers conversion
Thanks for the advice, but we found a solution.
It seems that in the original script from https://simtk-confluence.stanford.edu:8 ... d%29+Files) used the wrong method for file read - fileRead(), taken from the parent class FileAdapter, it should be replaced with read() method from C3DFileAdpter class as follows:
import opensim as osim
# WRONG:
# tables = C3DFileAdapter.readFile(os.path.join(test_dir, 'walking2.c3d'), 1)
# CORRECT:
tables = osim.C3DFileAdapter().read(os.path.join(test_dir, 'walking2.c3d'), 1)
Fixed all errors now, and c3d were successfully imported to two separate .sto files (forces and markers)
Resulting code in my repo:
https://github.com/IISCI/c3d_2_sto
It seems that in the original script from https://simtk-confluence.stanford.edu:8 ... d%29+Files) used the wrong method for file read - fileRead(), taken from the parent class FileAdapter, it should be replaced with read() method from C3DFileAdpter class as follows:
import opensim as osim
# WRONG:
# tables = C3DFileAdapter.readFile(os.path.join(test_dir, 'walking2.c3d'), 1)
# CORRECT:
tables = osim.C3DFileAdapter().read(os.path.join(test_dir, 'walking2.c3d'), 1)
Fixed all errors now, and c3d were successfully imported to two separate .sto files (forces and markers)
Resulting code in my repo:
https://github.com/IISCI/c3d_2_sto