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

Convert output struct from spinw.spinwave() to a class #184

Open
mducle opened this issue May 13, 2024 · 1 comment
Open

Convert output struct from spinw.spinwave() to a class #184

mducle opened this issue May 13, 2024 · 1 comment
Labels
refactor Code improvements without new features

Comments

@mducle
Copy link
Member

mducle commented May 13, 2024

At the moment, the spinwave calculations outputs the spectra as a plain Matlab struct which can then be used with the functions sw_neutron, sw_egrid, sw_plotspec etc. to rebin and calculate different cross-sections or to plot.

However, the fields of the output struct are not uniform - for example if the fitmode option is given to spinwave, then the original spinw object is not included as a field in the struct. This causes sw_plotspec (it uses unit labels in the spinw object to plot) and sw_egrid (which needs information on the twins) to fail.

A more robust approach would be to convert the current plain struct to a class and to make the various sw_* functions methods of the class. These are: sw_egrid, sw_instrument, sw_magdomain, sw_neutron, sw_omegasum, sw_plotspec, sw_spec2MDHisto, sw_xray. The sw_ prefix could be retained for backwards compatibility or removed (or aliased).

@mducle mducle added the refactor Code improvements without new features label May 13, 2024
@RichardWaiteSTFC
Copy link
Collaborator

Maybe can wait till we migrate to python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code improvements without new features
Projects
None yet
Development

No branches or pull requests

2 participants