update 32

This commit is contained in:
Connor Olding 2017-09-07 04:04:26 -07:00
parent 28d51b685c
commit c678fe4512
2 changed files with 6 additions and 6 deletions

View File

@ -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:

View File

@ -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()