mantidproject / mslice

Source code for Mantid MSlice
http://mantidproject.github.io/mslice
1 stars 2 forks source link

Crash when importing CIF file on Slice plot #952

Closed robertapplin closed 4 months ago

robertapplin commented 12 months ago

Describe the bug There is a crash when importing a CIF to show a Bragg peak in a Slice plot. Reported by the someone on the Neutron Training Course.

To Reproduce Steps to reproduce the behavior: 1) Open MSlice (Interfaces > Direct > MSlice) 2) Use file browser on data loading tab to load appropriate data (MAR21335_Ei60meV used) 3) Click display on slice sub-tab on Workspace Manager tab. 4) On the toolbar, click Information > Bragg peaks > CIF File. 5) Load the CIF file below. An error happens:

Traceback (most recent call last):
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/plotting/plot_window/overplot_interface.py", line 66, in cif_file_powder_line
    toggle_overplot_line(plot_handler, plotter_presenter, key, recoil,
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/plotting/plot_window/overplot_interface.py", line 35, in toggle_overplot_line
    plotter_presenter.add_overplot_line(plot_handler.ws_name, key, recoil, cif_file, plot_handler.y_log,
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/presenters/slice_plotter_presenter.py", line 101, in add_overplot_line
    x, y = compute_powder_line(workspace_name, cache.momentum_axis, key, cif_file=cif)
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/models/powder/powder_functions.py", line 51, in compute_powder_line
    x0 = _compute_powder_line_momentum(ws_name, axis, element, cif_file)
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/models/powder/powder_functions.py", line 32, in _compute_powder_line_momentum
    structure = _crystal_structure(ws_name, element, cif_file)
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/models/powder/powder_functions.py", line 64, in _crystal_structure
    LoadCIF(Workspace=ws, InputFile=cif_file)
  File "/home/mlc47243/Documents/mantid-development/mslice/src/mslice/util/mantid/algorithm_wrapper.py", line 62, in alg_wrapper
    result = algorithm(*args, **kwargs)
  File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/mantid/simpleapi.py", line 1076, in __call__
    raise RuntimeError(msg) from e
RuntimeError: LoadCIF-v1: Can not create space group from supplied CIF-file. You could try to modify the HM-symbol to contain spaces between the components.

Expected behavior No error. A warning message should be displayed if the CIF file is not valid. If it is valid then it should load.

SilkeSchomann commented 4 months ago

This problem was fixed by the following Mantid PR: https://github.com/mantidproject/mantid/pull/37146