# BENCH2.CL # # A VERY rough benchmark script for testing IRAF on different systems # To run, type the following at cl> prompt. # task bench = bench.cl # bench 10 # test 10 images # # Originally by: Chris Smith, 13 Aug 1999 # Last modified: 29 Dec 2003, MJF # procedure bench (nimages) int nimages {prompt="No. of images to process"} begin string dum1, dum2, time1, time2 real ar, t0, t1, t2, t3, t4, tf, tsec, tmake, tproc, tcomb, tmed int l_nim, m_nim # load the needed tasks (if necessary) BEFORE timer starts if (!defpac("noao.artdata")) { artdata } flpr 0 l_nim = nimages print(" ") time() | scan (dum1, time1, dum2) print("Bench started at ",time1) time() | scan (dum1, t0, dum2) print(" ") print ("=====> Making images...") printf (" Making zero...\r") mknoise ("zimage", output="", title="zero image", ncols=2048, nlines=2048, header="artdata$stdheader.dat", background=0., gain=1., rdnoise=2., poisson=no, seed=1, cosrays="", ncosrays=100, energy=30000., radius=0.5, ar=1., pa=0., comments=yes) printf (" Making flat...\r") mknoise ("fimage", output="", title="flat image", ncols=2048, nlines=2048, header="artdata$stdheader.dat", background=30000., gain=1., rdnoise=1., poisson=no, seed=1, cosrays="", ncosrays=0, energy=30000., radius=0.5, ar=1.0, pa=0., comments=yes) printf (" Making "//l_nim//" objs...\r") for (i=1; i <= l_nim; i = i + 1) { printf ("image%0d\n", i) | scan (s1) printf (" image %d of %d \r", i, l_nim) mknoise (s1, output="", title="obj image", ncols=2048, nlines=2048, header="artdata$stdheader.dat", background=500., gain=1., rdnoise=5., poisson=no, seed=i, cosrays="", ncosrays=100, energy=30000., radius=0.5, ar=1., pa=0., comments=yes) } printf (" \r") time() | scan (dum1, t1, dum2) # PROC SIMULATION SECTION # # Flat normalization is usually done realtime in memory in ccdproc, # but writing the image might be similar to the temp image in ccdproc print ("=====> Normalizing flat...") imarith ("fimage", "/", "30000.", "fimage", title="", divzero=1., hparams="", pixtype="", calctype="", verbose=no, noact=no) print ("=====> Subtracting zero from "//l_nim//" images...") imarith ("image*", "-", "zimage", "image*", title="", divzero=0., hparams="", pixtype="", calctype="", verbose=no, noact=no) print ("=====> Dividing flat into "//l_nim//" images...") imarith ("image*", "/", "fimage", "image*", title="", divzero=0., hparams="", pixtype="", calctype="", verbose=no, noact=no) # END of PROC SIMULATION SECTION time() | scan (dum1, t2, dum2) printf ("=====> Combining "//l_nim//" images...\n") imcombine ("image*", "ocimage", nrejmasks="", sigma="", logfile="STDOUT", combine="average", reject="crreject", project=no, outtype="real", offsets="none", masktype="none", maskvalue=0., blank=0., scale="none", zero="none", weight="none", statsec="", expname="", lthreshold=INDEF, hthreshold=INDEF, nlow=1, nhigh=1, nkeep=1, mclip=yes, lsigma=3., hsigma=3., rdnoise="5", gain="1", snoise="0.", sigscale=0.1, pclip=-0.5, grow=0, >& "dev$null") time() | scan (dum1, t3, dum2) files ("image1*") | count | scan (m_nim) printf ("=====> Median filtering "//m_nim//" images...\n") median ("image1*", "%image1%imagem1%*", 9, 9, zloreject=INDEF, zhireject=INDEF, boundary="nearest", constant=0., verbose=no) time() | scan (dum1, t4, dum2) print(" ") print ("=====> Deleting all images...") imdel ("image*,ocimage,zimage,fimage", yes, verify=no, default_acti=yes) time() | scan (dum1, tf, dum2) time() | scan (dum1, time2, dum2) print(" ") print("Bench started at ",time1) print("Bench ended at ",time2) print(" ") tsec = (tf - t0)*3600. tmake = (t1 - t0)*3600. tproc = (t2 - t1)*3600. tcomb = (t3 - t2)*3600. tmed = (t4 - t3)*3600. printf ("Total execution time = %7.1f seconds\n",tsec) printf (" Total time Make %d imgs Proc %d imgs Combine %d imgs Median 1 img\n", (l_nim+2), l_nim, l_nim) printf (" %7.1f %7.1f %7.1f %7.1f %7.1f\n",tsec,tmake,tproc,tcomb,tmed) end