GUI scripting plot problem

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Alessandro Navacchia
Posts: 7
Joined: Wed Sep 11, 2013 2:11 pm

GUI scripting plot problem

Post by Alessandro Navacchia » Wed Jan 28, 2015 11:47 am

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: GUI scripting plot problem

Post by jimmy d » Mon Feb 23, 2015 1:40 pm

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

POST REPLY