update 32
This commit is contained in:
parent
28d51b685c
commit
c678fe4512
2 changed files with 6 additions and 6 deletions
10
lib/bs.py
10
lib/bs.py
|
@ -3,7 +3,8 @@ from . import blocks, convolve_each, gen_filters, cascades, bq_run, toLK
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
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:
|
if filters is None:
|
||||||
filters = gen_filters(cascades['1770'], srate)
|
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)
|
LKs = toLK(means)
|
||||||
|
|
||||||
truths = LKs > -absolute_gate
|
gated = LKs > -absolute_gate
|
||||||
LKs_g70 = LKs[truths]
|
means_g70 = means[gated]
|
||||||
means_g70 = means[truths]
|
|
||||||
avg_g70 = np.average(means_g70)
|
avg_g70 = np.average(means_g70)
|
||||||
threshold = toLK(avg_g70) - gate
|
threshold = toLK(avg_g70) - gate
|
||||||
means_g10 = means[LKs_g70 > threshold]
|
means_g10 = means[gated | (LKs > threshold)]
|
||||||
avg_g10 = np.average(means_g10)
|
avg_g10 = np.average(means_g10)
|
||||||
|
|
||||||
if detail is False:
|
if detail is False:
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from . import tau
|
from . import tau
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import sympy as sym
|
|
||||||
|
|
||||||
# implements the modified bilinear transform:
|
# implements the modified bilinear transform:
|
||||||
# s <- 1/tan(w0/2)*(1 - z^-1)/(1 + z^-1)
|
# s <- 1/tan(w0/2)*(1 - z^-1)/(1 + z^-1)
|
||||||
|
@ -22,6 +21,7 @@ def zcgen_py(n, d):
|
||||||
return zcs
|
return zcs
|
||||||
|
|
||||||
def zcgen_sym(n, d):
|
def zcgen_sym(n, d):
|
||||||
|
import sympy as sym
|
||||||
z = sym.symbols('z')
|
z = sym.symbols('z')
|
||||||
expr = sym.expand((1 - z**-1)**n*(1 + z**-1)**(d - n))
|
expr = sym.expand((1 - z**-1)**n*(1 + z**-1)**(d - n))
|
||||||
coeffs = expr.equals(1) and [1] or expr.as_poly().all_coeffs()
|
coeffs = expr.equals(1) and [1] or expr.as_poly().all_coeffs()
|
||||||
|
|
Loading…
Reference in a new issue