Flatten Issue in Python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Catherine Scarbrough
Posts: 9
Joined: Mon Aug 17, 2020 4:13 pm

Flatten Issue in Python

Post by Catherine Scarbrough » Mon Aug 24, 2020 1:21 pm

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:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Flatten Issue in Python

Post by Dimitar Stanev » Tue Aug 25, 2020 12:58 am

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:

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')
I think you have to use TimeSeriesTableVec3 instead of AbstractDataTable to avoid the flatten error.

POST REPLY