mantidproject / mslice

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

New step size warning shows spuriously #912

Closed MialLewis closed 1 year ago

MialLewis commented 1 year ago

Describe the bug The new step size warning tends to come up on most occasions when running scripts - I guess there's some rounding issues.

WARNING:root:The |Q| step provided (0.0467) is smaller than the data step in the workspace (0.0467). Please provide a larger |Q| step. Also, this warning is shown as an error.

To Reproduce Run this script from the mantid script editor. changing the file paths:

# Python Script Generated by Mslice on 2023-05-17 16:56:25
import mslice.cli as mc
import mslice.plotting.pyplot as plt

ws_MAR21335_Ei60meV = mc.Load(Filename='C:/Users/wym92549/Downloads/mslice data\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|,-5.0,5.0,0.04671", IntegrationAxis="DeltaE,0.0,10.0,0.0", NormToOne=False, IntensityCorrection=False, SampleTemperature=None)
ax.errorbar(cut_ws_0, label="MAR21335_Ei60meV 0.00<E<10.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.set_ylim(bottom=-10.039915777534894, top=212.87182783248542)
ax.set_xlim(left=0.07009345794392507, right=5.210280373831775)
mc.Show()

Expected behavior Warning does not show when the cut step size is almost equal to the bin width size. If warning does show, do not show as error in workbench.

Screenshots If applicable/possible, add screenshots to help explain your problem.

MSlice Version (please complete the following information):

Additional context Add any other context about the problem here.