minor fixes
This commit is contained in:
parent
82fc38a990
commit
b51e9d4b82
@ -16,16 +16,16 @@ is assumed to be acoustic data.
|
|||||||
'sensitivity': (Optionally) the stored sensitivity of the record channels.
|
'sensitivity': (Optionally) the stored sensitivity of the record channels.
|
||||||
This can be a single value, or a list of sensitivities for
|
This can be a single value, or a list of sensitivities for
|
||||||
each channel. Both representations are allowed.
|
each channel. Both representations are allowed.
|
||||||
'qtys' : (Optionally): list of quantities that is recorded for each channel', if
|
'qtys' : (Optionally): list of quantities that is recorded for each channel',
|
||||||
this array is not found. Quantities are defaulted to 'Number / Full scale'
|
if this array is not found. Quantities are defaulted to 'Number / Full scale'
|
||||||
|
|
||||||
- Datasets:
|
- Datasets:
|
||||||
|
|
||||||
'audio': 3-dimensional array of blocks of audio data. The first axis is the
|
'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
|
block index, the second axis the sample number and the third axis is the
|
||||||
number. The data type is either int16, int32 or float64 / float32. If raw data
|
channel number. The data type is either int16, int32 or float64 / float32. If
|
||||||
is stored as integer values (int16, int32), the actual values should be
|
raw data is stored as integer values (int16, int32), the actual values should
|
||||||
pre-scaled by its maximum positive number (2**(nb-1) - 1), such that the
|
be pre-scaled by its maximum positive number (2**(nb-1) - 1), such that the
|
||||||
corresponding 'number' lies between -1.0 and 1.0.
|
corresponding 'number' lies between -1.0 and 1.0.
|
||||||
|
|
||||||
'video': 4-dimensional array of video frames. The first index is the frame
|
'video': 4-dimensional array of video frames. The first index is the frame
|
||||||
@ -68,6 +68,7 @@ def getSampWidth(dtype):
|
|||||||
else:
|
else:
|
||||||
raise ValueError('Invalid data type: %s' % dtype)
|
raise ValueError('Invalid data type: %s' % dtype)
|
||||||
|
|
||||||
|
|
||||||
def scaleBlockSens(block, sens):
|
def scaleBlockSens(block, sens):
|
||||||
"""Scale a block of raw data to return raw acoustic pressure data.
|
"""Scale a block of raw data to return raw acoustic pressure data.
|
||||||
|
|
||||||
@ -155,8 +156,8 @@ class IterRawData:
|
|||||||
stop_offset = self.blocksize
|
stop_offset = self.blocksize
|
||||||
# print(f'block: {block}, starto: {start_offset}, stopo {stop_offset}')
|
# print(f'block: {block}, starto: {start_offset}, stopo {stop_offset}')
|
||||||
|
|
||||||
self.i +=1
|
self.i += 1
|
||||||
return self.fa[block,start_offset:stop_offset,:][:,self.channels]
|
return self.fa[block, start_offset:stop_offset, :][:, self.channels]
|
||||||
|
|
||||||
|
|
||||||
class IterData(IterRawData):
|
class IterData(IterRawData):
|
||||||
|
@ -315,5 +315,3 @@ class SosOctaveFilterBank(SosFilterBank):
|
|||||||
"""
|
"""
|
||||||
self.designer = OctaveBankDesigner(fs)
|
self.designer = OctaveBankDesigner(fs)
|
||||||
SosFilterBank.__init__(self, fs, xmin, xmax)
|
SosFilterBank.__init__(self, fs, xmin, xmax)
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,8 +114,8 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
|
|||||||
raise Warning('Check if \'Noct\' is entered correctly')
|
raise Warning('Check if \'Noct\' is entered correctly')
|
||||||
assert len(freq) == len(M), 'f and M should have equal length'
|
assert len(freq) == len(M), 'f and M should have equal length'
|
||||||
|
|
||||||
if st == SmoothingType.ps:
|
# if st == SmoothingType.ps:
|
||||||
assert np.min(M) >= 0, 'absolute magnitude M cannot be negative'
|
# assert np.min(M) >= 0, 'absolute magnitude M cannot be negative'
|
||||||
if st == SmoothingType.levels and isinstance(M.dtype, complex):
|
if st == SmoothingType.levels and isinstance(M.dtype, complex):
|
||||||
raise RuntimeError('Decibel input should be real-valued')
|
raise RuntimeError('Decibel input should be real-valued')
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
|
|||||||
# Calculate window
|
# Calculate window
|
||||||
g = np.zeros(xu-xl)
|
g = np.zeros(xu-xl)
|
||||||
for n, xi in enumerate(range(xl, xu)):
|
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[n] = np.sqrt( 1/ ((1+((fi/fc - fc/fi)*(1.507*Noct))**6)) )
|
||||||
g /= np.sum(g) # normalize: integral=1
|
g /= np.sum(g) # normalize: integral=1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user