基于FFT去除拉曼光谱中类Sinc旋转峰的方法优化问询
拉曼光谱旋转峰滤波优化请求
需求概述
我有一组拉曼光谱数据,需针对性处理其中特征:
- 需保留的主振动峰(标注为蓝色)
- 需通过滤波器去除的伴随旋转峰(标注为红色)
- 需保留旋转峰区域内可能出现的其他振动峰(标注为绿色)
已尝试方案
利用旋转峰类Sinc函数的规则频率特性,采用FFT+IFFT的滤波方法,步骤如下:
- 对指定裁剪区域减去最小值,简化滤波流程
- 对原光谱的FFT结果使用低通滤波器(LPF)去除类高斯形状,得到滤波后的FFT结果
- 对滤波后的FFT执行IFFT,提取出仅包含旋转峰的光谱,将其从原光谱中扣除得到最终滤波结果
该方案已实现初步效果,能较好分离旋转峰与振动峰,使目标峰更突出。
问题与观察
当前方案存在以下问题:
- LPF无法完美拟合类高斯形状(因担心调参降低通用性未做微调),导致旋转峰未完全去除
- 滤波后光谱在滤波区域出现轻微正弦波失真
- 左侧滤波区域的整体强度低于原光谱
代码与数据
实现该滤波器的代码片段:
import numpy as np from scipy.fft import fft, fftshift, ifft, ifftshift # Make a copy of the spectrum spectrum_filtered = np.copy(spectrum_avg) # Manually define some regions to be cropped and filtered crop_regions = [[379, 479], [620, 791]] for crop_region in crop_regions: # Crop the spectrum crop_left, crop_right = crop_region crop = np.copy(spectrum_avg[crop_left:crop_right]) # Subtract the minimum value min_val = np.min(crop) crop -= min_val # FFT crop_fft = np.abs(fftshift(fft(crop))) # Fit the baseline using a low-pass filter fit = butter_filter(crop_fft, cutoff=3, fs=crop_fft.size, order=5, btype='lowpass') # Remove the baseline, then perform an IFFT (this holds the rotational peaks) crop_fft_fit = crop_fft - fit crop_ifft = np.abs(ifftshift(ifft(crop_fft_fit))) # Subtract the rotational peaks crop_filtered = crop - crop_ifft # Replace the cropped region with the filtered spectrum (re-adding the minimum value) spectrum_filtered[crop_left:crop_right] = crop_filtered + min_val
示例光谱数据为文本格式,可直接导入进行测试。
现寻求针对该方法的改进建议、反馈与批评。
内容的提问来源于stack exchange,提问作者AlexP
相关产品推荐
相关产品推荐

