The code below truncates the function at 0.5 s and 0.2 s, showing the effect on its Fourier transform.
import numpy as np import matplotlib.pyplot as plt freq, tau = 250, 0.2 fsamp = 1000 duration = 10 t = np.arange(0, duration, 1/fsamp) n = len(t) f = np.cos(2 * np.pi * freq * t) * np.exp(-t/tau) for thresh in (0.5, 0.2): f[t > thresh] = 0. F = np.fft.rfft(f) freq = np.fft.rfftfreq(n, 1/fsamp) plt.plot(freq, abs(F)) plt.show()
Apodization resulting from truncation of the time series at 0.5 s:
Apodization resulting from truncation of the time series at 0.2 s: