minor fixes

This commit is contained in:
Casper Jansen 2021-10-18 09:17:36 +02:00
parent 82fc38a990
commit b51e9d4b82
3 changed files with 13 additions and 14 deletions

View File

@ -16,16 +16,16 @@ is assumed to be acoustic data.
'sensitivity': (Optionally) the stored sensitivity of the record channels.
This can be a single value, or a list of sensitivities for
each channel. Both representations are allowed.
'qtys' : (Optionally): list of quantities that is recorded for each channel', if
this array is not found. Quantities are defaulted to 'Number / Full scale'
'qtys' : (Optionally): list of quantities that is recorded for each channel',
if this array is not found. Quantities are defaulted to 'Number / Full scale'
- Datasets:
'audio': 3-dimensional array of blocks of audio data. The first axis is the
block index, the second axis the sample number and the third axis is the channel
number. The data type is either int16, int32 or float64 / float32. If raw data
is stored as integer values (int16, int32), the actual values should be
pre-scaled by its maximum positive number (2**(nb-1) - 1), such that the
block index, the second axis the sample number and the third axis is the
channel number. The data type is either int16, int32 or float64 / float32. If
raw data is stored as integer values (int16, int32), the actual values should
be pre-scaled by its maximum positive number (2**(nb-1) - 1), such that the
corresponding 'number' lies between -1.0 and 1.0.
'video': 4-dimensional array of video frames. The first index is the frame
@ -68,6 +68,7 @@ def getSampWidth(dtype):
else:
raise ValueError('Invalid data type: %s' % dtype)
def scaleBlockSens(block, sens):
"""Scale a block of raw data to return raw acoustic pressure data.

View File

@ -315,5 +315,3 @@ class SosOctaveFilterBank(SosFilterBank):
"""
self.designer = OctaveBankDesigner(fs)
SosFilterBank.__init__(self, fs, xmin, xmax)

View File

@ -114,8 +114,8 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
raise Warning('Check if \'Noct\' is entered correctly')
assert len(freq) == len(M), 'f and M should have equal length'
if st == SmoothingType.ps:
assert np.min(M) >= 0, 'absolute magnitude M cannot be negative'
# if st == SmoothingType.ps:
# assert np.min(M) >= 0, 'absolute magnitude M cannot be negative'
if st == SmoothingType.levels and isinstance(M.dtype, complex):
raise RuntimeError('Decibel input should be real-valued')
@ -167,7 +167,7 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
# Calculate window
g = np.zeros(xu-xl)
for n, xi in enumerate(range(xl, xu)):
fi = f[xi] # current frequency
fi = freq[xi] # current frequency
g[n] = np.sqrt( 1/ ((1+((fi/fc - fc/fi)*(1.507*Noct))**6)) )
g /= np.sum(g) # normalize: integral=1