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

RAL-India workshop bugs #147

Closed
mducle opened this issue Jun 20, 2023 · 3 comments
Closed

RAL-India workshop bugs #147

mducle opened this issue Jun 20, 2023 · 3 comments

Comments

@mducle
Copy link
Member

mducle commented Jun 20, 2023

Bugs discovered during RAL-India workshop on neutron scattering data analysis.

  1. sw_egrid invalid handling of half-polarized mode (Fixed in Test sw_egrid #130)
  2. Segfault when using temporary numpy arrays in spinw definition (see libpymcr#19)
  3. Add ability to specify cell-arrays of equal-lengths vectors from Python (see libpymcr#18)
  4. Need to add call_python mex file to distribution (need CI modifications to compile it for all platforms). This would allow helper functions in Python to be used (e.g. for genmagstr, instead of the the provided gmplanar etc.)
  5. Some Matlab command fails with incorrect nargout in call.m (e.g. m.axis([0,1,0,2])) [a MATLAB:nargoutchk:tooManyOutputs error] (Fixed in libpymcr#20

Other minor bugs identified by users

  1. Issue with using a CIF file: lmo = spinw('LuMnO3.cif'); lmo.gencoupling will give a Symmetry error!. The LuMnO3.cif file is in the tutorials folder

### sw_egrid: invalid handling of half-polarized mode

To reproduce: calculate a spectrum, compute the polarised intensities and then try to plot the half-polarised cross-sections with Pa (a=x,y,z) component:

spec = sw_neutron(spec, 'pol', True, 'uv', ([1,0,0], [0,1,0]))
sw_plotspec(m.sw_egrid(spec, 'component', 'Pz'), 'dE', 0.1)

This gives an error Matrix dimensions must agree. in line 424 of sw_egrid.m - which is due to the incorrect reshaping of the intP property of the input spectra (computed from sw_neutron in line 388 which should be: intP{ii} = reshape(intP{ii},3,nMode,[]);

@RichardWaiteSTFC
Copy link
Collaborator

Just checking - have all of these been fixed by v0.1.5 of libpymcr
pace-neutrons/libpymcr#20

@mducle
Copy link
Member Author

mducle commented Oct 6, 2023

I've just updated the description. The call_python stuff is not in libpymcr-0.1.5 but is needed more for pace-python than for us. Still working on something there (I got it to work but it causes a segfault when you exit Python).

The LuMnO3.cif might be broken but I haven't checked and is not a libpymcr issue...

@mducle
Copy link
Member Author

mducle commented May 20, 2024

  1. Issue with using a CIF file: lmo = spinw('LuMnO3.cif'); lmo.gencoupling will give a Symmetry error!. The LuMnO3.cif file is in the tutorials folder

This is actually just a tolerance issue as the error message suggests. The 'tolDist' default is 1e-3 Angstrom, but the accuracy of the c lattice coordinate of the Mn ion is 1e-4 (it is 0.99923 in the file). If this is changed to 0.99 or 'tolDist' is tightened to 1e-4 then no error occurs.

We'll probably just leave the code as is rather than change the defaults or the cif.


All other issues have been fixed.

@mducle mducle closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants