You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As noted in issue #171 some properties of the Matlab spinw class cannot be easily accessed in Python. This is because the spinw class is has properties which are plain structs and these get converted (copied) to Python dicts. Modifying the dicts in Python does change the original Matlab structs. Moreover, libpymcr does not seem to support the assignment of a Python dict to a Matlab struct property - this should be investigated in libpymcr.
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 specific struct 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 in swfiles should also be created. Ideally then the user syntax would become something like:
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!
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)The text was updated successfully, but these errors were encountered: