Page 1 of 1
Sensitivity Analysis Help
Posted: Wed Aug 10, 2016 5:21 am
by alisonrogo
Hello,
I am currently working on creating a sensitivity analysis. My boss wants me to run the parameter changing code that I have created under 2 different for loops. Whenever I run it, my new osim file is not created. Does anyone know how to fix this?
Thanks.
Alison
Re: Sensitivity Analysis Help
Posted: Wed Aug 10, 2016 10:40 am
by jimmy
Alison-
It is hard to tell why when we haven't seen your code (Matlab?). Can you please give us more details...
-James
Re: Sensitivity Analysis Help
Posted: Thu Aug 11, 2016 4:01 am
by alisonrogo
Yes I can!
So what the code is doing is setting up a blank matrix and then goes into three for loops. One goes from one to 100 (the number of itterations I would like), the second goes from 1 to whatever the number of muscles I have is, and the last one goes from 1 to whatever the number of parameters I have is. Inside of these for loops I would like to change the parameters based on an adjustment multiplier and then put these into the blank matrix I created before. Also I would like to create a new .osim file. I have already created the parameter changing code but when I put that code into the for loops I cant seem to get the new parameter variable or a new .osim file. I am really stuck and have no idea why it is doing this.
Re: Sensitivity Analysis Help
Posted: Thu Aug 11, 2016 9:23 am
by jimmy
But how are you trying to print the model? If you are using the OpenSim API through Matlab scripting it should be something like this;
Code: Select all
model = Model() % empty model
model.print('new_model.osim') % print model to working directory with name 'new_model.osim'
Re: Sensitivity Analysis Help
Posted: Thu Aug 11, 2016 9:47 am
by alisonrogo
I am using that print model in order to create a new file, its just when it runs through the loop it doesn't change any of the parameters and it doesn't create the new file at all. I have tried running it in a function and doing it just in the for loop
Re: Sensitivity Analysis Help
Posted: Thu Aug 11, 2016 9:56 am
by jimmy
It is almost certainly a bug in your code. You are either printing the original model, or not updating the model you want to print. You should be following a system similar to the code below (which works);
Code: Select all
import org.opensim.modeling.*
% open a model in memory
model = Model('arm26.osim')
% change the mass of a body
body = model.getBodySet().get(2)
body.setMass(20)
% Print the new model out
model.print('new_arm26.osim')
Re: Sensitivity Analysis Help
Posted: Thu Aug 11, 2016 10:07 am
by alisonrogo
Okay I will certainly try that! Thank you so much!