LASP 1.0
Library for Acoustic Signal Processing
|
Author: T. More...
Classes | |
class | SmoothingType |
class | SmoothingWidth |
class | sw |
Functions | |
intHann (x1, x2) | |
Calculate integral of (part of) Hann window. | |
smoothCalcMatrix (freq, SmoothingWidth sw) | |
Args: freq: array of frequencies of data points [Hz] - equally spaced sw: SmoothingWidth. | |
smoothSpectralData (freq, M, SmoothingWidth sw, SmoothingType st=SmoothingType.levels) | |
Apply fractional octave smoothing to data in the frequency domain. | |
Variables | |
int | Noct = 2 |
int | fmin = 1e3 |
int | fmax = 24e3 |
int | Ndata = 200 |
freq = np.linspace(fmin, fmax, Ndata) | |
float | M = abs(0.4*np.random.normal(size=(len(freq),)))+0.01 |
st | |
Msm = smoothSpectralData(freq, M, sw, st) | |
fsm = freq | |
Author: T.
Hekman, C. Jansen, J.A. de Jong - ASCEE V.O.F.
Smooth data in the frequency domain.
TODO: This function is rather slow as it uses [for loops] in Python. Speed up. NOTE: function requires lin frequency spaced input data TODO: accept input data that is not lin spaced in frequency TODO: it makes more sense to output data that is log spaced in frequency TODO: Make SmoothSpectralData() multi-dimensional array aware. TODO: Smoothing does not work due to complex numbers. Is it reasonable to smooth complex data? If so, the data could be split in magnitude and phase.
lasp.tools.tools.intHann | ( | x1, | |
x2 | |||
) |
lasp.tools.tools.smoothCalcMatrix | ( | freq, | |
SmoothingWidth | sw | ||
) |
Args: freq: array of frequencies of data points [Hz] - equally spaced sw: SmoothingWidth.
Returns: freq: array frequencies of data points [Hz] Q: matrix to smooth, power: {fsm} = [Q] * {fraw}
Warning: this method does not work on levels (dB)
According to Tylka_JAES_SmoothingWeights.pdf "A Generalized Method for Fractional-Octave Smoothing of Transfer Functions that Preserves Log-Frequency Symmetry" https://doi.org/10.17743/jaes.2016.0053 par 1.3 eq. 16
lasp.tools.tools.smoothSpectralData | ( | freq, | |
M, | |||
SmoothingWidth | sw, | ||
SmoothingType | st = SmoothingType.levels |
||
) |
Apply fractional octave smoothing to data in the frequency domain.
Args: freq: array of frequencies of data points [Hz] - equally spaced M: array of data, either power or dB the smoothing type st
, the smoothing is applied. sw: smoothing width st: smoothing type = data type of input data
Returns: freq : array frequencies of data points [Hz] Msm : float smoothed magnitude of data points
int lasp.tools.tools.M = abs(0.4*np.random.normal(size=(len(freq),)))+0.01 |