Why do I have a high peak at the beginning of my FFT (not DC)? I am analyzing a recording from a microelectrode array on a neuronal cell culture and I found something that is disturbing me a lot. Through python, I have taken different chunks of the same signal profile from the original recording, calculated the FFT of each of them and then, the mean among them.
In theory, this makes sense since I am just amplifying common patterns on the wave, however, I am getting a huge peak at the 0 component but if you calculate the mean of the signal, they have zero DC component. I don't know if this issue might be a consequence of a bad use of the FFT on python or maybe I am missing something. Do any of you have any idea of what is going on?


The code is very long but the specific section of the chunks and the fft is here:
chunk = np.zeros((16, 300000))
chunk[0,:] = signal1[320000:620000]
chunk[1,:] = signal1[950000:1250000]
chunk[2,:] = signal1[1640000:1940000]
chunk[3,:] = signal1[2311000:2611000]
chunk[4,:] = signal2[320000:620000]
chunk[5,:] = signal2[950000:1250000]
chunk[6,:] = signal2[1640000:1940000]
chunk[7,:] = signal2[2311000:2611000]
chunk[8,:] = signal3[320000:620000]
chunk[9,:] = signal3[950000:1250000]
chunk[10,:] = signal3[1640000:1940000]
chunk[11,:] = signal3[2311000:2611000]
chunk[12,:] = signal4[320000:620000]
chunk[13,:] = signal4[950000:1250000]
chunk[14,:] = signal4[1640000:1940000]
chunk[15,:] = signal4[2340000:2640000]

myfftchunk0 = np.fft.fft(chunk[0,:])
myfftchunk1 = np.fft.fft(chunk[1,:])
myfftchunk2 = np.fft.fft(chunk[2,:])
myfftchunk3 = np.fft.fft(chunk[3,:])
myfftchunk4 = np.fft.fft(chunk[4,:])
myfftchunk5 = np.fft.fft(chunk[5,:])
myfftchunk6 = np.fft.fft(chunk[6,:])
myfftchunk7 = np.fft.fft(chunk[7,:])
myfftchunk8 = np.fft.fft(chunk[8,:])
myfftchunk9 = np.fft.fft(chunk[9,:])
myfftchunk10 = np.fft.fft(chunk[10,:])
myfftchunk11 = np.fft.fft(chunk[11,:])
myfftchunk12 = np.fft.fft(chunk[12,:])
myfftchunk13 = np.fft.fft(chunk[13,:])
myfftchunk14 = np.fft.fft(chunk[14,:])
myfftchunk15 = np.fft.fft(chunk[15,:])


Meansignal = np.zeros(len(chunk[1, :]))

for i in range(len(chunk[1, :])):
    Meansignal[i] = myfftchunk0[i] + myfftchunk1[i] + myfftchunk2[i] + myfftchunk3[i] + myfftchunk4[i] + myfftchunk5[i] + myfftchunk6[i] + myfftchunk7[i] + myfftchunk8[i] + myfftchunk9[i] + myfftchunk10[i] + myfftchunk11[i] + myfftchunk12[i] + myfftchunk13[i] + myfftchunk14[i] + myfftchunk15[i]
    Meansignal[i] = Meansignal[i] / 16


mynewffthalfMean = Meansignal[:len(Meansignal) // 2]
fnewHalfMean = np.linspace(0, fs / 2, len(mynewffthalfMean))


# Plot figure 2 - FFT
plt.figure(7)
plt.plot(fnewHalfMean, np.abs(abs(mynewffthalfMean))**2)
plt.xlabel('Frequency (Hz)')
plt.ylabel('Magnitude (dB)')
You cannot simultaneously have a non-zero value at the first bin of the DFT (the 0 component) and a zero-mean since the first component is by definition of the DFT the (scaled) mean of the signal:
from the DFT:
$$X[k] = \sum_{n=0}^{N-1}x[n]e^{-j2\pi nk/N}$$
$$X[0] = \sum_{n=0}^{N-1}x[n]e^{j0}= \sum_{n=0}^{N-1}x[n] = N\mu_x$$
So there is a mean in the digital data, and perhaps the OP's confusion is there is not a mean of any significance in the analog waveform being sampled. There are several opportunities to introduce offsets notably in the ADC converter itself, or it may be as simple as the mapped amplitude range of the digital waveform includes an offset. But taking the mean of the data that is being FFT'd should be consistent with what is above, with further scaling by any windowing that may be done according to $\sum_{n=0}^{N-1}w_n$.