Page 1 of 1

GUI scripting plot problem

Posted: Wed Jan 28, 2015 11:47 am
by alessandronavacchia
Hi,
I'm trying to use the GUI python scripting to plot tendon force of a muscle from different models and compare them.
I manage to do it in different plotter panels (one per each model), but when I try to plot every curve in the same panel, it does not work. It plots again the tendon force from the first model I loaded, despite I load a different model.

This is my code:

Code: Select all

mus = "recfem_r"
dof = "knee_angle_r"

# Load first model 
loadModel(modelName)
myModel = getCurrentModel()

plotterPanel = createPlotterPanel(mus+" tendon force VS Knee Angle ")
crv_base = addAnalysisCurve(plotterPanel, "tendon force", mus, dof)
setCurveLegend(crv_base, "baseline")

# Load second model 
loadModel(modelName_2)
myModel = getCurrentModel()

# plotterPanel_2 = createPlotterPanel(mus+" tendon force VS Knee Angle ")
# crv = addAnalysisCurve(plotterPanel_2, "tendon force", mus, dof)
# Instead of generating a new panel, I call the variable of the first panel plotterPanel
crv = addAnalysisCurve(plotterPanel, "tendon force", mus, dof)
setCurveLegend(crv, mus+"_2")
It looks like OpenSim changes the current model when I plot in a panel where I have already plotted a curve from a previous model.
This obviously does not happen when I simply use the GUI and I change current model by double-clicking on the name of the second model.

Any suggestion?

Thanks

Alessandro

Re: GUI scripting plot problem

Posted: Mon Feb 23, 2015 1:40 pm
by jimmy
Hi Alessandro,

Looks like this is a bug in the GUI scripting. Please file a bug/issue at the link below and we will have it fixed for the next release;

https://github.com/opensim-org/opensim-core/issues

In the mean time you may just have to generate the plots on separate figures and export the data to file.

Thanks,
-james