PRO CCDVerif,InputFiles,OutFile1,OutFile2 ;+ ; ; NAME: ; CCDVerif ; PURPOSE: ; Inputs each data set in a nametable and verifies ; that the optimum exposure and the data itself are as expected ; if the file is a CCD measurement with no lamps on. ; CATEGORY: ; Verification ; CALLING SEQUENCE: ; CCDVerif,Nametable,OutFile1,OutFile2[Status] ; INPUTS: ; Nametable - list of files to be investigated ; OutputFile - file for the verification results ; OPTIONAL INPUT PARAMETERS: ; None ; OUTPUTS: ; File with any items which did not verify correctly (# 1) ; File with list of names of unverified files (lamps on, #2) ; OPTIONAL OUTPUT PARAMETERS: ; Status ; KEYWORDS: ; None ; COMMON BLOCKS: ; None ; SIDE EFFECTS: ; None ; RESTRICTIONS: ; None ; EXAMPLE: ; CCDverif,'Nametable','Outfile1','Outfile2' ; PROCEDURE: ; Loop over the files of the nametable. ; Verify the optimum exposure algorithm calculated about the right ; value ; Verify the data itself is within a noise band of what is expected ; ; MODIFICATION HISTORY: ; 29-MAY-1994 LED ; ; ;---------------------------------------------------------------------------- ; D I S R S O F T (C) 1 9 9 4 ;----------------------------------------------------------------------------- ;- @c_system.inc @c_header.inc STATUS=STRARR(4) STATUS(0)='S' STATUS(1)='SUCCESS' ; USER enter name of routine inside quotes STATUS(2)='CCD Verification' ; leave this STATUS(3)='' STATUS_SET=0 ; enter version number inside quotes VERSION='1.0' ; enter the full procedure call in here CALL='CCDVerif,Nametable,Outfile1,Outfile2,Status' ; error checking ---- insert maximum and minimum number of parameter IF (N_PARAMS(0) LT 3) OR (N_PARAMS(0) GT 4) THEN BEGIN STATUS(0)='F' STATUS(1)='FAILURE' STATUS(3)='Bad input parameters' PRINT,' ' PRINT,STRTRIM(STATUS(2),2)+' : '+STATUS(3)+'. EXIT.' PRINT,'Call is '+CALL GOTO,LEAVE ENDIF IF N_PARAMS(0) EQ 4 THEN STATUS_SET=1 ; Open the output file for data openw,out,OutFile1,/get_lun openw,out1,OutFile2,/get_lun ; Read in the baseline files. These are 0 and 0.5 msec integrations ; of the full CCD. print,'Reading in the baseline files' d_read,'/disk1/disrgse/Log/Base0',h,Base0 exptime1=d_value(h,H_EXPTIME) chiptemp1=d_value(h,H_CCDTEMP) d_read,'/disk1/disrgse/Log/Basei',h,Basei exptime2=d_value(h,H_EXPTIME) dnrate=(Basei-Base0)/(exptime2-exptime1) chiptemp2=d_value(h,H_CCDTEMP) basetemp=0.5*(chiptemp1+chiptemp2) print,'CCD temperature for baseline data ',basetemp ; Loop over InputFiles z_InputFiles=size(InputFiles) print,'Beginning the loop over the input files. Total= ',z_InputFiles(1) FOR i=0,z_InputFiles(1)-1 DO BEGIN d_read,InputFiles(i),h,p chiptemp=d_value(h,H_CCDTEMP) ; Make sure no lamps are on ls=d_value(h,H_LAMP_STATE) IF ls EQ '0000' THEN BEGIN ; Baseline=intarr(H_XSIZE,H_YSIZE) ; BoundsLo=intarr(H_XSIZE,H_YSIZE) ; BoundsHi=intarr(H_XSIZE,H_YSIZE) ; ; Determine which CCD measurement you are looking at, and calculate a ; Baseline for the pixels from the raw CCD measurements ; xstart = d_value(h,H_COORD_XL)-d_value(h,H_XSIZE) ystart = d_value(h,H_COORD_YL) type=d_value(h,H_MEAS_TYPE) CASE type OF ; DLVS 16 : BEGIN ncol = 20 nrow = 200 numsum = ncol/H_NUM_COL END ; Near Surface DLVS 15 : BEGIN ncol = 4 nrow = 200 xstart = xstart + 6 numsum = ncol/H_NUM_COL END ; ULVS 17 : BEGIN ncol = 8 nrow = 200 numsum = ncol/H_NUM_COL END ; Dark Current 18 : BEGIN ncol = 4 nrow = 256 numsum = ncol/H_NUM_COL END ; SLI STRIP 12 : BEGIN ncol = 26 nrow = 254 xstart = H_STP_FST_COL numsum = ncol/H_NUM_COL END ; Solar Aureole 14 : BEGIN ncol = 30 nrow = 50 numsum = ncol/H_NUM_COL END ; DLI1 23 : BEGIN ncol = 160 nrow = 256 numsum = 1 END ; DLI2 21 : BEGIN ncol = 176 nrow = 256 numsum = 1 END ; SLI 22 : BEGIN ncol = 128 nrow = 256 numsum = 1 END ; Upper DLI1 0 : BEGIN ncol = 160 nrow = 128 numsum = 1 END ; Lower DLI1 3 : BEGIN ncol = 160 nrow = 128 numsum = 1 END ; Upper DLI2 1 : BEGIN ncol = 176 nrow = 128 numsum = 1 END ; Lower DLI2 4 : BEGIN ncol = 176 nrow = 128 numsum = 1 END ; Upper SLI 2 : BEGIN ncol = 128 nrow = 128 numsum = 1 END ; Lower SLI 5 : BEGIN ncol = 128 nrow = 128 numsum = 1 END ; Full CCD 19: BEGIN ncol = 524 nrow = 256 numsum = 1 xstart=0 ystart=0 END END ; Get proper data block Temp=intarr(ncol,nrow) Temp=Base0(xstart:xstart+ncol-1,$ ystart:ystart+nrow-1) dexptime=d_value(h,H_EXPTIME)-0.5 Temp=Temp+dexptime*dnrate(xstart:xstart+ncol-1,$ ystart:ystart+nrow-1) ; If SA data remove unused rows if type eq 14 then begin Temp(6:11,*)=Temp(8:13,*) Temp(12:17,*)=Temp(16:21,*) Temp(18:23,*)=Temp(24:30,*) endif ; sum rows if needed if (numsum NE 1) then BEGIN FOR k=0,H_NUM_COL-1 DO BEGIN FOR l=k*NumSum,(k+1)*NumSum-1 DO Baseline(k,*)=Baseline(k,*)+Temp(l,*) ENDFOR endif else begin Baseline = temp endelse ; Check to see if the pixels stay in the bounds BoundsLo=0>(Baseline-fix(sqrt(Baseline*30.)/30.)-1) BoundsHi=(4095*NumSum)<(Baseline+fix(sqrt(Baseline*30.)/30.)+1) Lo=where(p LT BoundsLo,locount) Hi=where(p GT BoundsHi,hicount) print,'Chip temperature ',chiptemp print,'Low end failure on',locount,' pixels ',InputFiles(i) print,'High end failure on',hicount,' pixels ',InputFiles(i) pp=p pp(Lo)=0 ppp=p ppp(Hi)=0 tvfit,pp,1,'Low failures' tvfit,ppp,2,'High failures' stop ; Make sure optimum exposure time worked the way it should have ; What tolerance should I use? GoaldN=H_CCD_TGT_PRC*4095/100 a=where(p/NumSum GT GoaldN,count) IF count/(NumSum*H_XSIZE*H_YSIZE) GT H_CCD_PRCTILE/100.+0.05 THEN BEGIN print,out,'Over Exposed ',InputFiles(i) ENDIF ELSE BEGIN IF count/(NumSum*H_XSIZE*H_YSIZE) LT H_CCD_PRCTILE/100.-0.05 THEN BEGIN print,out,'Under Exposed ',InputFiles(i) ENDIF ELSE Begin print,out,'Exposure OK',InputFiles(i) ENDELSE ENDELSE ENDIF ; If lamps are off, do all such IF ls NE '0000' THEN print,out1,InputFiles(i) ENDFOR ; Loop over files LEAVE: free_lun,out free_lun,out1 RETURN ; END