version 1.0 November 2010 PyRAF Y. Nakajima Computer and Data Management Division Subaru Telescope NAOJ

Similar documents
Microsoft PowerPoint - テキスト-Web掲載版.pptx

CL 2. (bash) 3. IRAF IRAF(Imaging Reduction and Analysis Facility) & Facility IRAF IRAF img (M81) : MT819[1-8].fits : MT869?.fits,

1.2. スクリプト作成と実行 いくつかスクリプトの例を見てみましょう例 : shiraf_display ( もちろん勝手にこう命名しただけです 他と混同しなければ何でも ) #!/iraf/irafbin/bin.sunos/cl.e -f reset stdimage = imt1024 lo

X Window System X X &

GNU Emacs GNU Emacs

fx-9860G Manager PLUS_J

Microsoft PowerPoint - テキスト 開催.pptx

1-4 int a; std::cin >> a; std::cout << "a = " << a << std::endl; C++( 1-4 ) stdio.h iostream iostream.h C++ include.h 1-4 scanf() std::cin >>

New version (2.15.1) of Specview is now available Dismiss Windows Specview.bat set spv= Specview set jhome= JAVA (C:\Program Files\Java\jre<version>\

2.2 Sage I 11 factor Sage Sage exit quit 1 sage : exit 2 Exiting Sage ( CPU time 0m0.06s, Wall time 2m8.71 s). 2.2 Sage Python Sage 1. Sage.sage 2. sa

Specview Specview Specview STSCI(Space Telescope SCience Institute) VO Specview Web page htt

untitled

HIS-CCBASEver2

Microsoft Word - D JP.docx

_...j.f......_..

unix.dvi

4

たのしいプログラミング Pythonではじめよう!

Python C/C++ IPMU IRAF

¥Í¥Ã¥È¥ï¡¼¥¯¥×¥í¥°¥é¥ß¥ó¥°ÆÃÏÀ


10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

MOTIF XF 取扱説明書

4

Microsoft Word - Meta70_Preferences.doc

Microsoft PowerPoint - IRAF講習会 ppt

UNIX

離散数理工学 第 2回 数え上げの基礎:漸化式の立て方

I II 3 III

Visual Python, Numpy, Matplotlib

LSM5Pascal Ver 3.2 GFP 4D Image VisArt Carl Zeiss Co.,Ltd.

ユーザ デバイス プロファイルの ファイル形式

program.dvi

R による統計解析入門

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l

DocuWide 2051/2051MF 補足説明書

PYTHON 資料 電脳梁山泊烏賊塾 PYTHON 入門 ゲームプログラミング スプライトの衝突判定 スプライトの衝突判定 スプライトの衝突判定の例として インベーダーゲームのコードを 下記に示す PYTHON3 #coding: utf-8 import pygame from pygame.lo

1 1.1 C 2 1 double a[ ][ ]; 1 3x x3 ( ) malloc() malloc 2 #include <stdio.h> #include

2 (4)-7

目 次 Java GUI 3 1 概要 クラス構成 ソースコード例 課題...7 i

グローバル タイトル変換テーブルの編集

Python Speed Learning

ProVisionaire Control V3.0セットアップガイド

Cleaner XL 1.5 クイックインストールガイド

tebiki00.dvi

num2.dvi

IRAF講習会 CLスクリプトの作成

Python Speed Learning

r08.dvi

web07.dvi

CAC

RHEA key

Microsoft Word - PIVマニュアル.doc

Image Browser Ver3.5 Manual. Zeiss Image Browser Ver3.5 p2. p3. p5. p7. p9. p13. p17. p19. p23 Appendix 1. p25 Appendix 2. p27 LSM Image Browser http:


Visual Python, Numpy, Matplotlib

荳也阜轣ス螳ウ蝣ア蜻・indd

Œ{ٶ/1flà

1

: gettoken(1) module P = Printf exception End_of_system (* *) let _ISTREAM = ref stdin let ch = ref ( ) let read () = (let c =!ch in ch := inp

mstrcpy char *mstrcpy(const char *src); mstrcpy malloc (main free ) stdio.h fgets char *fgets(char *s, int size, FILE *stream); s size ( )

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

IDL_lecture_12Jan.ppt


untitled

cpp1.dvi

LIN

IRAFを触ったことがある プログラミングをかじったことがある (Pythonでなくてもよい) 日程進行状況によって変更することもあります 1 日目 13:00-13:30 受付 13:30 - 講習開始世話人の話 ( 計算機の説明ほか ) 13:40-17:00 ( 演習と休憩をはさみながら )

2: 3: A, f, φ f(t = A sin(2πft + φ = A sin(ωt + φ ω 2πf 440Hz A ( ( 4 ( 5 f(t = sin(2πf 1t + sin(2πf 2 t = 2 sin(2πt(f 1 + f 2 /2 cos(2πt(f 1 f

ruby novice ruby novice ruby novice.

dTVIIman.PDF

Transcription:

version 1.0 November 2010 PyRAF Y. Nakajima Computer and Data Management Division Subaru Telescope NAOJ

Chapter 1 PyRAF 1.1 PyRAF PyRAF IRAF Python STScI 1998 (1) IRAF-CL (2) CL-? (3) IRAF Python wrapper / IRAF CL- PyRAF PyRAF Python 1

2 CHAPTER 1. PYRAF Python IRAF Python CL Python Python 1.2 PyRAF 1.2.1 PyRAF IRAF CL pyraf IRAF PyRAF ~/iraf login.cl PyRAF iraf mkiraf IRAF-CL --> IRAF-CL --> imhead dev$pix long+ dev$pix[512,512][short]: m51 B 600s No bad pixels, min=-1., max=19936. Line storage mode, physdim [512,512], length of user area 1621 s.u. Created Mon 23:54:13 31-Mar-1997, Last modified Sun 16:37:53 12-Mar Pixel file "HDR$pix.pix" [ok] KPNO-IRAF / 31-03-97 / IRAF-MAX= 1.993600E4 / DATA MAX IRAF-MIN= -1.000000E0 / DATA MIN...... imstat --> imstat dev$pix # IMAGE NPIX MEAN STDDEV MIN MAX dev$pix 262144 108.3 131.3-1. 19936. ds9 disp -->! ds9 & --> disp dev$pix frame to be written into (1:16) (1): z1=35. z2=346.0218 IRAF ecl tab

1.2. PYRAF 3 PyRAF -->.exit PyRAF logfile -->.logfile[filename[append overwrite]] append logfile.logfile IRAF-CL PyRAF 1.2.2 GUI epar PyRAF epar GUI (Unlearn) Help

4 CHAPTER 1. PYRAF GUI --> imstat dev$pix fields=midpt,stddev --> iraf.imstat( dev$pix, fields= midpt,stddev ) --> iraf.imstat.fields= image,midpt,mode --> iraf.imstat( dev$pix ) 1.2.3 PyRAF xgterm CL xterm imexam radial profile xterm CL xgterm PyRAF OpenGL Tkinter --> prow dev$pix xgterm print save [Window] [New] 1.2.4 --> i = iraf --> i.imstat.fields= image,midpt,mode --> i.imstat( dev$pix )

1.2. PYRAF 5 iraf Stdout=1 --> s = iraf.imhead("dev$pix", long=yes, Stdout=1) --> print s[0] dev$pix[512,512][short]: m51 B 600s --> iraf.head(nl=3, Stdin=s) dev$pix[512,512][short]: m51 B 600s No bad pixels, min=-1., max=19936. Line storage mode, physdim [512,512], length of user area 1621 s.u. Stdin Stderr pyraf -s s silent pyraf -h

Chapter 2 PyRAF 2.1 (dev$pix) imstat imstat1.py iraf.images() iraf.imstat("dev$pix") chmod +x imstat1.py PyRAF 1 python python imstat1.py python 3 PyRAF 5 images imstat 6 [ ] python 6 1 7

8 CHAPTER 2. PYRAF PyRAF imstat2.py def run_imstat(): iraf.images() iraf.imstat("dev$pix") PyRAF 1 import imstat2 run imstat() imstat2.run imstat() : PyRAF import def imstat-2.py imstat 2.py imstat2.py PyRAF imstat3.py def run_imstat(): iraf.images() iraf.imstat("dev$pix") if name == " main ": run_imstat() chmod +x imstat3.py PyRAF import imstat3 imstat3.run imstat() PyRAF chmod +x mkiraf login.cl login.cl images iraf.images() iraf.imstat() (mkimage.py) 1 login.cl python

2.2. 9 def run_mkimage(): iraf.imred(_doprint=0) iraf.ccdred(_doprint=0) iraf.ccdtest() iraf.mkimage("test.fits","make","100","2","256 256") if name == " main ": run_mkimage() doprint=0 doprint=1 2.2 imstat file.py import os,sys def imstat_file(infile): os.access sys.argv sys.argv[1] infile if os.access(infile, os.r_ok): f=open(infile) for line in f: fname, xx, yy = line[:-1].split( ) if not line.startswith("#"): fitsname=fname+.fits if os.access(fitsname, os.r_ok): iraf.imstat(fname) else: print "Error: can t read", fname f.close() else: print "Error: can t open", infile if name == " main ": imstat_file(sys.argv[1]) imstat file

10 CHAPTER 2. PYRAF %more hoge.list ff0010 10 10 ff0011 8 8 ff0012 11 8 ff0013 11 8 %imstat_file.py hoge.list (.fits ) imstat # imstat (imstat file2.py) import os,sys def imstat_file(infile): if os.access(infile, os.r_ok): fout=open( imstat_out.txt, w ) f=open(infile) for line in f: fname, xx, yy = line[:-1].split( ) if not line.startswith("#"): fitsname=fname+.fits if os.access(fitsname, os.r_ok): iraf.imstat.fields= image,mean,midpt,stddev out_imstat=iraf.imstat(fname,stdout=1) print >> fout, out_imstat[1] else: print "Error: can t read", fname f.close() fout.close() else: print "Error: can t open", infile if name == " main ": imstat_file(sys.argv[1]) imstat out imstat # IMAGE MEAN MIDPT STDDEV out imstat[0]

2.2. 11 iraf.imstat(fname,stdout="out.txt",stderr="err.txt") Stdout="STDOUT" Stderr="STDERR" import os,sys os sys python python math, shutil, glob import os,sys,math,shutil,glob def run_myscript(): for file in glob.glob( *.fits ): os.remove(file) x=100 y=math.log10(x) prefix=[ jband, hband, kband ] for band in prefix: image=band+ 0001.fits shutil.copy(image, temp.fits ) os.system( myprog temp.fits ) os.rename( temp.fits, band+ temp.fits ) copy remove iraf imcopy delete os.sysyem UNIX SExtractor

12 CHAPTER 2. PYRAF [ ] (1) imstat file.py (2) ( ) (skylevel) (stddev) digiphot.apphot.daofind daofind datapars.fwhmpsf = 2.2 datapars.sigma = stddev datapars.datamin = skylevel-6*stddev datapars.datamax = 15000 datapars.readnoise = 30 datapars.epadu = 5 findpars.threshold = 10 (3) daofind apphot.phot daofind datapars phot centerpars.cbox = 5 centerpars.maxshift = 2 fitskypars.annulus = 10 fitskypars.dannulu = 5 photpars.aperture = 9 (4) phot.mag.1 xc, yc, mag, merr, cier, sier, pier txdump

2.3. 13 2.3 python try:except: PyRAF IRAF try:except: (trytest.py) def test_try(): try: iraf.columns("garbage",37) except iraf.iraferror, e: print "error was caught" print e if name == " main ": test_try() try:except: IRAF 2.4 python PyRAF 2 epar mytask mytask.par login.cl uparm inword,s,a,"",,,"string to print" xx,r,a,5.,,,"real value" iy,i,a,1,,,"test integer" mode,s,h,"al" inword xx iy xx 5. iy 1 mytask.py 2 IRAF-CL login.cl package user task myscript ="/home/nakajima/script/myscript.cl"

14 CHAPTER 2. PYRAF def mytask(inword,xx,iy): print inword yy=2.0*xx ii=10*iy print "yy=%.1f ii=%d" % (yy,ii) printf parfile = iraf.osfn("home$script/mytask.par") t = iraf.iraftaskfactory(taskname="mytask", value=parfile, function=mytask) iraf.osfn() par mytask PyRAF --> pyexecute("home$script/mytask.py") PyRAF login.cl keep pyexecute("home$script/mytask.py") epar mytask GUI