2017-01-26 22 views
2

(高斯寬度)我想傅里葉時域使用Python向頻域變換的模擬的激光脈衝。我從高斯函數開始,因爲已知「時間帶寬積」(時域寬度乘以頻域寬度)是0.44,當寬度用高斯的半高全寬。時間 - 帶寬積使用numpy.fft

然而,在使用numpy.fft.fft的時候,我發現時間帶寬積爲0.88,兩次應該是什麼。

enter image description here 這裏是我的代碼(在第幾行小例子,剩下的只是使地塊):

import numpy as np 
import matplotlib.pyplot as plt 

fwhm = 40e-15 # using a 40 femtosecond pulse 

t = np.linspace(-500e-15, 500e-15, 2000) 
Et = np.exp(-t**2/(2*(fwhm/2.35482)**2)) # gaussian function 

Ef = np.abs(np.fft.fftshift(np.fft.fft(Et))) # take the fourier transform 
f = np.fft.fftshift(np.fft.fftfreq(Ef.shape[0],t[1]-t[0])) # generate the frequencies 

fwhm_fft = 2 * np.abs(f[ np.argmin(np.abs(0.5*np.max(Ef)-Ef)) ]) # find the fwhm of the frequnecy-domain signal 

print 'Observed time-bandwidth product: %.3f'%(fwhm*fwhm_fft) 

# just making plots from here onwards: 
fig, axs = plt.subplots(2,1, figsize=(6,8)) 

axs[0].set_title('Time domain') 
axs[0].plot(t,Et) 
axs[0].axvline(-fwhm*0.5, color='r', alpha=0.5, label='Full-width at half-maximum (FWHM) = %.1f fs'%(fwhm*1e15)) 
axs[0].axvline(fwhm*0.5, color='r', alpha=0.5) 

axs[0].set_ylim(0,1.3) 
axs[0].set_xlabel('Time (sec)') 

axs[1].set_title('Frequency domain') 
axs[1].plot(f,Ef) 

axs[1].axvline(-0.44/fwhm*0.5, color='r', alpha=0.5, label='FWHM should be %.1f THz'%(0.44/fwhm*1e-12)) 
axs[1].axvline(0.44/fwhm*0.5, color='r', alpha=0.5) 

axs[1].axvline(-fwhm_fft*0.5, color='g', alpha=0.5, label='FWHM is actually %.1f THz'%(fwhm_fft*1e-12)) 
axs[1].axvline(fwhm_fft*0.5, color='g', alpha=0.5) 

axs[1].set_xlim(-5e13,5e13) 
axs[1].set_ylim(0,120) 
axs[1].set_xlabel('Frequency (Hz)') 

for ax in axs: 
    ax.legend(fontsize=10) 
    ax.set_ylabel('Electric field intensity (arbitrary units)') 

plt.tight_layout() 
plt.savefig('time-bandwidth-product.png', dpi=200) 
plt.show() 
+1

您的高斯是未標準化,導致了不同的FWHM那麼你意,選中[高斯(http://mathworld.wolfram.com/GaussianFunction.html)。正規化prefactor是1 /(西格馬* sqrt(2 * pi)) –

+1

你是正確的,它沒有正常化。但高斯的高度不應該影響寬度。 – DanHickstein

回答

1

@PaulPanzer在正確的軌道上!當比較兩個高斯函數的FWHM時,我們確實期望找到0.88作爲時間帶寬乘積。

但爲什麼大多數參考文獻 [1,2,3]都說0.44是激光脈衝的時間帶寬乘積?關鍵是我們實際觀察到的是電場(E)的強度(I),其中I = E^2。因此,實際上,比較寬度配置文件,而不是配置文件的寬度是最有意義的。當我們比較強度分佈時,我們發現時間帶寬乘積確實是0.44。

修改後的代碼:

import numpy as np 
import matplotlib.pyplot as plt 

fwhm = 40e-15 # using a 40 femtosecond pulse 

t = np.linspace(-1000e-15, 1000e-15, 4000) 
It = np.exp(-t**2/(2*(fwhm/2.35482)**2)) # Intensity in the time domain 
Et = np.sqrt(It)        # E-field in the time domain 

Ef = np.abs(np.fft.fftshift(np.fft.fft(Et))) # FT to get E-field in frequency domain 
If = Ef**2          # Intensity in the frequnecy domain 
f = np.fft.fftshift(np.fft.fftfreq(Ef.shape[0],t[1]-t[0])) # generate the frequencies 

fwhm_fft = 2 * np.abs(f[ np.argmin(np.abs(0.5*np.max(If)-If)) ]) # find the fwhm of the frequency-domain signal 

print 'Observed time-bandwidth product: %.3f'%(fwhm*fwhm_fft) 


# just making plots from here onwards: 
fig, axs = plt.subplots(2,1, figsize=(6,8)) 

axs[0].set_title('Time domain') 
axs[0].plot(t,It) 
axs[0].axvline(-fwhm*0.5, color='r', alpha=0.5, label='Full-width at half-maximum (FWHM) = %.1f fs'%(fwhm*1e15)) 
axs[0].axvline(fwhm*0.5, color='r', alpha=0.5) 

axs[0].set_xlim(-150e-15, 150e-15) 
axs[0].set_ylim(0,1.3) 
axs[0].set_xlabel('Time (sec)') 

axs[1].set_title('Frequency domain') 
axs[1].plot(f,If) 

axs[1].axvline(-0.44/fwhm*0.5, color='r', alpha=0.5, label='FWHM should be %.1f THz'%(0.44/fwhm*1e-12)) 
axs[1].axvline(0.44/fwhm*0.5, color='r', alpha=0.5) 

axs[1].axvline(-fwhm_fft*0.5, color='g', alpha=0.5, ls='dashed', label='FWHM is actually %.1f THz'%(fwhm_fft*1e-12)) 
axs[1].axvline(fwhm_fft*0.5, color='g', alpha=0.5, ls='dashed') 

axs[1].set_xlim(-2.0e13,2.0e13) 
axs[1].set_ylim(0,30000) 
axs[1].set_xlabel('Frequency (Hz)') 

for ax in axs: 
    ax.legend(fontsize=10) 
    ax.set_ylabel('Electric field intensity (arbitrary units)') 

plt.tight_layout() 
plt.savefig('time-bandwidth-product.png', dpi=200) 
plt.show() 

enter image description here

PS:RP-光子是一個奇妙的資源。它是激光和光子學領域的主要教科書之一。

+0

哈哈,在我的領域之外,爲我過於自大而爲我服務。你爲什麼不繼續並接受你自己的答案?這聽起來對我來說似乎是合情合理的。 –

+0

感謝您的回答保羅!它真的幫我弄清楚了。 – DanHickstein

1

編輯2:看來魔鬼是在物理,而不是數學,見丹的自我回答。平方高斯確實將半極大值的位置移動了1/sqrt(2),因此一切都很好。我仍然謙虛無保地向RP Photonics道歉。編輯2.

末我敢肯定的「錯誤」,你要找的是與0.44,則鏈接引用不看100%可靠。

所以讓我們自己計算出預期的結果。傅里葉變換有不同的定義。 this one似乎是一個numpy正在堅持。在這個約定中高斯的標準偏差和它的傅立葉變換的乘積是1 /(2pi)。 SD sigma的零均值高斯的半最大值在+/- sigma sqrt(2 log 2)。因此FWHM的的產品是1 /(二皮)8日誌2 = 4/PI日誌2 = 0.8825 ...

換句話說:什麼你觀察是正確的。

編輯:爲了公平起見RP Photonics公司,它們不一定是他們可能只是使用尚未傅立葉的另一個定義變換錯誤的。