ds9で3色合成画像をつくる.

尾中研M1の高瀬くんから教えてもらいました.ds9で3色合成表示して,それをキャプチャすれば立派な3色合成画像の完成,と.


高瀬くんからもらった例文はこんな感じ.このシェルスクリプトを走らせればds9が開きます,と.

#!/bin/sh

dir=.
title=hogehoge
target=hogehoge

# 青,緑,赤を割り当てる画像ファイルのそれぞれの名前
bfile=blue.fits
gfile=green.fits
rfile=red.fits

(cd ${dir};ds9 -geometry +10+10 -title ${title} -rgb -blue ${bfile}  -green ${gfile} -red ${rfile} )&

exit
#現状では、XPAであとから読み込むことはできない見たい

# RGBフレーム間の相対座標を"image"にする
xpaset -p ${title} rgb system image

#3色全部logスケールにする関数
set_log(){
xpaset -p ${title} rgb channel red
xpaset -p ${title} scale log
xpaset -p ${title} rgb channel green
xpaset -p ${title} scale log
xpaset -p ${title} rgb channel blue
xpaset -p ${title} scale log
}

#3色全部linearスケールにする関数
set_linear(){
xpaset -p ${title} rgb channel red
xpaset -p ${title} scale linear
xpaset -p ${title} rgb channel green
xpaset -p ${title} scale linear
xpaset -p ${title} rgb channel blue
xpaset -p ${title} scale linear
}


# 設定用の関数を定義
#   z1 z2 contrast bias   
#R  1  2  3        4   
#G  5  6  7        8
#B  9 10 11       12
set_color(){
# 赤を設定する
xpaset -p ${title} rgb channel red
xpaset -p ${title} scale limits $1 $2
xpaset -p ${title} cmap value $3 $4
# 緑を設定する
xpaset -p ${title} rgb channel green
xpaset -p ${title} scale limits $5 $6 
xpaset -p ${title} cmap value  $7 $8
# 青を設定する
xpaset -p ${title} rgb channel blue
xpaset -p ${title} scale limits ${9} ${10}
xpaset -p ${title} cmap value  ${11} ${12}
}

#   z1 z2 contrast bias   
#R  1  2  3  4   
#G  5  6  7  8
#B  9 10 11 12

# Blue   N3  background    17
#            max        12000
# Green  S7  background   440
#            max        30000
# Red   S11  background  2200
#            max        30000

xpaset -p ${title} rgb system wcs 
xpaset -p ${title} view colorbar no

set_log
set_color 2200 30000 5.0 0.1 440 30000 5.0 0.1 17 12000 5.0 0.1