Merge branch 'develop' of ssh://code.ascee.nl:12001/ASCEE/lasp into develop

This commit is contained in:
Casper Jansen 2021-10-18 10:06:45 +02:00
commit 640de6afb7

View File

@ -161,8 +161,8 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
fu = fNq # no data beyond fNq
fl = fc**2 / fu # keep window symmetric
xl = bisect.bisect_left(f, fl) # index corresponding to fl
xu = bisect.bisect_left(f, fu)
xl = bisect.bisect_left(freq, fl) # index corresponding to fl
xu = bisect.bisect_left(freq, fu)
# Calculate window
g = np.zeros(xu-xl)
@ -307,7 +307,7 @@ if __name__ == "__main__":
fmin = 3e3 # [Hz] min freq
fmax = 24e3 # [Hz] max freq
Ndata = 200 # number of data points
f = np.linspace(fmin, fmax, Ndata) # frequency points
freq = np.linspace(fmin, fmax, Ndata) # frequency points
M = abs(0.4*np.random.normal(size=(Ndata,)))+0.01 #
M = 20*np.log10(M)
@ -315,7 +315,7 @@ if __name__ == "__main__":
# fmin = 3e3 # [Hz] min freq
# fmax = 24e3 # [Hz] max freq
# Ndata = 200 # number of data points
# f = np.linspace(fmin, fmax, Ndata) # frequency points
# freq = np.linspace(fmin, fmax, Ndata) # frequency points
# M = 0 * abs(1+0.4*np.random.normal(size=(Ndata,))) + 0.01 #
# M[int(100)] = 1
# M = 20*np.log10(M)
@ -325,12 +325,12 @@ if __name__ == "__main__":
value = [Noct]
st = SmoothingType.levels # so data is given in dB
Msm = smoothSpectralData(f, M, sw, st)
fsm = f
Msm = smoothSpectralData(freq, M, sw, st)
fsm = freq
# Plot - lin frequency
plt.figure()
plt.plot(f, M, '.b')
plt.plot(freq, M, '.b')
plt.plot(fsm, Msm, 'r')
plt.xlabel('f (Hz)')
plt.ylabel('magnitude')
@ -339,7 +339,7 @@ if __name__ == "__main__":
# Plot - log frequency
plt.figure()
plt.semilogx(f, M, '.b')
plt.semilogx(freq, M, '.b')
plt.semilogx(fsm, Msm, 'r')
plt.xlabel('f (Hz)')
plt.ylabel('magnitude')