TimeSeriesTable to Storage

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mohammadreza Rezaie
Posts: 407
Joined: Fri Nov 24, 2017 12:48 am

TimeSeriesTable to Storage

Post by Mohammadreza Rezaie » Sun Sep 19, 2021 5:11 am

Hi,

I have a TimeSeriesTable made after flattening the TimeSeriesTableVec3 (C3DFileAdapter). Is there any straightforward way to convert it to Storage? I see there is OpenSim::Storage::exportToTable method but there is not vice versa.

Code: Select all

osim.Storage.safeDownCast()
This method doesn't work in this situation and this error appears:

TypeError: in method 'Storage_safeDownCast', argument 1 of type 'OpenSim::Object *'

Any help is much appreciated.

Regards,
Mohammadreza

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: TimeSeriesTable to Storage

Post by Thomas Uchida » Sun Sep 19, 2021 8:55 am

Please see the STOFileAdapter::write() method (https://simtk.org/api_docs/opensim/api_ ... ter__.html) and the examples that are listed.

User avatar
Najoua Assila
Posts: 34
Joined: Thu Aug 30, 2018 9:24 am

Re: TimeSeriesTable to Storage

Post by Najoua Assila » Sun Sep 19, 2021 11:42 pm

Hi,

I see you are using python. So, you can start by adding the storage file info such as the column or row number using

Code: Select all

new_table.addTableMetaDataString()
supposing new_table is the TimeSeriesTable you created. Then, you can save it as a storage file output_file using:

Code: Select all

adapter = osim.STOFileAdapter()
adapter.write(new_table, output_file)
Hope it helps,

Najoua

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

Re: TimeSeriesTable to Storage

Post by Mohammadreza Rezaie » Mon Sep 20, 2021 12:36 am

Dear Dr. Uchida and Dr. Assila

Thanks for the reply. The reason I intended to convert TimeSeriesTable to Storage was more operations supported by Storage (filter, interpolate). I saw Moco (v. 0.4.0) had this function (convertTableToStorage) but I couldn't find it in the OpenSim API.

I found OpenSim::TableUtilities and It seems that it contains similar functions for TimeSeriesTable. So, there is no need to convert it to Storage.

Apologies for the misunderstanding.

All the Best,
Mohammadreza

POST REPLY