Pro ciao_prop_colden,ra,dec,nh_gal,ciao_path=ciao_path, $
upload_file=upload_file,output_file=output_file
;+
;NAME:
; ciao_prop_colden
;PURPOSE:
; Calculate the Total Galactic H I Column Density by CIAO
; prop_colden
;INUT:
; RA: Right ascension in decimal degrees, numeric scalar or vector
; DEC: Declination in decimal degrees, numeric scalar or vector
;OPTIONAL KEYWORD INPUT:
; ciao_path: path to 'ciao.csh', default it is
; '/data/software/chandra/ciao-4.0/bin/'
; upload_file: name for uploading by CIAO prop_colden
; default it is 'ciao_prop_colden_upload'
; output_file: name for outputing by CIAO prop_colden
; default it is 'ciao_prop_colden_upload.out'
;METHOD:
; see http://chandra.ledas.ac.uk/ciao/ahelp/colden.html
;REVISION HISTORY:
; Original by DL.Wang,Sep-22-2008
;-
;============================================================
; STEP 1: build the data file for inputing CIAO prop_colden
;============================================================
;Precess positions from J2000.0 (FK5) to B1950.0 (FK4)
bprecess, ra, dec, ra_1950, dec_1950
;Return RA and Dec as character string(s) in sexigesimal format
radec=adstring(ra_1950, dec_1950, 1)
;Print data into file
if n_elements(upload_file) eq 0 then upload_file='ciao_prop_colden_upload'
openw,lun,upload_file,/get_lun
for i=0L,n_elements(ra)-1 do printf,lun,radec[i],format='(A27)'
free_lun,lun
;============================================================
; STEP 2: Calculate the Total Galactic H I Column Density
; by CIAO prop_colden
;============================================================
if n_elements(output_file) eq 0 then output_file='ciao_prop_colden_upload.out'
if n_elements(ciao_path) eq 0 then ciao_path='/data/software/chandra/ciao-4.0/bin/'
spawn,'source '+ciao_path+'ciao.csh'
spawn,'prop_colden'+' :'+upload_file+':'+output_file
;=============================================================
; STEP 3: get the Total Galactic H I Column Density
; from output file
;=============================================================
readcol,output_file,format='X,X,X,X,X,X,X,X,F',skipline=4,nh_gal
print,'NH (10**20 per cm**2)'
End
https://blog.sciencenet.cn/blog-456360-657697.html
上一篇:
天文学学生的IDL语言编程菜鸟笔记(五)疯狂spawn下一篇:
多数组抽取相同下标得到新的多数组的IDL程序(原理傻瓜级)