diff --git a/lasp/filter/freqweighting_fir.py b/lasp/filter/freqweighting_fir.py index db3505f..0ecf929 100644 --- a/lasp/filter/freqweighting_fir.py +++ b/lasp/filter/freqweighting_fir.py @@ -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) f4sq = f4**2 + def A_uncor(f): """ Computes the uncorrected frequency response of the A-filter """ fsq = f**2 - num = f4sq*fsq**2 + num = f4sq*fsq**2 denom1 = (fsq+f1**2) denom2 = np.sqrt((fsq+f2**2)*(fsq+f3**2))*(fsq+f4sq) - + return (num/(denom1*denom2)) + 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) A1000 = A_uncor(1000.) return Auncor/A1000 - + + def C_uncor(f): """ Computes the uncorrected frequency response of the C-filter @@ -57,6 +68,7 @@ def C_uncor(f): denom2 = (fsq+f4**2) return num/(denom1*denom2) + def C(f): """ Computes the linear A-weighting freqency response diff --git a/lasp/tools/config.py b/lasp/tools/config.py index b2cfc7d..4a96c30 100644 --- a/lasp/tools/config.py +++ b/lasp/tools/config.py @@ -39,10 +39,10 @@ def init_matplotlib(report_quality=False): def init_backend(report_quality=False): global _init if not _init: - _init = True import matplotlib matplotlib.use('Qt5Agg') init_matplotlib(report_quality) + _init = True import matplotlib.pyplot as plt plt.ion()