diff --git a/lasp/lasp_measurement.py b/lasp/lasp_measurement.py index be65350..2bb1ee4 100644 --- a/lasp/lasp_measurement.py +++ b/lasp/lasp_measurement.py @@ -16,17 +16,17 @@ 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 -corresponding 'number' lies between -1.0 and 1.0. +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 number, the second the x-value of the pixel and the third is the @@ -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. @@ -155,8 +156,8 @@ class IterRawData: stop_offset = self.blocksize # print(f'block: {block}, starto: {start_offset}, stopo {stop_offset}') - self.i +=1 - return self.fa[block,start_offset:stop_offset,:][:,self.channels] + self.i += 1 + return self.fa[block, start_offset:stop_offset, :][:, self.channels] class IterData(IterRawData): diff --git a/lasp/lasp_octavefilter.py b/lasp/lasp_octavefilter.py index 5f29fde..b2f3a6b 100644 --- a/lasp/lasp_octavefilter.py +++ b/lasp/lasp_octavefilter.py @@ -315,5 +315,3 @@ class SosOctaveFilterBank(SosFilterBank): """ self.designer = OctaveBankDesigner(fs) SosFilterBank.__init__(self, fs, xmin, xmax) - - diff --git a/lasp/tools/tools.py b/lasp/tools/tools.py index 41b9d91..752ed7b 100644 --- a/lasp/tools/tools.py +++ b/lasp/tools/tools.py @@ -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