Access model properties through python API; names of muscles and joints
Posted: Wed Aug 17, 2016 6:45 am
Hi, I am using the Gait2354_simbody.osim model for some work I am trying out.
Through the .osim file I know what the model components are called e.g. the given name of the muscles, through string assignments or bodies:
Now I would like to access these strings through the python API. But I am not sure how to do this. Take the below:
It gets me all the 54 muscles, looping through them one by one, but just returns an object no specific identifier such as "glut_max3_r". How do I get access to these specifically?
Through the .osim file I know what the model components are called e.g. the given name of the muscles, through string assignments or bodies:
Code: Select all
<Body name="femur_r">
<mass>9.3014</mass>
<mass_center> 0 -0.17 0</mass_center>
<inertia_xx>0.1339</inertia_xx>
<inertia_yy>0.0351</inertia_yy>
<inertia_zz>0.1412</inertia_zz>
<inertia_xy>0</inertia_xy>
<inertia_xz>0</inertia_xz>
<inertia_yz>0</inertia_yz>
Code: Select all
# Load model
model = osim.Model("gait2354_simbody.osim")
muscles = model.getMuscles()
muSize = muscles.getSize()
for i in range(muSize):
print muscles.get(i)