Open mducle opened 7 months ago
I just did a bit of research, and it seems python supports the normal getter/setter approach https://docs.python.org/3/library/functions.html#property . It sounds like a pain to implement if there are 2 additional wrappers required for all the properties in python, and possibly more code to marry the two in the matlab, I will look a bit more later at matlab python binds, I wonder if there is a clever way around (because in the example you provided it seems that every symbol is accessed through a string object).
Thank you for the reply on my original issue report!
Kind regards, Artem
As noted in issue #171 some properties of the Matlab
spinw
class cannot be easily accessed in Python. This is because thespinw
class is has properties which are plainstruct
s and these get converted (copied) to Pythondict
s. Modifying thedict
s in Python does change the original Matlabstruct
s. Moreover,libpymcr
does not seem to support the assignment of a Pythondict
to a Matlabstruct
property - this should be investigated inlibpymcr
.However, as part of the migration to Python, we should have a Python
spinw
class; In order to fix the issue mentioned above, this could initially be a light wrapper around the Matlab class with specificstruct
properties wrapped as Python objects to allow them to be modified from Python.In order to make it easier for users, Python wrappers for all the
sw_*
functions inswfiles
should also be created. Ideally then the user syntax would become something like:(e.g. much closer to the Matlab syntax, without the
m.
prefix)