;+ ; NAME: ; CHKBKG ; PURPOSE: ; Quick look at mean zenith brightnesses in all background ; images for a given date, camera, and filter. ; CATEGORY: ; ; CALLING SEQUENCE: ; CHKBKG, YYMMDDCF [, /PS] ; INPUTS: ; YYMMDDCF: An 8-digit number constructed as follows: ; YY: The last two digits of the year; ; MM: The two digits of the month number; ; DD: The two digits of the day number (UT); ; C: The camera number (0/1); ; F: The filter number (0-4). ; OPTIONAL INPUTS: ; None. ; KEYWORD PARAMETERS: ; /PS: If set, plots the results to a PostScript file named ; bgroot+dd+'chkbkg.ps'. The resulting file is not unique. ; OUTPUTS: ; None. ; OPTIONAL OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; A plot is created, showing the mean zenith intensity in ; each of the background images, its time span, and the number ; of individual camera images used to form it. ; ; If /PS is set, a PostScript file containing the plot is created ; in bgroot+dd. ; RESTRICTIONS: ; The appropriate background file must exist. ; PROCEDURE: ; Straightforward. ; EXAMPLE: ; CHKBKG,93120802 ; for 8 Dec 1993, camera 0, filter 2. ; SEE ALSO: ; TVIEW_BKGRDS.PRO, BFILE_CHECK.PRO ; MODIFICATION HISTORY: ; Written by: D P Steele, ISR, October 1994. ; Modified by: D P Steele, ISAS, April 1997. ;- PRO chkbkg,num,ps=ps IF N_PARAMS() LT 1 THEN BEGIN doc_library,'chkbkg' RETURN ENDIF IF N_Elements(ps) GT 0 THEN ps=1 ELSE ps=0 ; Set OS-dependent parameters @isitdos fs=4L*256*256+24 ; file size in bytes brmax=250. ; default max zenith brightness zmax=0. ; This routine only works under Unix, right now. name=bgroot+dd+STRING(num,FORMAT='(I8)')+'.bkg' file=FINDFILE(name,COUNT=nfile) IF nfile EQ 0 THEN BEGIN MESSAGE,name+' not found',/INFORMATIONAL RETURN ENDIF OPENR,bu,name,/GET_LUN f=ASSOC(bu,BYTARR(fs)) fb=FSTAT(bu) n=fb.SIZE/fs ; number of background images found ; Open PostScript file if requested. IF ps THEN psopen,bgroot+dd+'chkbkg.ps' LOOP: ; label for GOTO below to point at ; Set up plot axes PLOT,[0,1],/NODATA,XRANGE=[0,24],/XSTY,XTICKS=4,XTICKV=INDGEN(5)*6 $ ,XMINOR=6,XTITLE='UT Hours' $ ,YRANGE=[0,brmax],YTITLE='Mean Zenith Background' $ ,TITLE=name FOR i=0,n-1 DO BEGIN ; loop through all background images fi=f(i) ; load i-th image hb=BYTE(fi,0,24) ; get header bytes im=FLOAT(fi,24,256,256) ; and image data nimgs=FIX(hb,10) ; decode header sut=LONG(hb,12) eut=LONG(hb,16) int=LONG(hb,20) zm=mean(im(124:131,124:131)) ; mean zenith brightness zmax=MAX([zmax,zm]) ; update max observed 'zm' PRINT,i,strsec(sut),strsec(eut),strsec(int),nimgs,zm $ ,FORMAT='(I2,A10,"-",A8," (",A8,") ",I3,F5.0)' ; prsc,[i,sut,eut,int,nimgs,zm] PLOTS,[sut,eut]/3600.,[zm,zm] ; plot image span and ; mean zenith brightness IF int LT 3700. THEN yo=1 ELSE yo=-6 XYOUTS,(sut+eut)/7200.,zm+yo,STRTRIM(nimgs,2) $ ,ALIGNMENT=0.5,/DATA ; label with # images used ENDFOR IF zmax GT brmax THEN BEGIN MESSAGE,'Replotting with better y-axis',/INFORMATIONAL brmax=zmax GOTO,loop ENDIF FREE_LUN,bu IF ps THEN psclose RETURN END