Skip to content
Snippets Groups Projects
Commit d315fcd4 authored by Kendrick, Coleman's avatar Kendrick, Coleman
Browse files

Changed region check to use exception

parent e684e294
No related branches found
No related tags found
No related merge requests found
......@@ -501,11 +501,9 @@ def plot_peakd(wksp: Union[str, Workspace2D], peak_positions, plot_regions=True,
dend = single.yIndexOfX(int(x.searchsorted(drange[1])))
print("Specified ending detector range was not valid, adjusted to detID={}".format(dend))
if dstart <= dend:
cut_id = (dstart, dend)
else:
# Switch range if the start point is larger
cut_id = (dend, dstart)
if dstart >= dend:
raise RuntimeError("Detector start region ({}) must be less than the end region ({})".format(dstart, dend))
cut_id = (dstart, dend)
# skip if y was entirely nans or detector slice yields empty region
if len(y_val) == 0 or len(y_val[cut_id[0]:cut_id[1]]) == 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment