diff --git a/lasp/filter/filterbank_design.py b/lasp/filter/filterbank_design.py index d6c3c5f..1978012 100644 --- a/lasp/filter/filterbank_design.py +++ b/lasp/filter/filterbank_design.py @@ -30,7 +30,7 @@ class FilterBankDesigner: fs: Sampling frequency [Hz] """ # Default FIR filter length - firFilterLength = 256 # Filter order + self.firFilterLength = 256 # Filter order self.fs = fs # Constant G, according to standard @@ -99,8 +99,8 @@ class FilterBankDesigner: Returns: filter: 1D ndarray with FIR filter coefficients """ - assert np.isclose(fs, self.fs), "Invalid sampling frequency" - fd = fs / np.prod(self.firDecimation(x)) + assert np.isclose(self.fs, 48000), "Invalid sampling frequency" + fd = self.fs / np.prod(self.firDecimation(x)) # For designing the filter, the lower and upper frequencies need to be # slightly adjusted to fall within the limits for a class 1 filter. diff --git a/lasp/lasp_avstream.py b/lasp/lasp_avstream.py index 788ec86..047024e 100644 --- a/lasp/lasp_avstream.py +++ b/lasp/lasp_avstream.py @@ -60,6 +60,8 @@ class AvStream: # Determine highest input channel number channelconfigs = daqconfig.en_input_channels + self.channel_names = [] + self.sensitivity = self.daqconfig.getSensitivities() rtaudio_inputparams = None @@ -79,6 +81,7 @@ class AvStream: for i, channelconfig in enumerate(channelconfigs): if channelconfig.channel_enabled: self.nchannels = i+1 + self.channel_names.append(channelconfig.channel_name) rtaudio_inputparams = {'deviceid': device.index, 'nchannels': self.nchannels, 'firstchannel': 0} diff --git a/lasp/lasp_common.py b/lasp/lasp_common.py index 707defc..bfffdf2 100644 --- a/lasp/lasp_common.py +++ b/lasp/lasp_common.py @@ -82,9 +82,9 @@ class TimeWeighting: fast = (0.125, 'Fast (0.125 s)') slow = (1.0, 'Slow (1.0 s)') tens = (10, '10 s') - infinite = (np.Inf, 'Infinite') + infinite = (np.Inf, 'Infinite (Leq)') types = (none, uufast, ufast, fast, slow, tens, infinite) - default = 2 + default = 3 @staticmethod def fillComboBox(cb): diff --git a/lasp/lasp_octavefilter.py b/lasp/lasp_octavefilter.py index f3ae0c7..c8e6857 100644 --- a/lasp/lasp_octavefilter.py +++ b/lasp/lasp_octavefilter.py @@ -115,7 +115,7 @@ class FirFilterBank: # These are the filters that do not require lasp_decimation # prior to filtering nominals_txt.append(self.designer.nominal_txt(x)) - firs[:, i] = self.designer.createFirFilter(fs, x) + firs[:, i] = self.designer.createFirFilter(x) filterbank = {'fb': pyxFilterBank(firs, 1024), 'xs': xs, 'nominals': nominals_txt} @@ -203,7 +203,7 @@ class FirOctaveFilterBank(FirFilterBank): """ def __init__(self, fs, xmin, xmax): - self.designer = OctaveBankDesigner() + self.designer = OctaveBankDesigner(fs) FirFilterBank.__init__(self, fs, xmin, xmax) @@ -231,6 +231,7 @@ class SosFilterBank: self.fs = fs self.xs = list(range(xmin, xmax + 1)) nfilt = len(self.xs) + self.nfilt = nfilt self._fb = pyxSosFilterBank(nfilt, 5) for i, x in enumerate(self.xs): sos = self.designer.createSOSFilter(x) @@ -279,7 +280,7 @@ class SosThirdOctaveFilterBank(SosFilterBank): band. """ - def __init__(self, fs, xmin, xmax): + def __init__(self, fs, xmin=None, xmax=None): """ Initialize a second order sections filterbank. @@ -289,6 +290,10 @@ class SosThirdOctaveFilterBank(SosFilterBank): xmax: Maximum value for the bands """ self.designer = ThirdOctaveBankDesigner(fs) + if xmin is None: + xmin = self.designer.xs[0] + if xmax is None: + xmax = self.designer.xs[-1] SosFilterBank.__init__(self, fs, xmin, xmax) @@ -298,16 +303,20 @@ class SosOctaveFilterBank(SosFilterBank): band. """ - def __init__(self, fs, xmin, xmax): + def __init__(self, fs, xmin=None, xmax=None): """ Initialize a second order sections filterbank. Args: fs: Sampling frequency [Hz] - xmin: Minimum value for the bands - xmax: Maximum value for the bands + xmin: Minimum value for the bands, if not specified, use minimum + xmax: Maximum value for the bands, if not specified, use maximum """ self.designer = OctaveBankDesigner(fs) + if xmin is None: + xmin = self.designer.xs[0] + if xmax is None: + xmax = self.designer.xs[-1] SosFilterBank.__init__(self, fs, xmin, xmax)