Data Analysis, Chemometrics, Spectroscopy, Raman Spectroscopy, Cosmic Rays.
w[spikes[w] == 0] # From such interval, we choose the ones which are not spikes y_out[i] = np.mean(y[w2]) # and we average their values return y_out # Does it work? plt.plot(wavelength, intensity, label = 'original data') plt.plot(wavelength, fixer(intensity,m=3), label = 'fixed spectrum')