Renamed nominals to nominals_txt

This commit is contained in:
Anne de Jong 2018-09-21 09:16:58 +02:00 committed by J.A. de Jong - ASCEE
parent bbdbb6b707
commit 3c0562cee4
3 changed files with 9 additions and 9 deletions

View File

@ -101,7 +101,7 @@ class OctaveBankDesigner(FilterBankDesigner):
def xs(self): def xs(self):
return list(range(-6, 5)) return list(range(-6, 5))
def nominal(self, x): def nominal_txt(self, x):
# Text corresponding to the nominal frequency # Text corresponding to the nominal frequency
nominals = {4: '16k', nominals = {4: '16k',
3: '8k', 3: '8k',
@ -164,7 +164,7 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
def __init__(self): def __init__(self):
self.xs = list(range(-16, 14)) self.xs = list(range(-16, 14))
# Text corresponding to the nominal frequency # Text corresponding to the nominal frequency
self.nominal_txt = ['25', '31.5', '40', self._nominal_txt = ['25', '31.5', '40',
'50', '63', '80', '50', '63', '80',
'100', '125', '160', '100', '125', '160',
'200', '250', '315', '200', '250', '315',
@ -175,18 +175,18 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
'6.3k', '8k', '10k', '6.3k', '8k', '10k',
'12.5k', '16k', '20k'] '12.5k', '16k', '20k']
assert len(self.xs) == len(self.nominal_txt) assert len(self.xs) == len(self._nominal_txt)
@property @property
def b(self): def b(self):
# Band division factor, 3 for one-third octave bands # Band division factor, 3 for one-third octave bands
return 3 return 3
def nominal(self, x): def nominal_txt(self, x):
# Put the nominal frequencies in a dictionary for easy access with # Put the nominal frequencies in a dictionary for easy access with
# x as the key. # x as the key.
index = x - self.xs[0] index = x - self.xs[0]
return self.nominal_txt[index] return self._nominal_txt[index]
@staticmethod @staticmethod
def decimation(x): def decimation(x):

View File

@ -59,16 +59,16 @@ class FilterBank:
xs_all = [xs_d1, xs_d4, xs_d16, xs_d64, xs_d256] xs_all = [xs_d1, xs_d4, xs_d16, xs_d64, xs_d256]
for xs in xs_all: for xs in xs_all:
nominals = [] nominals_txt = []
firs = np.empty((self.L, len(xs)), order='F') firs = np.empty((self.L, len(xs)), order='F')
for i, x in enumerate(xs): for i, x in enumerate(xs):
# 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.append(self.nominal(x)) nominals_txt.append(self.nominal_txt(x))
firs[:, i] = self.createFilter(fs, x) firs[:, i] = self.createFilter(fs, x)
filterbank = {'fb': pyxFilterBank(firs, 1024), filterbank = {'fb': pyxFilterBank(firs, 1024),
'xs': xs, 'xs': xs,
'nominals': nominals} 'nominals': nominals_txt}
self.filterbanks.append(filterbank) self.filterbanks.append(filterbank)
# Sample input counter. # Sample input counter.

View File

@ -44,7 +44,7 @@ for x in bands.xs:
ax.semilogx(freq, llim) ax.semilogx(freq, llim)
ax.semilogx(freq, ulim) ax.semilogx(freq, ulim)
ax.set_title(f'x = {x}, fnom = {bands.nominal(x)}') ax.set_title(f'x = {x}, fnom = {bands.nominal_txt(x)}')
if zoom: if zoom:
ax.set_xlim(bands.fl(x)/1.1, bands.fu(x)*1.1) ax.set_xlim(bands.fl(x)/1.1, bands.fu(x)*1.1)