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).
At the moment, the
spinwave
calculations outputs the spectra as a plain Matlabstruct
which can then be used with the functionssw_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 thefitmode
option is given tospinwave
, then the original spinw object is not included as a field in thestruct
. This causessw_plotspec
(it uses unit labels in the spinw object to plot) andsw_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
. Thesw_
prefix could be retained for backwards compatibility or removed (or aliased).