2009.11/24
前回作ったdisshift1117oddやdisshift1117even内の81枚ずつの位置合わせ済画像を足しあわせる。(imcombine)
だが、装置には必ず死んだダメpixelがありdisshift1117〜内の各画像はダメpixelの情報をそのまま残している。なので1枚1枚のファイルのダメpixelにmaskがけしてからimcombineする。
maskファイルはMCSREDが公表してるMOIRCSチップ用のものをとってきて使う。


☆其の一 81枚の各ファイルにmaskがけを行う

・MCSREDからmaskの画像ファイルをとってくる
MCSREDのMASKディレクトリに移動し
$ cd ~/MCSRED/MASK/
今使ってるデータの日付(2006-9-1)に近いmaskファイルを探して作業スペースにコピーする。今回ならgcmask1r_aoc_aug06.plとgcmask2r_aoc_aug06.pl。
$ cp gcmask1r_aoc_aug06.pl ~/irafwork/practice/
$ cp gcmask2r_aoc_aug06.pl ~/irafwork/practice/

ちなみにmaskファイルはすでにdistortion補正済みである

◎各ファイルに合わせてmaskファイルを画像変換
81枚のファイルにmaskがけしていきたいが、81枚は先週位置合わせのために画像変換してしまっているので、maskも同じ画像変換しないといけない(geotran)

・まず入力ファイルを用意(gcmask?r_aoc_aug06.plが81枚)
$ awk '{print "gcmask1r_aoc_aug06.pl"}' disshift1117odd > maskinodd
$ awk '{print "gcmask2r_aoc_aug06.pl"}' disshift1117even > maskineven
・出力ファイルも用意しとく
中身はdisshift38???.plが81枚ずつ
$ awk '{print substr($1,1,13)".pl"}' disshift1117odd > mask1124odd
$ awk '{print substr($1,1,13)".pl"}' disshift1117even > mask1124even

・maskファイルを100倍
cl> !ds9 &
cl> display gcmask1r_aoc_aug06.pl 1 →gcmask1r_aoc_aug06.pl
z1=0. z2=1.

→元のmaskファイルはダメpixelのカウントが1、普通の所が0になってる
が、これをこのままgeotranにかけるとできあがりのファイルが全pixelのカウント=0になってしまう。どうもカウント値=0〜1がよくないらしいので、カウントを100倍したmaskファイルを作る。

cl> imarith gcmask1r_aoc_aug06.pl * 100 gcmask1r_aoc_aug06.pl
cl> imarith gcmask2r_aoc_aug06.pl * 100 gcmask2r_aoc_aug06.pl

・geotranで変換
cl> epar geotran
                 I R A F
         Image Reduction and Analysis Facility
PACKAGE = immatch
  TASK = geotran
input  =  @maskinodd Input data
output =  @mask1124odd Output data
database= database1117odd.cat Name of GEOMAP database file           //先週disshift1117oddを作ったときと同じ変換規則//
transfor=  @formatch1117odd Names of coordinate transforms in database file //databaseの中にある各変換//
(geometr=       geometric) Transformation type (linear,geometric)
(xin  =          INDEF) X origin of input frame in pixels
(yin  =          INDEF) Y origin of input frame in pixels
(xshift =         INDEF) X origin shift in pixels
(yshift =         INDEF) Y origin shift in pixels
(xout  =         INDEF) X origin of output frame in reference units
(yout  =         INDEF) Y origin of output frame in reference units
(xmag  =         INDEF) X scale of input picture in pixels per reference
(ymag  =         INDEF) Y scale of input picture in pixels per reference
(xrotati=         INDEF) X axis rotation in degrees
(yrotati=         INDEF) Y axis rotation in degrees
(xmin  =         INDEF) Minimum reference x value of output picture
(xmax  =         INDEF) Maximum reference x value of output picture
(ymin  =         INDEF) Minimum reference y value of output picture
(ymax  =         INDEF) Maximum reference y value of output picture
(xscale =           1.) X scale of output picture in reference units per
(yscale =           1.) Y scale of output picture in reference units per
(ncols =          2848) Number of columns in the output picture     //今2848*2848にする//
(nlines =          2848) Number of lines in the output picture      
(xsample=           1.) Coordinate surface sampling interval in x
(ysample=           1.) Coordinate surface sampling interval in y
(interpo=         linear) Interpolant
(boundar=        constant) Boundary extension (nearest,constant,reflect,wra //余白となる所に何を入れるか//
(constan=            0.) Constant boundary extension              //今はcountを0にしてしまう//
(fluxcon=           yes) Preserve image flux?
(nxblock=           512) X dimension of working block size in pixels
(nyblock=           512) Y dimension of working block size in pixels
(verbose=           yes) Print messages about the progress of the task
(mode  =           ql)
(:go)

上手く出来たか適当に確認
cl> display disshift38575.fits 1 zs- zr- z1=0 z2=200
cl> display disshift38575.pl 2 zs- zr- z1=0 z2=100
複数枚に対してこれを行い位置合ってるか確認

偶数チップも同様にgeotran
cl> epar geotran
                 I R A F
         Image Reduction and Analysis Facility
PACKAGE = immatch
  TASK = geotran
input  =  @maskineven Input data
output =  @mask1124even Output data
database= database1117even.cat Name of GEOMAP database file           //先週disshift1117evenを作ったときと同じ変換規則//
transfor=  @formatch1117even Names of coordinate transforms in database file //databaseの中にある各変換//
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・(略)・・・・・・・・・・・・・・
・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・


◎81枚のファイルに対してmaskがけ(clスクリプト)
disshift38???.fitsという画像ファイルが偶奇で81枚ずつあるが、そのヘッダの中に今作ったdisshift38???.plというmaskの情報を加えてやる=maskがけ

右のようなmaskがけ用のclスクリプトを作る→1124maskodd.cl(奇数用)
                     1124maskeven.cl(偶数用)

実行
cl> cl< 1124maskodd.cl
cl> cl< 1124maskeven.cl

これでflatわり、sky引き、maskがけした画像ファイルが偶奇それぞれ81枚ずつ出来た。


☆其の二 81枚のファイルを足し合わせて精度のよい1枚をつくる

imcombineを使うが今回はcombine type=averageにする
cl> epar imcombine
                   I R A F
           Image Reduction and Analysis Facility
PACKAGE = immatch
  TASK = imcombine
input  =   @disshift1117odd List of images to combine //imcombineにかけるファイル//
output =   mcomb1124odd.fits List of output images //出力//
(headers=            ) List of header files (optional)
(bpmasks=            ) List of bad pixel masks (optional)
(rejmask=            ) List of rejection masks (optional)
(nrejmas=            ) List of number rejected masks (optional)
(expmask=            ) List of exposure masks (optional)
(sigmas =            ) List of sigma images (optional)
(logfile=        STDOUT) Log file
(combine=        average) Type of combine operation //pixel毎に81枚のflameの平均値をとる//
(reject =        sigclip) Type of rejection
(project=           no) Project highest dimension of input images?
(outtype=          real) Output image pixel datatype
(outlimi=            ) Output limits (x1 x2 y1 y2 ...)
(offsets=          none) Input image offsets
(masktyp=       goodvalue) Mask type  //BMPがgoodvalueのときだけimcombineさせる//
(maskval=           0.) Mask value
(blank =           0.) Value if there are no pixels
(scale =          none) Image scaling
(zero  =          none) Image zero point offset
(weight =          none) Image weights
(statsec=            ) Image section for computing statistics
(expname=            ) Image header exposure time keyword
(lthresh=         -1000.) Lower threshold
(hthresh=          INDEF) Upper threshold
(nlow  =            1) minmax: Number of low pixels to reject
(nhigh =            1) minmax: Number of high pixels to reject
(nkeep =            1) Minimum to keep (pos) or maximum to reject (neg)
(mclip =           yes) Use median in sigma clipping algorithms?
(lsigma =           3.) Lower sigma clipping factor
(hsigma =           3.) Upper sigma clipping factor
(rdnoise=           0.) ccdclip: CCD readout noise (electrons)
(gain  =           1.) ccdclip: CCD gain (electrons/DN)
(snoise =           0.) ccdclip: Sensitivity noise (fraction)
(sigscal=           0.1) Tolerance for sigma clipping scaling corrections
(pclip =          -0.5) pclip: Percentile clipping parameter
(grow  =           0.) Radius (pixels) for neighbor rejection
(mode  =           ql)
(:go)

結果を見てみると
cl> display mcomb1124odd.fits 1 zs- zr- z1=0 z2=100 →こんなの
コントラストがだいぶはっきりしてきた。

同様に偶数もimcombine
結果
cl> display mcomb1124even.fits 2 zs- zr- z1=0 z2=100 →こんなの


以上で、flat割り、sky引き、位置合わせ、maskがけ、81枚分足し合わせをした偶奇それぞれのチップ毎の画像mcomb1124odd.fitsとmcomb1124even.fitsが完成した。


目次に戻る