Did some renaming to make sure FIR filterbanks can coexist with SOS filterbanks

This commit is contained in:
Anne de Jong 2020-01-03 22:00:50 +01:00
parent 4cd3f0bf9f
commit 54173b6ecc
8 changed files with 17 additions and 19 deletions

View File

@ -1,6 +1,5 @@
from .soundpressureweighting import *
from .filterbank_design import OctaveBankDesigner, ThirdOctaveBankDesigner
from .filterbank_standard_limits import octave_band_limits, third_octave_band_limits
from .fir_design import *
from .freqweighting_fir import A, C
from .bandpass_fir import OctaveBankDesigner, ThirdOctaveBankDesigner
from .bandpass_limits import octave_band_limits, third_octave_band_limits
__all__ = ['A', 'Z']

View File

@ -51,7 +51,7 @@ class FilterBankDesigner:
""" """
return self.fm(x)*self.G**(1/(2*self.b)) return self.fm(x)*self.G**(1/(2*self.b))
def createFilter(self, fs, x): def createFirFilter(self, fs, x):
""" """
Create a FIR filter for band designator b and sampling frequency fs. Create a FIR filter for band designator b and sampling frequency fs.
Decimation should be obtained from decimation() method. Decimation should be obtained from decimation() method.

View File

@ -3,7 +3,8 @@
"""! """!
Author: J.A. de Jong - ASCEE Author: J.A. de Jong - ASCEE
Description: Filter design for frequency weightings A and C. Description: Filter design for frequency weighting curves (i.e. A and C
weighting)
""" """
from .fir_design import freqResponse, arbitrary_fir_design from .fir_design import freqResponse, arbitrary_fir_design
import numpy as np import numpy as np

View File

@ -6,14 +6,14 @@ Author: J.A. de Jong - ASCEE
Provides the FIR implementation of the octave filter bank Provides the FIR implementation of the octave filter bank
""" """
__all__ = ['OctaveFilterBank', 'ThirdOctaveFilterBank'] __all__ = ['FirOctaveFilterBank', 'FirThirdOctaveFilterBank']
from .filter.bandpass_fir import OctaveBankDesigner, ThirdOctaveBankDesigner from .filter.filterbank_design import OctaveBankDesigner, ThirdOctaveBankDesigner
from .wrappers import Decimator, FilterBank as pyxFilterBank from .wrappers import Decimator, FilterBank as pyxFilterBank
import numpy as np import numpy as np
class FilterBank: class FirFilterBank:
""" """
Single channel octave filter bank implementation Single channel octave filter bank implementation
""" """
@ -65,7 +65,7 @@ class FilterBank:
# These are the filters that do not require lasp_decimation # These are the filters that do not require lasp_decimation
# prior to filtering # prior to filtering
nominals_txt.append(self.nominal_txt(x)) nominals_txt.append(self.nominal_txt(x))
firs[:, i] = self.createFilter(fs, x) firs[:, i] = self.createFirFilter(fs, x)
filterbank = {'fb': pyxFilterBank(firs, 1024), filterbank = {'fb': pyxFilterBank(firs, 1024),
'xs': xs, 'xs': xs,
'nominals': nominals_txt} 'nominals': nominals_txt}
@ -136,17 +136,17 @@ class FilterBank:
return output return output
class OctaveFilterBank(FilterBank, OctaveBankDesigner): class FirOctaveFilterBank(FirFilterBank, OctaveBankDesigner):
""" """
Filter bank which uses FIR filtering for each octave frequency band Filter bank which uses FIR filtering for each octave frequency band
""" """
def __init__(self, fs): def __init__(self, fs):
OctaveBankDesigner.__init__(self) OctaveBankDesigner.__init__(self)
FilterBank.__init__(self, fs) FirFilterBank.__init__(self, fs)
class ThirdOctaveFilterBank(FilterBank, ThirdOctaveBankDesigner): class FirThirdOctaveFilterBank(FirFilterBank, ThirdOctaveBankDesigner):
""" """
Filter bank which uses FIR filtering for each one-third octave frequency Filter bank which uses FIR filtering for each one-third octave frequency
band. band.
@ -154,4 +154,4 @@ class ThirdOctaveFilterBank(FilterBank, ThirdOctaveBankDesigner):
def __init__(self, fs): def __init__(self, fs):
ThirdOctaveBankDesigner.__init__(self) ThirdOctaveBankDesigner.__init__(self)
FilterBank.__init__(self, fs) FirFilterBank.__init__(self, fs)

View File

@ -47,7 +47,7 @@ class SLM:
self._Lmax = 0. self._Lmax = 0.
# Storage for computing the equivalent level # Storage for computing the equivalent level
self._sq = 0. self._sq = 0. # Square of the level data, storage
self._N = 0 self._N = 0
self._Leq = 0. self._Leq = 0.

View File

@ -4,10 +4,8 @@
Weighting and calibration filter in one Weighting and calibration filter in one
@author: J.A. de Jong - ASCEE @author: J.A. de Jong - ASCEE
""" """
from .filter.freqweighting_fir import A, C
from .lasp_common import FreqWeighting from .lasp_common import FreqWeighting
from .filter.fir_design import (arbitrary_fir_design, from .filter import (A, C, arbitrary_fir_design, freqResponse as frp)
freqResponse as frp)
from lasp.lasp_config import ones, empty from lasp.lasp_config import ones, empty
from .wrappers import FilterBank from .wrappers import FilterBank
import numpy as np import numpy as np