# Window Choice of FFT

I am working with data from a TeraFlash THz Spectrometer from Toptica, which gives me the pulse in the time domain and the spectrum in the frequency domain

I have been experimenting with the FFT to get to the spectrum myself and I see some discrepancies compared to the spectrum from the software. The manufacturer told me that they use an adapted blackman window that only changes the first pulse sample and the last two pulse samples, so I assume that everything in-between will be weighted with 1 and only the beginning and end will have a smooth transition to 0. Apparently, this is done such that the pulse will not be altered by the window if it is not centered.

In the attached plot I have included the window (adapted blackman window) as well as the pulse and the two spectra (the software's and mine). I am particularly interested in the absorption lines in the spectrum that are not identical between the two calculation methods...

As I am new to DSP, I am not sure if this is a significant difference or if both spectra should suffice. In this setup, only the absorption lines air (mainly water) are visible, but for further measurements I am interested in the absorption lines of different materials.

EDIT: the other window functions shown in the legend of the plot result in even more discrepancies than the adapted blackman window, thus I chose not to show them.

I used numpy FFT calculation:

def get_fft(t, p, padding=True):
t, p = zero_padding(t, p)  # apply zero padding to get 100001 datapoints on the spectrum
p = p * blackman(len(t))  # apply blackman window
SAMPLE_RATE = len(t) / (t[-1] - t[0]) * 1e12
N = len(p)
a = np.abs(rfft(p))
f = rfftfreq(N, 1 / SAMPLE_RATE) / 1e12
return f, a

• Since there is no stated question, I'm assuming you're asking us to figure out why the software's and yours' FFT give different results. As such, please include your implementation so we can see if there's anything off there. Might be worth showing the results with a window that gives you the MOST difference, to help identify what the problem is. The only thing I can tell you is that both spectra look VERY similar, so I'm guessing there's a VERY slight difference in the two implementations, and yes, both spectra should suffice, but that's about it.
– Jdip
Aug 19, 2022 at 9:57
• Thanks for the reply and edit suggestions! I added a new plot and my implementation (sorry that the color scheme is not the same for both plots). What bothers me is the different extend to certain absorption lines... for example the one shortly before 2 THz is less visible in the software's spectrum - however all other significant absorption lines seem more dominant.. Aug 19, 2022 at 10:06
• It might be hard to figure this out without access to the software, but have you tried squaring your fft magnitude (this would give you the Power Spectral Density)? Then there might be a scaling issue: scaling the PSD. Finally, not familiar with the application at all, but this looks to me to be in the log-scale ($10*\log_{10}()$)
– Jdip
Aug 19, 2022 at 10:35
• Ah, sorry for the confusion. Ok then because your results are so similar, I'm guessing your Blackman implementation is slightly different from theirs. What does your modified Blackman window look like? The other thing I can think of is that under the hood, the software might be using zero-padding to make the length of the DFT a power of 2, effectively modifying the frequency precision. Please edit out the second plot showing the hamming window, it has no value here (my bad!) and replace the code portion with the Blackman window to avoid confusing others ;)
– Jdip
Aug 19, 2022 at 11:29
• If you're still struggling, let's keep this going here: chat.stackexchange.com/rooms/138629/toptica-fft
– Jdip
Aug 19, 2022 at 11:35