Skip to content
Snippets Groups Projects
Commit 8e0eb8ed authored by payno's avatar payno
Browse files

Merge branch 'fix_noise_exceptions' into 'main'

E0 might be very wrong during online data processing

See merge request !105
parents fe6604ce 5fc91fbf
No related branches found
No related tags found
1 merge request!105E0 might be very wrong during online data processing
Pipeline #84354 passed
...@@ -79,15 +79,17 @@ def process_noise_savgol( ...@@ -79,15 +79,17 @@ def process_noise_savgol(
else: else:
e_max += spectrum.e0 e_max += spectrum.e0
if e_min > e_max:
raise ValueError(f"e min ({e_min}) > e max ({e_max})")
spectrum.larch_dict["noise_e_min"] = e_min spectrum.larch_dict["noise_e_min"] = e_min
spectrum.larch_dict["noise_e_max"] = e_max spectrum.larch_dict["noise_e_max"] = e_max
mask = (spectrum.energy > e_min) & (spectrum.energy < (e_max)) mask = (spectrum.energy > e_min) & (spectrum.energy < (e_max))
spectrum.raw_noise_savgol = numpy.mean(noise[mask])
spectrum.norm_noise_savgol = spectrum.raw_noise_savgol / spectrum.edge_step if mask.any():
spectrum.raw_noise_savgol = numpy.mean(noise[mask])
spectrum.norm_noise_savgol = spectrum.raw_noise_savgol / spectrum.edge_step
else:
# Uses nan's instead of raising an exception. Otherwise we have much more failing workflows online (either E0 is wrong or the scan has not progressed past Emin, which is after the edge so the plots are fine).
spectrum.raw_noise_savgol = numpy.nan
spectrum.norm_noise_savgol = numpy.nan
if callbacks: if callbacks:
for callback in callbacks: for callback in callbacks:
......
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