'methodsview' in Python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Aaron Fox
Posts: 291
Joined: Sun Aug 06, 2017 10:54 pm

'methodsview' in Python

Post by Aaron Fox » Sun Sep 15, 2019 5:27 pm

Hi All,

I've been using Python for a project with OpenSim and am wondering if there is a command for looking up all available commands for a class within the shell. In Matlab this can be achieved with methodsview and the class - is there an equivalent for Python?

Thanks,

Aaron

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: 'methodsview' in Python

Post by Dimitar Stanev » Mon Sep 16, 2019 1:10 am

Hi,

Depending on the editor that you use, you can have completion in Python that gives you a list of available functions.

Regards

User avatar
Aaron Fox
Posts: 291
Joined: Sun Aug 06, 2017 10:54 pm

Re: 'methodsview' in Python

Post by Aaron Fox » Mon Sep 16, 2019 4:30 am

Hi Dimitar,

I'm using Spyder IDE.

I've noticed this auto-complete come up every now and then, but it seems to be sporadic/inconsistent. It also seems to only work to one level - i.e. it will give me the initial options for something like opensim.
  • ; but then won't do so when linking them together like opensim.Model('modelname.osim').[won't list options here]. It also lacks a little bit in comparison to the methodsview in that when run in Matlab this would give you the options plus the argument inputs/various options for argument inputs across the commands - is there any solution for this that you know of or would other editors be more effective with this?

    Thanks,

    Aaron

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: 'methodsview' in Python

Post by Dimitar Stanev » Mon Sep 16, 2019 9:18 am

Yes, if you need a second level completion you have to get the object first e.g.:

Code: Select all

model = opensim.Model()
model.[compeltion]
you can do something like this in ipython:

Code: Select all

model.getCoordinateSet? [enter]
help('model.getCoordinateSet')
but as the bindings are auto-generated they lack comprehensive documentation, therefore you need to revisit the C++ doxygen.

POST REPLY