opensim-org / opensim-gui

SimTK OpenSim graphical user interface and distribution.
Apache License 2.0
62 stars 33 forks source link

Attempting to plot muscle-tendon length gives "Domain and range sizes are different" #95

Closed chrisdembia closed 7 years ago

chrisdembia commented 7 years ago

I was working on question 7 of tutorial 1 image

and got the following red stop sign exception:

java.lang.UnsupportedOperationException: Domain and range sizes are different119 vs.0. An internal bug.
    at org.opensim.plotter.PlotCurve.<init>(PlotCurve.java:103)
    at org.opensim.plotter.PlotterModel.addCurveSingleRangeName(PlotterModel.java:191)
    at org.opensim.plotter.JPlotterPanel.jPlotterAddCurveButtonActionPerformed(JPlotterPanel.java:1155)
    at org.opensim.plotter.JPlotterPanel.actionPerformed(JPlotterPanel.java:731)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2750)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

The Messages window indicates that the issue was within the AnalyzeTool:

Exception:
  AnalyzeTool.verifyControlsStates: ERROR- Number of states in  doesn't match
  number of states in model Crouch.
  file= C:\Alpha\src\opensim-core\OpenSim\Tools\AnalyzeTool.cpp
  line= 466

Windows 10; 64-bit GUI build.

aymanhab commented 7 years ago

@chrisdembia Where did you get Tutorial 1 so that I can follow the steps and verify a fix? Thanks

chrisdembia commented 7 years ago

Combination of this models directory and this tutorial directory.

aymanhab commented 7 years ago

Thanks @chrisdembia I actually meant the pdf/html file for the tutorial to follow the steps leading to question 7 per your description.

chrisdembia commented 7 years ago

Oops sorry: http://simtk-confluence.stanford.edu:8080/display/OpenSim/Tutorial+1+-+Intro+to+Musculoskeletal+Modeling

aymanhab commented 7 years ago

Traced this down to a function that tries to create a "States" storage based on the motion file. To map quantities between input motion and states, headers need parsing. All this parsing is now incorrect because of renaming coordinates and muscle states/activations. I'd like to keep the function doing minimal work on GUI side. We can modify the input files but then other user motion files will be broken. Would be good to come up with a compromise (maybe utilizing StatesTrajectory as intermediary, is that possible @chrisdembia ?)

chrisdembia commented 7 years ago

Storage::getStateIndex() converts old-style state names to the new names. This is what StatesTrajectory::createFromStatesStorage() uses to allow loading pre-4.0 states files, and this function should also work for motion files as long as you pass allowMissingColumns=true. Does this help? What additional functionality might you need for the StatesTrajectory class?

jenhicks commented 7 years ago

Fixed for me.