diff --git a/lib/bs.py b/lib/bs.py index 1490a41..1cf1ede 100644 --- a/lib/bs.py +++ b/lib/bs.py @@ -3,7 +3,8 @@ from . import blocks, convolve_each, gen_filters, cascades, bq_run, toLK import numpy as np import matplotlib.pyplot as plt -def BS1770_3(s, srate, filters=None, window=0.4, overlap=0.75, gate=10, absolute_gate=70, detail=False): +def BS1770_3(s, srate, filters=None, window=0.4, overlap=0.75, + gate=10, absolute_gate=70, detail=False): if filters is None: filters = gen_filters(cascades['1770'], srate) @@ -22,12 +23,11 @@ def BS1770_3(s, srate, filters=None, window=0.4, overlap=0.75, gate=10, absolute ]) LKs = toLK(means) - truths = LKs > -absolute_gate - LKs_g70 = LKs[truths] - means_g70 = means[truths] + gated = LKs > -absolute_gate + means_g70 = means[gated] avg_g70 = np.average(means_g70) threshold = toLK(avg_g70) - gate - means_g10 = means[LKs_g70 > threshold] + means_g10 = means[gated | (LKs > threshold)] avg_g10 = np.average(means_g10) if detail is False: diff --git a/lib/planes.py b/lib/planes.py index 9a212bd..343e698 100644 --- a/lib/planes.py +++ b/lib/planes.py @@ -1,7 +1,6 @@ from . import tau import numpy as np -import sympy as sym # implements the modified bilinear transform: # s <- 1/tan(w0/2)*(1 - z^-1)/(1 + z^-1) @@ -22,6 +21,7 @@ def zcgen_py(n, d): return zcs def zcgen_sym(n, d): + import sympy as sym z = sym.symbols('z') expr = sym.expand((1 - z**-1)**n*(1 + z**-1)**(d - n)) coeffs = expr.equals(1) and [1] or expr.as_poly().all_coeffs()