Skip to content

Commit

Permalink
Catching divide by 0 error before it errors. (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkehoe committed Dec 21, 2023
1 parent 31c0fa5 commit ae1add8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion act/qc/radiometer_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ def fft_shading_test_process(
# Calculates to the left/right of each peak
peak_l = max(fftv[range(sind, index[0])])
peak_r = max(fftv[range(index[-1], eind)])
ratio.append(peak / np.mean([peak_l, peak_r]))
mean_value = np.mean([peak_l, peak_r])
if mean_value == 0.0:
ratio.append(np.nan)
else:
ratio.append(peak / mean_value)

# Checks ratios against thresholds for each freq range
shading = 0
Expand Down

0 comments on commit ae1add8

Please sign in to comment.