rcnl-org / nmsm-core

Neuromusculoskeletal Modeling (NMSM) Pipeline codebase
https://nmsm.rice.edu
Other
15 stars 3 forks source link

[BUG] JMP Incorrect Number of Parameters for Y-axis Marker Movement #232

Closed bfregly closed 1 year ago

bfregly commented 1 year ago

Describe the bug When I run JMP with Y axis marker motion turned on (I am calibrating an ankle joint and tried scaling the tibia body), the initial number of function evaluations reported by the optimizer increased from 11 (when no Y axis marker motion is selected for the tibia) to 16. The difference is 5, but I added only 3 new variables (Y axis movement for the 3 tibia markers). It seems that JMP is changing 2 additional parameter values somewhere that it shouldn’t be changing.

To Reproduce

  1. Run JMP using settings file JMPRAnkleSettingsv3.1.xml, which does not have tibia Y axis marker movement turned on. As shown in file "JMP Convergence 3.1.txt", the initial value of the cost function (Resnorm) is 0.705857 and the initial Func-count is 11.
  2. Run JMP again using settings file JMPRAnkleSettingsv3.3.xml, which is identical to JMPRAnkleSettingsv3.1.xml except that tibia Y axis marker movement has been added. As shown in file "JMP Convergence 3.3.txt", the initial value of the cost function (Resnorm) is still 0.705857 but the initial Func-count is now 16. I expected it to be 11+3 = 14.

Expected behavior I expected 14, rather than 16, function evaluations for each optimization iteration when I added 3 variables (3 Y-axis marker translations) to the problem formulation.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here. YAxisMarkerBug.zip

cvhammond commented 1 year ago

There are 5 new functions because there are 5 markers whose parent is 'tibia_r'. If you open the model file in OpenSim and click on a marker in the left menu, the last item in the bottom left 'stats' section lists the parent frame. Each of: [R_Shank_Superior, R_Shank_Inferior, R_Shank_Lateral, R_Ankle_Lateral, R_Ankle_Medial] have tibia_r listed as their parent.

Screenshot from 2023-07-04 23-02-32

cvhammond commented 1 year ago

I believe the reason you think there should only be three cost terms is because the ankle markers aren't in the .trc file you included. We don't currently look in the .trc file to see which markers are contained in it when making a list of markers to move. We could technically do that, although it would not be easy to implement. The other option is to tell the user that they need to use the tool with a properly prepared model. Or... we just leave it and those two ankle markers don't affect the cost fn at all since they are not in the .trc file. Those two cost terms will be ignored.

In my opinion, this issue indicates a user error for including superfluous markers.