Commit c8a50d1a authored by Neil Vaytet's avatar Neil Vaytet
Browse files

break out of loop is mpd is too small

parent 71b22409
......@@ -397,7 +397,10 @@ def get_wfm_windows(data=None, filename=None, nwindows=6, bg_threshold=1.0e-4,
# Try to reduce the minimum peak distance if there are too few peaks
if (len(good_peaks)-2) < (nwindows - 1):
print("Not enough peaks found. Reducing the minimal peak distance")
mpd *= 0.75
mpd = int(0.75 * mpd)
if mpd < 1:
print("The peak detection has failed with too few or too many peaks")
loop = False
# Now for each valley, iterate to one side starting from the valley center and
# find the window edge. We start from the first valley, which is the second
......@@ -471,9 +474,10 @@ def get_wfm_windows(data=None, filename=None, nwindows=6, bg_threshold=1.0e-4,
output_format = output_format.lower() # convert to lowercase
output = []
if output_format.startswith("rebin"):
rebin_step = output_format.split(":")[1]
# If we want output in Rebin format, then construct the array of strings
for i in range(len(ledges)):
output.append("{},{},{}".format(x[ledges[i]],rebin_step_for_string_output,x[redges[i]]))
output.append("{},{},{}".format(x[ledges[i]],rebin_step,x[redges[i]]))
elif output_format == "tof":
# Return the tofs as float
for i in range(len(ledges)):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment