wendyxiaoqing的个人博客分享 http://blog.sciencenet.cn/u/wendyxiaoqing

博文

通过fits画光谱的idl程序

已有 4614 次阅读 2012-7-17 17:31 |个人分类:idl使用|系统分类:科研笔记

PRO galaxyredshift1
mydir='/media/Expansion/SDSSmatch/galaxy/SNR/SN10/eyegalaxy/1/'
savedir='/media/Expansion/SDSSmatch/galaxy/SNR/SN10/eyegalaxy/1/'
cd,mydir
f = FindFile('*.fits', count=numFiles)
print, 'number of files found:', numfiles

z=fltarr(numfiles)
thisDevice=!D.Name
Set_Plot, 'PS'
Device,Filename='galaxyredshift1.ps',/color,bits_per_pixel=8
 
  TVLCT, 0,0,255, 201 
  TVLCT, 255,0,0, 101 

for j=0, numFiles-1 do begin
 
       data = READFITS(f[j],header,/SILENT )      ;read data into data, header into header
       basewave = SXPAR( header,'COEFF0' )     ;find the starting wavelength of the spectrum in weird sloan units
       step = SXPAR( header,'COEFF1' )         ;find how big the wavelength step is in weird sloan units
       nsteps = SXPAR( header,'NAXIS1' )       ;find the # of pixels in the spectra
       wave = 10.0^( basewave + FINDGEN( nsteps ) * step )     ;now create an array for the wavelength values...
       datastructure = FLTARR(3,nsteps)    
       datastructure[0,*] = wave               ;fill it with wavelength
       datastructure[1,*] = REFORM( data[*,0] );flux
       datastructure[2,*] = REFORM( data[*,2] );noise 
       index=where(datastructure[0,*] gt 6563. and datastructure[0,*] lt 8100.) 
       cd,savedir
       indexplot=where(datastructure[0,*] gt 4000. and datastructure[0,*] lt 8900.)
       plot,datastructure[0,indexplot],datastructure[1,indexplot],position=[0.02,0.02,0.92,0.92],$
       xtitle='wave in vacuum',title=f[j],charsize=0.4
       
       ha=max(datastructure[1,index],index1)
       haw=wave[index[index1]]
       indexfit1=where(wave gt haw-10. and wave lt haw+10.)
        yfit1 =GAUSSFIT(wave[indexfit1], datastructure[1,indexfit1], coeff, NTERMS=6)    
        oplot,wave[indexfit1], yfit1, THICK=2,Color=101
        ;xfit1[*]=coeff[1]  高斯中心
        ;oplot,xfit1,y,Color=101
       z[j]=coeff[1]/6563.-1.
       endfor
Device,/Close_File
Set_Plot,thisDevice

END


https://blog.sciencenet.cn/blog-749052-593053.html

上一篇:ubuntu下MSN和qq的使用
下一篇:idl读gal_line_dr7_v5_2.fit的每行每列数据
收藏 IP: 159.226.169.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-8-1 23:17

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部