Exemplo n.º 1
0
def autoDetect(file, rad_src, rad_in_bkg, rad_out_bkg):
    # イベントファイルのヘッダから天体の RA, Dec を読み取る
    radec = sz_evt.radecObj(file)
    ra = radec[0]
    dec = radec[1]
    
    # 天体の赤道座標 -> 物理座標変換
    radecRef = sz_evt.radecRef(file)
    focx_obj = (ra - radecRef[1]) / radecRef[2] + radecRef[0]
    #focx_obj = (ra - radecRef[1]) / radecRef[2] / 2.418 + radecRef[0] # 2.418 はマジックナンバー。原因不明。
    focy_obj = (dec - radecRef[4]) / radecRef[5] + radecRef[3]
    
    # ソースリージョンファイルの作成
    f = open("src.reg", "w")
    
    hdr = """global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
physical
    """
    
    coord = str(focx_obj) + ',' + str(focy_obj) + ','
    f.write(hdr)
    f.write('circle(' + coord + str(float(rad_src) / 60. / abs(radecRef[2])) + ')')
    f.close()
    
    # バックグラウンドリージョンファイルの作成
    f = open("bkg.reg", "w")
    
    f.write(hdr)
    f.write('annulus(' + coord + str(float(rad_in_bkg) / 60. / abs(radecRef[2])) + ',' + str(float(rad_out_bkg) / 60. / abs(radecRef[2])) + ') # background')
    f.close()
Exemplo n.º 2
0
def focxyObj(file):
    # イベントファイルのヘッダから天体の RA, Dec を読み取る
    radec = sz_evt.radecObj(file)
    ra = radec[0]
    dec = radec[1]
    
    
    # 天体の赤道座標 -> 物理座標変換
    radecRef = sz_evt.radecRef(file)
    focx_obj = (ra - radecRef[1]) / radecRef[2] / 2.418 + radecRef[0] # 2.418 はマジックナンバー。原因不明。
    focy_obj = (dec - radecRef[4]) / radecRef[5] + radecRef[3]
    
    return [focx_obj, focy_obj]
Exemplo n.º 3
0
def mkRej(file, focx_obj, focy_obj, rad_src, rad_in_bkg, rad_out_bkg):
    # 基本情報を取得
    radecRef = sz_evt.radecRef(file)
    
    # ソースリージョンファイルの作成
    f = open("src.reg", "w")
    
    hdr = """global color=green dashlist=8 3 width=1 font="helvetica 10 normal roman" select=1 highlite=1 dash=0 fixed=0 edit=1 move=1 delete=1 include=1 source=1
physical
    """
    
    coord = str(focx_obj) + ',' + str(focy_obj) + ','
    f.write(hdr)
    f.write('circle(' + coord + str(float(rad_src) / 60. / abs(radecRef[2])) + ')')
    f.close()
    
    # バックグラウンドリージョンファイルの作成
    f = open("bkg.reg", "w")
    
    f.write(hdr)
    f.write('annulus(' + coord + str(float(rad_in_bkg) / 60. / abs(radecRef[2])) + ',' + str(float(rad_out_bkg) / 60. / abs(radecRef[2])) + ') # background')
    f.close()