Page 1 of 1

TimeSeriesTable to Storage

Posted: Sun Sep 19, 2021 5:11 am
by kernalnet
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

Re: TimeSeriesTable to Storage

Posted: Sun Sep 19, 2021 8:55 am
by tkuchida
Please see the STOFileAdapter::write() method (https://simtk.org/api_docs/opensim/api_ ... ter__.html) and the examples that are listed.

Re: TimeSeriesTable to Storage

Posted: Sun Sep 19, 2021 11:42 pm
by nassila
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

Re: TimeSeriesTable to Storage

Posted: Mon Sep 20, 2021 12:36 am
by kernalnet
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