Flatten Issue in Python
- Catherine Scarbrough
- Posts: 9
- Joined: Mon Aug 17, 2020 4:13 pm
Flatten Issue in Python
For the python code, what are the specifications that need to be included in the markers and forces section of the code? The error that I am receiving is "'AbstractDataTable' object has no attribute 'flatten'". Not sure where to go from here.
Tags:
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Flatten Issue in Python
Hi Catherine,
I am not sure if I understood your question properly. If you want to create the marker trajectory file (.trc) manually you can follow the code example below:
I think you have to use TimeSeriesTableVec3 instead of AbstractDataTable to avoid the flatten error.
I am not sure if I understood your question properly. If you want to create the marker trajectory file (.trc) manually you can follow the code example below:
Code: Select all
import opensim
# create table
table = opensim.TimeSeriesTableVec3()
table.addTableMetaDataString('DataRate', str(60)) # must read the frame rate
table.addTableMetaDataString('Units', 'mm') # use mm
table.setColumnLabels(('RASIS', 'PASIS')) # set the name of the markers
row1 = opensim.RowVectorVec3([opensim.Vec3(1, 2, 3),
opensim.Vec3(4, 5, 6)])
table.appendRow(0.1, row1) # 0.1 is time
adapter = opensim.TRCFileAdapter()
adapter.write(table, 'test.trc')