Scale Tool Error in Python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Aaron Henry
Posts: 32
Joined: Tue Dec 03, 2019 8:47 am

Scale Tool Error in Python

Post by Aaron Henry » Wed Jun 30, 2021 12:07 pm

Hello,
I am attempting to run the scale tool through python so I can scale a generic model to multiple different subjects and run batch IK. I have set up the XML file with what I believe to be the correct file paths for the generic model maker, model scaler, and marker placer. However, when I try to use the scaletool.run() command I receive a 'No model specified' error. Where else would I specify the model if I have already filled in the model file path for each of three main sections of the scale tool? I have attached my xml file for reference.
Attachments
ScaleSettingsCombinedSinglePelvis.xml
(138.1 KiB) Downloaded 22 times

Tags:

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: Scale Tool Error in Python

Post by Thomas Uchida » Thu Jul 01, 2021 5:19 am

I would first try moving all files to the same directory to confirm that everything runs properly. Next, you might try being consistent with whether you use "\" or "/" in the paths (you are currently switching halfway through the string). Finally, it's possible that OpenSim doesn't have access to the directory for some reason; you could try running in Admin mode to investigate.

User avatar
Aaron Henry
Posts: 32
Joined: Tue Dec 03, 2019 8:47 am

Re: Scale Tool Error in Python

Post by Aaron Henry » Thu Jul 01, 2021 6:50 am

Hi Thomas,
Thanks for your reply. I have moved everything to the same folder and have been able to load and edit the different files using the API. I have also changed my paths to consistently use "/" and even moved all files off of the google drive and onto my desktop in case there was an issue accessing cloud files. I am still running into the No model specified error even after running Spyder as an administrator. Is there another way of running in Admin mode to check for errors? Additionally, I have been able to successfully run the scale tool (both from the cloud and my desktop) through the GUI with the respective XML files. Any other insight would be appreciated.
Thanks,
Aaron

User avatar
Aaron Henry
Posts: 32
Joined: Tue Dec 03, 2019 8:47 am

Re: Scale Tool Error in Python

Post by Aaron Henry » Thu Jul 01, 2021 7:28 am

I removed all of the file paths to each of the individual files and was able to get the scale tool to at least run. It does not appear that a new scaled model file or additional scale related files are written, but I think this solved my original issue.

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

Re: Scale Tool Error in Python

Post by Ayman Habib » Fri Jul 02, 2021 9:51 am

Hi Aaron,

While we can't test your setup file as is, since we don't have access to your model & marker files, the names/paths of the files appear to be too long and contain spaces which could be problematic (it's good that you removed the mix of forward/backward slashes as some back slashes could be misinterpreted as escape characters, recommend staying with forward slashes exclusively). There're flags that control the writing of files e.g.

Code: Select all

scaleTool.setPrintResultFiles(true)
that are not exposed as properties but are available to the API.

Please let us know if that works for you,
-Ayman

User avatar
Aaron Henry
Posts: 32
Joined: Tue Dec 03, 2019 8:47 am

Re: Scale Tool Error in Python

Post by Aaron Henry » Tue Jul 06, 2021 5:26 am

Hi Ayman,
I solved my issue by removing the full file path to each file (.xml,.osim,.trc,etc.) and only including the sub folder. In other words I cut out the 'C:\Users\User' in each file path and only used the subfolders that were part of the Python directory I was working in already.

POST REPLY