% Author:shizhixin
% Email:szhixin@gmail.com
% Blog:http://blog.csdn.net/shizhixin
% Date:2012-03-12
% 通过退红移,中值滤波,然后归一化对光谱进行处理,对比LAMOST与SDSS的光谱。
% 光谱文件为:DR8: 4.fits
% LAMOST: 1.fits
% 参数dered为是否退红移,area处理的波长区间,w中值滤波的窗口半径,边界未做处理。
% 如Dered=0 area=all w=0 5 50 100
% 表示下面四个图都未退红移,并且处理的是整个光谱区间,
% 依次为未滤波w=5、w=5、w=50、w=100
clc,clear,close all
filename_dr8 = 'compare\4.fits';
filename_lamost = 'compare\1.fits';
dered = true;
[head_dr8 lamda_dr8 flux_dr8 z_dr8] = read_dr8_flux(filename_dr8,dered,false);
[head_lamost lamda_lamost flux_lamost z_lamost] = read_lamost_fits(filename_lamost,dered,false);
area = [3400 6780];%以退红移后的波长为标准
if dered == 0
area =area*(1+z_dr8);
end
%整个区间
area = [max([lamda_dr8(1) lamda_lamost(1)]) min([lamda_dr8(end) lamda_lamost(end)])];
figure
[lamda1, flux1] = get_window_flux(area, lamda_lamost, flux_lamost, true)
title('LAMOST');
figure
[lamda2, flux2] = get_window_flux(area, lamda_dr8, flux_dr8, true)
title('SDSS');
figure
w_filter = [0 5 50 100];
for i=1:length(w_filter)
wflux1 = meanfilter(lamda1, flux1, w_filter(i));%中值滤波
wflux2 = meanfilter(lamda2, flux2, w_filter(i));
wflux1 = (wflux1-min(wflux1))/(max(wflux1)-min(wflux1));%归一化
wflux2 = (wflux2-min(wflux2))/(max(wflux2)-min(wflux2));
subplot(2,2,i);
plot(lamda1,wflux1);
hold on
plot(lamda2,wflux2);
end
通过中值滤波,归一化对比LAMOST与SDSS的光谱
最新推荐文章于 2022-10-31 23:27:22 发布