最終更新 : Dec. 14, 2015
cl> phelp system 個別のタスクについては、 cl> phelp system.files
cl> phelp language さらに個別の文法要素については、 cl> planguage.break
cl> phelp strings
cl> phelp scan cl> phelp print
cl> phelp mathfcns
cl> refer rotate searching the help database... rotate - Rotate and shift a list of 2-D images [imgeom]
cl> phelp rotate
...
SEE ALSO
imtranspose, imshift, magnify, lintran, geotran, geomap
# 画像の移動に関連して、 imshift などのtaskがあることが分かる
・ページャーで表示 cl> phelp sarith ・テキストファイル化、印刷する、WWW ブラウザで見る cl> help dispcor device="text" cl> help dispcor device="ps" | lpr cl> help dispcor device="html" > dispcor_help.html cl> !mozilla "dispcor_help.html" &
cl> imstat *fits[262:274,1022:1026] format- field="midpt" 1304.837 1309.775 1314.296 1318.359 1316.449 1321.353 1317.911 1293.023 cl> imstat *fits[262:274,1022:1026] format- field="midpt" | average 1312.000375 9.2913658066847 8
環境変数 clobberの設定。 cl> set clobber=yes (or no) clobber=no : 上書きなし (>先が存在すれば、エラー) clobber=yes : 上書き (>先が存在すれば、上書き)
cl> setstdplot=epsf cl> implot xxxx.fits = cl> setstdplot=lp でもとに戻る 他の出力については、 cl> phelp devices
cl> hselect *.fits $I 'EXPTIME == 900' le004082.fits le004083.fits le004084.fits le004085.fits le004086.fits ## header に ハイフン - が含まれる場合は、以下のような記法をする。 cl> hselect *.px.imh $I '@"POS-HWP" == 67.5' その他、"clpackage.lists"に役立ちtaskがある。
cl> printf("pi = %g\n", 3.14159)
pi = 3.14159
cl> s1 = "12:34:56.7"
cl> print(s1) | scanf("%d:%d:%g",hr,min,sec)
if( ! access( input_fn ) ){
printf( input_fn//" is not exist !!\n" )
bye
}
if( access( temp_fn ) )
delete( temp_fn )
imreplace( mask_fn//"[1:50,*]", rplc_val, lower=INDEF, upper=INDEF )
s_max以上のピクセルの値を、0に置き換える。 imreplace( mask_fn, 0, upper=s_min, lower=INDEF ) imreplace( mask_fn, 0, lower=s_max, upper=INDEF )
を選択して、imstaticsを実行する。 mimstatistics( input_fn, imasks=mask_fn, format-, \ field="mean, midpt, stddev, min, max" )
int npix
real mean
imstatistics( input_fn, format-, field="npix, mean" ) \
| scan( npix, mean )
bye
imcopy( template_fn, mask_fn, ver- )
file input_fn real exptime imgets ( input_fn, "EXPTIME" ) exptime = real( imgets.value )
imarith( input_fn , "max", s_max, output_fn )
imarith( input_fn , "min", s_min, output_fn )
imarith( input_fn, "/", input_fn, output_fn, divzero = 0. )
(注意)neary zeroのピクセルでは、divided by zeroの扱いが生じて
1ではなくzeroとなる場合がある。
(タスクが入力引数を持つ場合) cl> sample_task = sample_task.cl (タスクが入力引数を持たない場合) cl> $sample_task = sample_task.cl
cl> t_trace で、デバッグモードに入る。
cl> ren *.fts fits field=extn
cl> files le005372.fits le005373.fits cl> type o.lst le005372.fits le005373.fits のとき。 cl> sections @o.lst//_b opt="full" le005372_b.fits le005373_b.fits cl> sections tmp_@o.lst opt="full" tmp_le005372.fits tmp_le005373.fits tmp_le005374.fits tmp_le005375.fits cl> sections *.fits[2171:2190,101:1000] le005372.fits[2171:2190,101:1000] le005373.fits[2171:2190,101:1000] # ファイル名の一部や拡張子を変更したファイルリストを表示 cl> sections %le%lips%*.%fits%imh% lips005372.imh lips005373.imh #( %(arg1)%(arg2)% : 置換演算子 ) # 拡張子を除いたファイルリストを表示 (置換演算子の応用) cl> sections *%.fits%% lips005372 lips005373
cl> sections *.fits opt=no cl> = sections.nimages cl> 2
cl> cl.logfile = "logfilename.cl" cl> cl.keeplog = yes cl> # (works to be logged ) cl> cl.keeplog = no
print osfn( "home$login.cl" ) /home/akitaya/iraf/login.cl
cl> real ra cl> ra=12:55:53 cl> = ra 12.931388888889 cl> ra=150:11:12 cl> = ra 150.18666666667 cl> string ra_str cl> ra_str="12:43" cl> = ra_str 12:43 cl> = real( ra_str ) 12.716666666667
astutil> asttimes year=2002 month=10 day=26 time=1:54 obs=irtf # ASTTIMES: Observatory parameters for NASA Infrared Telescope Facility # timezone = 10 # longitude = 155.471999 ##YR MON DAY ZT UT EPOCH JD LMST 2002 10 26 SAT 1:54:00.0 11:54:00.0 2002.81724 2452573.9958 3:50:51.8
rytauobs.dat ---------------- 2002 3 1 20:11 2002 3 1 22:59 ---------------- のとき、 cl> asttime files="rytauobs.dat" obs=irtf # ASTTIMES: Observatory parameters for NASA Infrared Telescope Facility # timezone = 10 # longitude = 155.471999 ##YR MON DAY ZT UT EPOCH JD LMST 2002 3 1 FRI 20:11:00.0 6:11:00.0 2002.16498 2452335.7576 6:28:35.2 2002 3 1 FRI 22:59:00.0 8:59:00.0 2002.16530 2452335.8743 9:17:02.8
myobsdb.dat
----------------------------
observatory = "kanata"
name = "Hihashihiroshima Observatory"
longitude = 132:47
latitude = 34:22.65
altitude = 511.2
timezone = -9
----------------------------
のとき、
cl> set obsdb=myobsdb.dat
(環境変数obsdbでファイル指定。)
これで、obs=kanataが使えるようになる。
rytau_rvcor.dat ----------------------------------------------------- 2002 3 2 6:11:00.0 04:21:57.5 28:26:37 2000.0 2002 3 4 5:44:00.0 04:21:57.5 28:26:37 2000.0 2002 10 27 11:54:00.0 04:21:57.5 28:26:37 2000.0 ----------------------------------------------------- のとき、 cl> rvcor files="rytau_rvcor.dat" obs=irtf input=yes # RVCORRECT: Observatory parameters for NASA Infrared Telescope Facility # latitude = 19.826218 # longitude = 155.471999 # altitude = 4168 ##YR MO DY UT RA DEC VOBS ## HJD VOBS VHELIO VLSR VDIURNAL VLUNAR VANNUAL VSOLAR 2002 3 2 6:11:00 4:21:57 28:26:37 0.0 2452335.75734 0.00 -30.01 -39.00 -0.202 0.009 -29.817 -8.985 2002 3 4 5:44:00 4:21:57 28:26:37 0.0 2452337.73839 0.00 -29.92 -38.90 -0.174 0.004 -29.745 -8.985 2002 10 27 11:54:00 4:21:57 28:26:37 0.0 2452575.00052 0.00 16.56 7.58 0.046 0.007 16.510 -8.985
(1) 非等間隔スペクトル vi_020301_caii8498.xy :速度-強度 のテキストファイルスペクトル - dtype=nonlinear で、横軸を速度座標で記録 cl> rspectext vi_020301_caii8498.xy vi_020301_caii8498.fits dtype=nonlinear -> headerに、ピクセル番号と波長の対応付けが記録される。 (確認) cl> splot vi_020301_caii8498.fits (2) 等間隔スペクトル rspectext vi020301_caii8498.xy test.fits crval1=4000.0 cdelt1=10. 開始波長と波長間隔を設定。それぞれheaderに書き込まれる。
cl> set _gain = 2.20 cl> real gain cl> gain = real( envget( "_gain" )) cl> = gain 2.2
| strings | s1, s2, s3 |
|---|---|
| bolleans | b1, b2, b3 |
| integers | i1, i2, i3 |
| text file (list 型) | list |
設定・確認方法 cl> lparam cl cl> eparam cl cl> x=3.14 cl> =x
cl> help system が参考になる。
| C or shell | IRAF |
|---|---|
| cat | type, concatenate |
| continue | next |
| grep | match |
| rm | delete |
| mv | rename, movofiles, imrename |
| cp | copy |
| ls -1 | files |
| ls | dir |
| exit | bye |
| more, less | page |
| paste | joinlines |
| cut | fields |
| tr, sed | translit |
cl> mkscript temp.cl imcombine
string file1
string file2
file1 = mktemp ("tmp$prefix_")
# 論理ディレクトリ tmp内に、prefix_で始まる
# 一意なファイル名の一時ファイルを作成。
file2 = mktemp ("tmp$prefix_")
# 作業ディレクトリに作る場合。
...
delete( file1 )
delete( file2 )
# 最後にちゃんと消さないと、ゴミとして残るので注意!
procedure sampletask ( images )
struct *images
begin
string img, tmplist
tmplist = mktemp( _tmp_dampletask )
sections( images, option="fullname", > tmplist )
images = tmplist
while( fscan( images, img ) != EOF ){
# ...( handle file img here.)
}
delete( tmplist, ver-, >& "dev$null" )
end
# imcur (*imagecurs), wcs (int) はデフォルト定義されている
struct command # struct型の コマンド引数用変数を定義
string key
# "m"キーでカーソルのxy座標を読んでファイルに書き出し
# "q"で抜ける。
while( fscan(imcur, x, y, wcs, command )!= EOF ) {
key = substr( command, 1, 1) # コマンド文字列を受け取る
if (key == "m" ) {
print( x, y )
printf("%9.4f %9.4f\n", x, y, >> tmp_coord )
}
else if ( key == "q" )
break
}
("An Introductory User's Guide to IRAF SCripts; p. 42-43)
#
# comments
#
procedure lin_mskstat( input_fn , mask_fn , value1 )
file input_fn { prompt = "Input Image Name" }
file mask_fn { prompt = "Mask Image Name" }
real value1 { prompt = "Input Value" }
# main
begin
# delete temporary files (before main routine)
if( access( temp_fn ) == 1 ){
delete( temp_fn )
}
# main routine
# delete temporary files (after main routine)
delete( temp_fn )
bye
end
# end
login.cl に以下を追加。 stty erase ^H
ecl> history 30
ecl> ^^
ecl> ^10
ecl> ^com
ecl> binstddev
INTERNAL ERROR: parser gagged
called as: `binstddev ()'
のようなエラーが出たとき。
-> clスクリプトの最後の "end"のあとに、改行が漏れている、など。
Shift + Insert : 文字列張り付け Shift + PgUp, PgDn : スクロール