Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power spectrum from Fourier and Stockwell transforms #6

Open
mojeamjad opened this issue Jan 17, 2022 · 0 comments
Open

Power spectrum from Fourier and Stockwell transforms #6

mojeamjad opened this issue Jan 17, 2022 · 0 comments

Comments

@mojeamjad
Copy link

Due to the normalized Gaussian weight, Stockwell integral in time (dx) must produce the Fourier spectrum (frequency domain) exactly:

F(f) = integral { S(x,f) . dx }

Therefore the power spectrum of Fourier transform must be the same as power spectrum of Stockwell transform (following your example):

dx = t[1] - t[0]
fk = np.fft.rfft(w) / (len(w))# normalized FFT
pk = np.abs(fk)**2
freq = np.fft.rfftfreq( len(w) , dx )
stock_p = (np.abs( (stock*dx).sum(axis=1)))**2

these two power spectrum are almost the same but meet each other only using a scale factor of 400!

scale = 400 # 400? 1?
fig,ax = plt.subplots(figsize=(8,8))
plt.plot(freq[0:251],stock_p/scale,linewidth=3, label='Stockwell transform')
plt.plot(freq[0:251],pk[0:251],'*',linewidth=3,color='k', label='conventional Fourier transform')
ax.set(xlabel='frequency (Hz)', ylabel='Power spectrum P(f)')
leg = plt.legend( prop={'size':10})

stock_doc_signal
The scaling factor differs from case to case (e.g. Zimin et al, 2003 test needs the scale factor of ca. 640).

Do I forget something?!


Another question is concerning the periodicity. Does this library consider the signal as a periodic signal? what about the edges in non-periodic signals? Do we need something like "cone of influence"?!

Thanks in advance for your kind answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant