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
Sensitivity Analysis Help
Re: Sensitivity Analysis Help
Alison-
It is hard to tell why when we haven't seen your code (Matlab?). Can you please give us more details...
-James
It is hard to tell why when we haven't seen your code (Matlab?). Can you please give us more details...
-James
- Alison Rogozinski
- Posts: 14
- Joined: Tue Jun 07, 2016 7:44 am
Re: Sensitivity Analysis Help
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.
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
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'
- Alison Rogozinski
- Posts: 14
- Joined: Tue Jun 07, 2016 7:44 am
Re: Sensitivity Analysis Help
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
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')
- Alison Rogozinski
- Posts: 14
- Joined: Tue Jun 07, 2016 7:44 am
Re: Sensitivity Analysis Help
Okay I will certainly try that! Thank you so much!