From 3284447d1c071bb0b3f636ca2f27629739c0a020 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Sat, 19 Aug 2023 14:58:01 +0300 Subject: [PATCH] Fix division by 0 during calibration --- amodem/calib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amodem/calib.py b/amodem/calib.py index be9fee7..a48aa77 100644 --- a/amodem/calib.py +++ b/amodem/calib.py @@ -66,7 +66,7 @@ def detector(config, src, frame_length=200): max_index = np.argmax(coeffs) freq = config.frequencies[max_index] rms = abs(coeffs[max_index]) - coherency = rms / total + coherency = rms / total if total > 0 else 0.0 flags = [total > 0.1, peak < 1.0, coherency > 0.99] success = all(flags)