Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easier wrappers of Matlab callables #30

Open
mducle opened this issue Jun 19, 2024 · 0 comments
Open

Easier wrappers of Matlab callables #30

mducle opened this issue Jun 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@mducle
Copy link
Member

mducle commented Jun 19, 2024

We should have an easier way to wrap Matlab callables ("function handles"). At the moment to use multifit with SpinW, you have to do:

m.assignin('base', 'swobj', swobj)
spinw_sqw = m.evalin('base', '@swobj.horace_sqw')

Likewise, it would be helpful if we can call a Matlab function handle like a Python callable - e.g.

iden = m.str2func('@(x) x')
iden(np.random.rand(3))

(which doesn't work at present).

@mducle mducle added the enhancement New feature or request label Jun 19, 2024
mducle added a commit that referenced this issue Oct 3, 2024
* Overloads the "@" operator to create function handle using:
  "m @ swobj.horace_sqw"
* LHS must be the Matlab object ("m"), and RHS must be a method
* Also allows a Matlab function_handle to be callable in Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant