From 6e91a9d641398e4dc8200dca1c5f950f554fd3c3 Mon Sep 17 00:00:00 2001 From: Chris Seymour Date: Fri, 4 Feb 2022 14:44:13 +0000 Subject: [PATCH] scaling: ensure mad is at least 1.0 --- bonito/fast5.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bonito/fast5.py b/bonito/fast5.py index d1cd4e36..a4afe44f 100644 --- a/bonito/fast5.py +++ b/bonito/fast5.py @@ -82,7 +82,7 @@ def __init__(self, read, filename, meta=False): if len(scaled) > 8000: med, mad = med_mad(scaled) - self.signal = (scaled - med) / mad + self.signal = (scaled - med) / max(1.0, mad) else: self.signal = norm_by_noisiest_section(scaled)