MuscleParamOptimizer
MuscleParamOptimizer copied to clipboard
[Suggestion] for reducing the time of computation
Hi,
Thanks for providing this great toolbox. Given that this may take ~3 hours for every subject, I have a suggestion to reduce this time by 50%. I see that this function, sampleMuscleQuantities.m is the most time consuming one. Lots of users may use generic models as reference, e.g. modified Rajagopal model in my case. My suggestion is to store the sample muscle quantities of the reference model once forever and use it for each subject.
First, collate the sample quantities of all muscles into one struct using Mus_ref_all.(curr_mus_name) = sampleMuscleQuantities(osimModel_ref,curr_mus,'all',N_eval); instaed of the following line of code and save the Mus_ref_all variable as a MAT file. Then, load the file before the loop and use Mus_ref = Mus_ref_all.(curr_mus_name); instead of:
https://github.com/modenaxe/MuscleParamOptimizer/blob/cd3f134e28745ec22f2f05bc7fca4b456e68e99f/MATLAB_tool/MuscleParOptTool/optimMuscleParams.m#L82
The good point is that this file is readable in Python as well. Here is an example (N_eval=5):
Rajagopal2015_passiveCal_hipAbdMoved.zip
Best - Mohammadreza
that's actually a very good idea, thank you @mrrezaie I'll see if I can implement it in the next update of the scripts.
Thank you. Another suggestion in this regard would be to add an option to optimize the muscles of only one leg, in case of using identical scaled factors for both legs. This will reduce additional 50%!