;+ ; NAME: G_DSTAT ; ; PURPOSE: ; To extract the statistical information stored in the files ; produced by the procedure DRKSTATS. ; ; CATEGORY: ; ; CALLING SEQUENCE: ; G_DSTAT,FILENAME,UARR,VARR,NARR,STATS ; ; INPUTS: ; FILENAME: A STRING containing the filename and path of one file. ; ; KEYWORD PARAMETERS: ; None. ; ; OUTPUTS: ; UARR: A 2-D FLOAT ARRAY containing the mean of the means of images ; indexed by internal and CCD temperatures. ; ; VARR: A 2-D FLOAT ARRAY containing the standard deviation in the mean ; of the images, indexed by internal and CCD temperatures. ; ; NARR: A 2-D FLOAT ARRAY containing number of means ; indexed by internal and CCD temperatures. ; ; STATS: An ARRAY of STRUCTURES, with each structure containing ; the internal and CCD temperatures, the number of means, ; the mean of the means, and the standard deviation in the ; means. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; None. ; ; RESTRICTIONS: ; The files produced by DRKSTATS are: ; c:\idl\data\dark\dark0.sts ; c:\idl\data\dark\dark1.sts . ; So, this procedure will only work for these two files. ; ; PROCEDURE: ; The CCD and internal temperatures are recovered from the file. Along ; with the temperatures, the means of images corresponding to the temperatures ; are also recovered from the file. The number of means, the mean of the means, ; and the standard deviation in the means, are stored the 2-D arrays, NARR, ; UARR, AND VARR, respectively. The CCD temperatures and internal temperatures ; are used to index these arrays. Finally, all of the above information (the ; temperatures, mean, standard deviation, number) is stored in the STRUCTURE ; STAT_INFO, which is located in an array, again indexed by the internal and ; CCD temperatures. ; ; MODIFICATION HISTORY: ; Written May 1994, by T A Oliynyk. ;- PRO g_dstat,filename,uarr,varr,narr,stats OPENR,unit,filename,/GET_LUN dstats=ASSOC(unit,BYTARR(1206)) uarr=FLTARR(40,18) varr=FLTARR(40,18) stats=REPLICATE({stat_info, mean: 0.0, std: 0.0, n: 0, int: 0, ccdt:0},40,18) narr=INTARR(40,18) FOR i=0,719 DO BEGIN record=dstats(i) n=FIX(record,4) ;get the number of images for a particular ccd and ;internal temperature IF n GT 1 THEN BEGIN intemp=FIX(record,0) ;get the internal and ccd temperatures from one of ccdtemp=FIX(record,2) ;the files 'c:\idl\data\dark0(1).sts' ind1=intemp+5 ;use internal temperature to index columns ind2=ccdtemp+48 ;use CCD temperature to index rows mu=FLOAT(record,6,n) ;return the means of images at a particular ccd and ;internal temperature from one of the files ;'c:\idl\data\dark0(1).sts' print, 'internal temperature = ',intemp print, 'CCD temperature = ',ccdtemp print, 'number of means = ',n print, mu var=STDEV(mu,mean) ;calculate the mean of the means and the st dev ;in the means uarr(ind1,ind2)=mean ;store results in appropriate arrays varr(ind1,ind2)=var narr(ind1,ind2)=n stats(ind1,ind2).mean=mean stats(ind1,ind2).std=var stats(ind1,ind2).n=n stats(ind1,ind2).int=intemp stats(ind1,ind2).ccdt=ccdtemp ENDIF ENDFOR CLOSE,unit FREE_LUN,unit END