; ROOFGLOW.PRO ; ; Originally written to show images from Polar Camera initial field test ; at Ryning Farm Observatory ; Modified 1993/1/29 by DPS to handle images from image tree structure ; on /jasper/cnsr3_data1 ; Modified 16 July 1993 from show.pro ; ; create byte-valued input parameters mask=BYTARR(256,256) ; load various string-valued arrays needed s='' !ORDER=1 ; set colour table loadct,13 ; create title for image plot wtitle='Polar Camera OH Filter Images, 14 July 1993, Science B Roof' ; define mask for images, with fixed horizon at 150 superpixels prad=150 d256=SHIFT(dist(256),128,128) & base=WHERE(d256 GT 150) wprad=WHERE(d256 LE prad) & mask(wprad)=1 ; define paths to desired images ohrpath='/jasper/cnsr3_data1/air/c0/f0/' ohqpath='/jasper/cnsr3_data1/air/c1/f0/' bgdpath='/jasper/cnsr3_data1/air/c1/f1/' ; make lists of available files of desired type ohqfiles=FINDFILE(ohqpath+'g14??060.*',COUNT=nohq) ohrfiles=FINDFILE(ohrpath+'g14??060.*',COUNT=nohr) bgdfiles=FINDFILE(bgdpath+'g14??060.*',COUNT=nbgd) ; keep only valid images ohqfiles=ohqfiles(5:*) & nohq=nohq-5 ohrfiles=ohrfiles(5:*) & nohr=nohr-5 bgdfiles=bgdfiles(5:*) & nbgd=nbgd-5 ; ensure file names are sorted chronologically and return UT seconds also timesort,ohqfiles,14,7,1993,nohq,ohqJsecs timesort,ohrfiles,14,7,1993,nohr,ohrJsecs timesort,bgdfiles,14,7,1993,nbgd,bgdJsecs ; create byte-valued arrays to hold image series ohqseq=INTARR(128,128,nohq) ohrseq=ohqseq bgseq=ohqseq ; read approximate dark frames rdmeandk,0,60,dk0 rdmeandk,1,60,dk1 inf=0 inl=nohq-1 ; create and label image display window X_charheight=10 ; try to keep scalings that apply in X windows X_charwidth=8 barwidth=16 ninrow=4 nincol=3 ninwin=ninrow*nincol edge=256 wwidth=ninrow*edge+barwidth wheight=nincol*edge+4*X_charheight IF !D.NAME EQ 'X' THEN $ WINDOW,0,XSIZE=wwidth,YSIZE=wheight $ ELSE DEVICE,/COLOR,BITS_PER_PIXEL=8 ; PostScript csz=((1.*X_charheight)/wheight)/((1.*!D.Y_CH_SIZE)/!D.Y_VSIZE) ; keep 'X' char size XYOUTS,scl(res=120.,(wwidth-barwidth)/2) $ ,scl(res=120.,wheight-3*X_charheight),wtitle $ ,/DEVICE,ALIGNMENT=0.5,CHARSIZE=2.0*csz,WIDTH=twidthn twidthd=CONVERT_COORD([twidthn,0.],/NORMAL,/TO_DEVICE) twidthd=twidthd(0) ; we only need the x-component ; get user's name and display it SPAWN,'whoami',username XYOUTS,scl(res=120.,wwidth-X_charwidth),scl(res=120.,wheight-3.9*X_charheight) $ ,'User '+STRUPCASE(username),ALIGNMENT=1.0,/DEVICE,CHARSIZE=csz ; get date/time and display them SPAWN,'date -u',datetime XYOUTS,scl(res=120.,wwidth-X_charwidth),scl(res=120.,wheight-2.5*X_charheight) $ ,STRMID(datetime,11,9)+' UT',ALIGNMENT=1.0,/DEVICE,CHARSIZE=csz XYOUTS,scl(res=120.,wwidth-X_charwidth),scl(res=120.,wheight-1.1*X_charheight) $ ,STRMID(datetime,4,7)+STRMID(datetime,24,4),ALIGNMENT=1.0,/DEVICE,CHARSIZE=csz ; create and display color bar bar=REBIN(BINDGEN(256,barwidth),nincol*edge,barwidth) bar=ROTATE(bar,3) mtv,bar,ninrow*edge,0,res=120. ; read in each image, decode the header, subtract dark frame, rebin to ; 256x256 if necessary, scale to 8 bits and display ip=-1 FOR i=inf,inl DO BEGIN rdkimg,ohqfiles(i),hbq,imq & hq=gethd(hbq) rdkimg,ohrfiles(i),hbr,imr rdkimg,bgdfiles(i),hbb,imb ; extract start time of image from header itime=BYTARR(4) FOR itptr=0,3 DO itime(itptr)=hq.misc.tm.(itptr) utsecs=TOTAL(itime*[3600,60,1,.01]) ; subtract approximate dark frames ohqseq(0,0,i)=REBIN(MEDIAN((imq-dk1)>0,3),128,128) ohrseq(0,0,i)=REBIN(MEDIAN((imr-dk0)>0,3),128,128) bgseq(0,0,i)=REBIN(MEDIAN((imb-dk1)>0,3),128,128) PRINT,i,FORMAT='(I3,$)' ENDFOR PRINT,'' fac=FLTARR(2) REPEAT BEGIN ; ask user for factors by which to multiply background image before ; subtracting it PRINT,'Enter background reduction factors for these image sequences' READ,fac stop movie2,BYTSCL((ohqseq-fac(0)*bgseq)>0,MIN=0,MAX=200,TOP=!D.N_COLORS-1) $ ,BYTSCL((ohrseq-fac(1)*bgseq)>0,MIN=0,MAX=200,TOP=!D.N_COLORS-1) $ ,0,0,128,0,2 PRINT,'Try another factor? (Y/[N])' resp='' & READ,resp ENDREP UNTIL STRUPCASE(resp) NE 'Y' END