Page 1 of 1
'methodsview' in Python
Posted: Sun Sep 15, 2019 5:27 pm
by aafox
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
Re: 'methodsview' in Python
Posted: Mon Sep 16, 2019 1:10 am
by mitkof6
Hi,
Depending on the editor that you use, you can have completion in Python that gives you a list of available functions.
Regards
Re: 'methodsview' in Python
Posted: Mon Sep 16, 2019 4:30 am
by aafox
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
Re: 'methodsview' in Python
Posted: Mon Sep 16, 2019 9:18 am
by mitkof6
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.