Plugin Scripting with plotter

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Anthony Santago
Posts: 15
Joined: Mon Feb 15, 2010 11:33 am

Plugin Scripting with plotter

Post by Anthony Santago » Mon Dec 15, 2014 3:53 pm

I'm attempting export moment vs task data directly from the plotter based on a motion file that I importing. However, when I plot (addMotionSource) in the python scripting I only get from 0 - 1sec of the entire motion (see figure 45). When I use the plot drop down menu to perform the same action I am able to get the full motion (see figure 46). I attempted to extend the axis of figure 45 to contain the full motion thinking that it may be an axis problem. However, when I did that it is obvious that its only plotting the first 1 sec (figure 47)
Figure45.png
Figure45
Figure45.png (10 KiB) Viewed 717 times
Figure46.png
Figure46
Figure47.png
Figure47
Figure47.png (9.89 KiB) Viewed 717 times
I read through the plugin scripting examples and none of the examples give any indication that this could be a problem.

How do I get it to plot the full motion?

Code: Select all

for i in range (0,1): #len(subjects)):
	for t in range (0,1): #len(tasks)):
		
		plotterPanelShlElv = createPlotterPanel(subjects[i]+' '+tasks[t]+ ' Shoulder Elevation');
		motionfilePath = 'C:/Users/acsantag/Desktop/Strength_threshold_analysis/filtered young adult data/filtered_'+subjects[i]+'_'+tasks[t]+'_IK_results.mot';
		print(motionfilePath);

		motSrc = addMotionSource(plotterPanelShlElv,motionfilePath);
                crv0 = addMotionCurve(plotterPanelShlElv,'moment.shoulder_elv',muscle[0],motSrc);

User avatar
Anthony Santago
Posts: 15
Joined: Mon Feb 15, 2010 11:33 am

Re: Plugin Scripting with plotter

Post by Anthony Santago » Fri Jan 09, 2015 8:19 am

I updated the "BothLegsWalk.mot" to include one extra time point at 1.02 seconds and changed the number of rows to 52 instead of 51. I then doubled checked my problem against the "plotMuscleMomentArmAgainstMotion.py" that comes with the OpenSim download, to ensure that I was coding things correctly, and it does not plot past 1 either.

When I play the motion using bar at the Top of the GUI it plays to 1.02secs so I know that OpenSim is reading in the everything from the motion file.

User avatar
Ayman Habib
Posts: 2236
Joined: Fri Apr 01, 2005 12:24 pm

Re: Plugin Scripting with plotter

Post by Ayman Habib » Fri Jan 09, 2015 1:34 pm

Hi Anthony,

There're methods
setMaxX(), setMinX()
that you can invoke to change the default domain bounds of the plot window.

Please let me know if that works for you.

Best regards,
-Ayman

User avatar
Anthony Santago
Posts: 15
Joined: Mon Feb 15, 2010 11:33 am

Re: Plugin Scripting with plotter

Post by Anthony Santago » Tue Jan 13, 2015 7:01 am

Ayman,

Thank you for the information. The setMaxX functionality worked perfectly. Interestingly, as long as the value that is sent to setMaxX is greater than the maximum motion time, the plotter will default to the maximum time from the motion.

Thank you again for your help.
Anthony

User avatar
Anthony Santago
Posts: 15
Joined: Mon Feb 15, 2010 11:33 am

Re: Plugin Scripting with plotter

Post by Anthony Santago » Tue Jan 13, 2015 7:31 pm

Based on some testing with the python plotter scripting interface using the addMotionCurve I am able to access the following information:

Moment Arm: addMotionCurve(plotterPanel, 'momentArm.elv_Angle', muscle[0], motSrc);
Moment: addMotionCurve(plotterPanel, 'moment.elv_Angle', muscle[0], motSrc);
Muscle-Tendon Length: addMotionCurve(plotterPanel, 'Length', muscle[0], motSrc);

However I am unclear nor can find in the doxygen or scripting help how to access the following muscle related properties that I am capable of accessing through the plotter GUI interface.
active Fiber Force
passive Fiber Force
fiber length: neither 'fiber-length' or 'fiberLength' work
tendon length

Could you point me to a link or page on the confluence that describes the muscle properties that I can access via the python plotter scripting interface.

Thank you,
Anthony Santago

User avatar
Colton Sauer
Posts: 10
Joined: Tue May 05, 2015 12:18 pm

Re: Plugin Scripting with plotter

Post by Colton Sauer » Mon Jun 29, 2015 10:38 am

Anthony,

I had a similar problem. The fiber length of the muscle can be accessed using "FiberLength". I tried some of the other variables you were having issues with as well. It seems that if you capitalize the first letter of each word and remove all spaces from the GUI variable names, then you can access the data using addMotionCurve.

Colton

User avatar
Colton Sauer
Posts: 10
Joined: Tue May 05, 2015 12:18 pm

Re: Plugin Scripting with plotter

Post by Colton Sauer » Mon Jun 29, 2015 10:59 am

This is the link with the variables you can plot:
https://simtk.org/api_docs/opensim/gui_ ... otter.html

POST REPLY