Closed SilkeSchomann closed 11 months ago
Describe the bug A script generated by MSlice causes an error when executing the Load command.
Load
To Reproduce
Run the following script:
# import mantid algorithms, numpy and matplotlib from mantid.simpleapi import * import matplotlib.pyplot as plt import numpy as np # Python Script Generated by Mslice on 2023-09-12 11:17:56 import mslice.cli as mc import mslice.plotting.pyplot as plt ws_MAR21335_Ei60meV = mc.Load(Filename='C:\\Users\\eoc57742\\MSLICE550\\MAR21335_Ei60meV.nxs', OutputWorkspace='MAR21335_Ei60meV') fig = plt.gcf() fig.clf() ax = fig.add_subplot(111, projection="mslice") cut_ws_0 = mc.Cut(ws_MAR21335_Ei60meV, CutAxis="|Q|,0.0,10.0,0.04", IntegrationAxis="DeltaE,-5.0,5.0,0.0", NormToOne=False, IntensityCorrection=False, SampleTemperature=None) ax.errorbar(cut_ws_0, label="MAR21335_Ei60meV -5.00<E<5.00", color="#1f77b4", marker="o", ls="-", lw=1.5) from mslice.cli.helperfunctions import hide_a_line_and_errorbars, append_visible_handle_and_label from mslice.util.compat import legend_set_draggable # hide lines, errorbars, and legends handles, labels = ax.get_legend_handles_labels() visible_handles = [] visible_labels = [] append_visible_handle_and_label(visible_handles, handles, visible_labels, labels, 0) legend_set_draggable(ax.legend(visible_handles, visible_labels, fontsize='medium'), True) ax.set_title('', fontsize=12.0) ax.set_ylabel(r'Signal/#Events', fontsize=10.0) ax.grid(True, axis='y') ax.grid(True, axis='x') ax.set_ylim(bottom=-18.343584245085168, top=131.56881646472806) ax.set_xlim(left=-0.18399999999999994, right=10.464) ax.bragg(workspace='MAR21335_Ei60meV_cut(-5.000,5.000)', element='Aluminium') mc.Show()
I cannot reproduce this directly, as any script I generate uses / as path separators.
/
Regardless, I've added a small fix which will ensure the filename string is a string literal. This should solve the issue going forward but I can't test directly.
Describe the bug A script generated by MSlice causes an error when executing the
Load
command.To Reproduce
Run the following script: