Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
-
Mohammadreza Rezaie
- Posts: 407
- Joined: Fri Nov 24, 2017 12:48 am
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.
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:
-
Najoua Assila
- Posts: 34
- Joined: Thu Aug 30, 2018 9:24 am
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
-
Mohammadreza Rezaie
- Posts: 407
- Joined: Fri Nov 24, 2017 12:48 am
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