I am working with a model that performs a one-legged squat. It worked well when I was using AnyBody version 7, but after upgrading to version 8, I have encountered a problem when saving my results.
The model loads and runs the simulation without any issues, and it saves data into the H5 file. However, when I open the file, I notice that the Main.Studies.MainStudy.Output.Model data is not saved.
Here is the part of my script responsible for saving the data:
// Define the simulation sequence and save the .h5 using the patient name
AnyOperationMacro SimulationSequence = {
MacroStr={
"operation Main.Studies.CalibrationStudy.Kinematics",
"run",
"operation Main.Studies.MainStudy.InverseDynamics",
"run",
"classoperation Main.Studies.MainStudy.Output" + strquote("Save data") + " --file=" + strquote(Main.SetSpecs.GeneralAnalysisSpecs.OutputFileName) + " --type=Deep"
};
}; // end SimulationSequence
Could anybody help me with this problem? Do I need to provide more information?
I think I can certainly help you. Stuff are only saved a single time in the HDF5 files even though AnyBody has multiple references (or paths) to the same object.
I version AnyBody 7 this meant that the things could suddenly be stored in different places if the model was restructured.
This is what hit you when using AnyBody 8. Now data is always stored in the same way - although different from version 7. Your data is still there just stored on a different path.
solutuion 1:
If you use Python to open the HDF5 files, then a quick workaround is to use the AnyPyTools library. It has a wrapper for the h5py library which handles the problem for you. So instead of
import h5py
do
import anypytools.h5py_wrapper as h5py
Then you can load the data without thinking about where it is located in the hdf5 file. It also allows you to use the AnyBody names with dots (e.g. Main.MyStudy.Output.Model) instead of the hdf5 way with slashes (i.e. Main/MyStudy/Output/Model)