画像上に写っている2MASS天体の(x, y)座標をimexamで求めて、その(ra,dec)をAladinから取得して
(x) (y) (ra) (dec)
と羅列したファイル(match.dat)をつくる。僕の場合は
cat << EOF > cat.dat
#2MASS 13253566+2738079
2963.47 778.45 11.14 349487.7 964.08 79 INDEF 0.057 44.4 5776.67 13.61
#2MASS 13260434+2740329
2247.64 2671.06 12.45 105180.7 879.94 78 3.55 0.057 78.8 3574.68 5.27
#2MASS (Catalog ID)
(Output of imexam + ",")
.......
EOF
としたうえで、
setenv XYERR 0.4
gawk '{if($1=="#2MASS"){printf("%s ",$2)}else{print($1,$2)}}' 1jcat.dat > tmp2.dat
gawk '{printf("grep %s fp_2mass.fp_psc3764.tbl\n",$1)}' tmp2.dat | csh |gawk '{print($1,$2,$3,$4)}' > tmp.dat
paste tmp.dat tmp2.dat | gawk -v xyerr=$XYERR '{if($3<=xyerr & $4<=xyerr)print($6,$7,$1,$2)}'> cat.dat
# Reject objects with peak count > 5000
gawk '{if($1=="#2MASS"){id=$2}else{if(($5+$10)<5000)print(id,$1,$2)}}' j${DETECTOR}cat.dat > tmp2phot.dat
gawk '{printf("grep %s fp_2mass.fp_psc3764.tbl\n",$1)}' tmp2phot.dat | csh |gawk '{print($0)}' > tmpphot.dat
# Reject objects with mag error > 0.3, blend , and contamination.
setenv MAGERR 0.3
paste tmp2phot.dat tmpphot.dat |gawk -v magerr=$MAGERR '{bl=substr($24,1,1);co=substr($25,1,1);if($12 <= magerr & bl==1 & co==0)print($0)}'> phot.dat
とした。(phot.datは、このあとの等級原点を出す際に使うファイル。)
マッチングした天体をプロットするためのregionファイル(match.reg)も
cat << EOF > match.reg
global color=red font="helvetica 10 normal" select=1 edit=1 move=1 delete=1 include=1 fixed=0 source
EOF
gawk '{printf("fk5;circle(%s,+%s,3.6\")\n",$3,$4)}' match.dat >> match.reg
としてつくっておく。