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

博文

借助CIAO软件计算河外X射线源的银河系中性氢柱密度的IDL程序

已有 3300 次阅读 2013-1-29 21:59 |系统分类:科研笔记| 银河系, 程序

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程序(原理傻瓜级)
收藏 IP: 123.86.144.*| 热度|

0

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

数据加载中...

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

GMT+8, 2024-11-23 19:29

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部