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

博文

计算BPT图上的y轴偏离角(IDL程序)

已有 3505 次阅读 2013-2-3 00:24 |个人分类:编程笔记|系统分类:科研笔记| 计算, 程序, angle

Function fai_BPT, x, y

;+
;NAME:
;     fai_BPT
;PURPOSE:
;     compute the angle from y axis for BPT digarm
;INPUT:
;     y --- flux ratio of [O III]/H_Beta
;     x --- flux ratio of [N II] /H_Alpha
;OUTPUT:
;     angle ---- angle from y axis
;METHOD:
;     see Kauffmann Guinevere 2003 MNRAS 346.1055
;REVISION HISTORY:
;     Original by DL.Wang,Oct-31-2007,Wed
;-

n_dim=size(x,/n_dimen)

x0=-0.45
y0=-0.50

xx=x-x0
yy=y-y0

angle=fltarr(n_elements(x))

if n_dim eq 0 then begin
   if xx eq 0.0 and yy gt 0.0 then angle=0.0
   if xx gt 0.0 and yy eq 0.0 then angle=90.0
   if xx eq 0.0 and yy lt 0.0 then angle=180.0
   if xx lt 0.0 and yy eq 0.0 then angle=270.0
   if xx gt 0.0 and yy gt 0.0 then angle=atan(xx/yy)*!radeg
   if xx gt 0.0 and yy lt 0.0 then angle=180.0+atan(xx/yy)*!radeg
   if xx lt 0.0 and yy lt 0.0 then angle=180.0+atan(xx/yy)*!radeg
   if xx lt 0.0 and yy gt 0.0 then angle=360.0+atan(xx/yy)*!radeg
endif else begin
   index1=where(xx eq 0.0 and yy gt 0.0,cc1)
   if cc1 gt 0 then angle[index1]=0.0
   index2=where(xx gt 0.0 and yy eq 0.0,cc2)
   if cc2 gt 0 then angle[index2]=90.0
   index3=where(xx eq 0.0 and yy lt 0.0,cc3)
   if cc3 gt 0 then angle[index3]=180.0
   index4=where(xx lt 0.0 and yy eq 0.0,cc4)
   if cc4 gt 0 then angle[index4]=270.0
   index5=where(xx gt 0.0 and yy gt 0.0,cc5)
   if cc5 gt 0 then angle[index5]=atan(xx[index5]/yy[index5])*!radeg
   index6=where(xx gt 0.0 and yy lt 0.0,cc6)
   if cc6 gt 0 then angle[index6]=180.0+atan(xx[index6]/yy[index6])*!radeg
   index7=where(xx lt 0.0 and yy lt 0.0,cc7)
   if cc7 gt 0 then angle[index7]=180.0+atan(xx[index7]/yy[index7])*!radeg
   index8=where(xx lt 0.0 and yy gt 0.0,cc8)
   if cc8 gt 0 then angle[index8]=360.0+atan(xx[index8]/yy[index8])*!radeg
endelse

return,angle

End


https://blog.sciencenet.cn/blog-456360-658961.html

上一篇:窄发射线BPT分类AGN(IDL程序)
下一篇:计算光谱的4000埃break(IDL程序)
收藏 IP: 123.86.145.*| 热度|

1 杨华磊

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

数据加载中...

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

GMT+8, 2024-9-21 04:13

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部