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程序)