Comments. Bugfix in tools/config

This commit is contained in:
Anne de Jong 2018-10-16 14:14:13 +02:00 committed by J.A. de Jong - ASCEE
parent be3310285e
commit 133b04976e
2 changed files with 17 additions and 5 deletions

View File

@ -28,25 +28,36 @@ f1 = np.sqrt((-b-np.sqrt(b**2-4*c))/2)
f4 = np.sqrt((-b+np.sqrt(b**2-4*c))/2) f4 = np.sqrt((-b+np.sqrt(b**2-4*c))/2)
f4sq = f4**2 f4sq = f4**2
def A_uncor(f): def A_uncor(f):
""" """
Computes the uncorrected frequency response of the A-filter Computes the uncorrected frequency response of the A-filter
""" """
fsq = f**2 fsq = f**2
num = f4sq*fsq**2 num = f4sq*fsq**2
denom1 = (fsq+f1**2) denom1 = (fsq+f1**2)
denom2 = np.sqrt((fsq+f2**2)*(fsq+f3**2))*(fsq+f4sq) denom2 = np.sqrt((fsq+f2**2)*(fsq+f3**2))*(fsq+f4sq)
return (num/(denom1*denom2)) return (num/(denom1*denom2))
def A(f): def A(f):
""" """
Computes the linear A-weighting freqency response Computes the linear A-weighting freqency response. Hence, to obtain
A-weighted values, the *amplitude* need to be multiplied with this value.
Hence, to correct dB levels, the value of 20*log(A) needs to be added to
the level
Args:
f: Frequency array to compute values for
Returns:
A(f) for each frequency
""" """
Auncor = A_uncor(f) Auncor = A_uncor(f)
A1000 = A_uncor(1000.) A1000 = A_uncor(1000.)
return Auncor/A1000 return Auncor/A1000
def C_uncor(f): def C_uncor(f):
""" """
Computes the uncorrected frequency response of the C-filter Computes the uncorrected frequency response of the C-filter
@ -57,6 +68,7 @@ def C_uncor(f):
denom2 = (fsq+f4**2) denom2 = (fsq+f4**2)
return num/(denom1*denom2) return num/(denom1*denom2)
def C(f): def C(f):
""" """
Computes the linear A-weighting freqency response Computes the linear A-weighting freqency response

View File

@ -39,10 +39,10 @@ def init_matplotlib(report_quality=False):
def init_backend(report_quality=False): def init_backend(report_quality=False):
global _init global _init
if not _init: if not _init:
_init = True
import matplotlib import matplotlib
matplotlib.use('Qt5Agg') matplotlib.use('Qt5Agg')
init_matplotlib(report_quality) init_matplotlib(report_quality)
_init = True
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
plt.ion() plt.ion()