;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; COMPAREGSM.PRO ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Usage: .r comparegsm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Compare results of 2011-05-12 version of GETIRSPECTRALMAP.PRO to ;;; GETIRSPECTRALMAPSA.PRO from Dennis Wellnitz ca. 2011-03-16 ;;; - Based on testing on 32- and 64-bit Linux systems, the two routines ;;; return identical results ;;; - N.B. COMPAREGSM.PRO is not part of the operational pipeline ;;; - N.B. GETIRSPECTRALMAPSA.PRO is not part of the operational pipeline ;;; - GETIRSPECTRALMAPSA.PRO shifts spectral map (smile) -15.0 pixels ;;; - GETIRSPECTRALMAP.PRO implements shift with minimal changes to ;;; previous repository version ;;; - Sylvia Protopapa tested GETIRSPECTRALMAPSA.PRO ca. 2011-05-12 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; !quiet=1 temps = $ [ 136.4646020d0 $ , 136.5976562d0 $ , 136.7159825d0 $ , 136.9972176d0 $ , 137.0120277d0 $ , 137.0268386d0 $ , 137.0416503d0 $ , 137.0564628d0 $ , 137.0860902d0 $ , 137.1898122d0 $ , 137.2194545d0 $ , 137.2342768d0 $ , 137.2787488d0 $ , 137.2935744d0 $ , 137.3084009d0 $ , 137.3380562d0 $ , 137.3528852d0 $ , 137.3973768d0 $ , 137.4122090d0 $ , 137.4418758d0 $ , 137.4567105d0 $ , 137.4715460d0 $ , 137.5012194d0 $ , 137.5308960d0 $ , 137.5754172d0 $ , 137.6496356d0 $ , 137.6644817d0 $ , 137.8426992d0 $ , 137.8575560d0 $ , 138.0210348d0 $ , 138.2143650d0 $ , 138.2738790d0 $ ] dumyDate='2010-11-04T01:23:45.678' mode1 = { gsm_str, imgh030:1L, naxis1: 512L, naxis2:256L, smobent:0d0, obsdate: dumyDate } modeStructs = $ [ mode1 $ , { gsm_str, 2L, 512L, 128L, 0d0, dumyDate } $ , { gsm_str, 3L, 512L, 64L, 0d0, dumyDate } $ , { gsm_str, 4L, 1024L, 512L, 0d0, dumyDate } $ , { gsm_str, 5L, 512L, 256L, 0d0, dumyDate } $ ] tns = tag_names(mode1) cacheSize = n_elements(cacheSize) eq 1L ? long(cacheSize) : 16L if getenv('GSM_SKIP_COMPARE1') eq '' then begin nTests = 0L nFailures = 0L nCacheMisses=0L jd0=julday() for iTemp=0L,n_elements(temps)-1L do begin modeStructs.smobent = temps[iTemp] for iMode=0L,n_elements(modeStructs)-1L do begin modeStruct = modeStructs[iMode] ptr_free,ptr_new(fithdr,/no_copy) for iTag=0L,n_elements(tns)-1L do begin sxaddpar,fithdr,tns[iTag],modeStruct.(iTag) endfor nTests = nTests + 1L outSdcNoCache = getirspectralmap( fithdr,debug=debug) outSdc = getirspectralmap( fithdr,cacheSize=cacheSize,cacheMiss=cacheMiss,debug=debug) iwCacheDiff=where(outSdc ne outSdcNoCache, ct) if ct gt 0L then begin print,'','Cache vs. No-cache difference!',fithdr[where( strtrim(fithdr,2) ne '')],f='(a)' help,modeStruct,iwCacheDiff nFailures = nFailures + 1L endif nCacheMisses += cacheMiss outSa = getirspectralmapsa( fithdr) iw=where(outSdc ne outSa, ct) if ct eq 0L then continue nFailures = nFailures + 1L print,fithdr[where( strtrim(fithdr,2) ne '')],f='(a)' help,modeStruct,iw,max(abs(outSdc-outSa)),/st endfor endfor iTime_sec=round((julday()-jd0)*864d2) lowRate_Hz=3d0*double(nTests)/iTime_sec HighPeriod_sec=1d0/lowRate_Hz print,fithdr[where( strtrim(fithdr,2) ne '')],f='(a)' help,modeStruct,iw,max(abs(outSdc-outSa)),/st help,'','Comparison results:' help,nTests,nFailures,nCacheMisses,iTime_sec,lowRate_Hz,HighPeriod_sec endif sampFile='sampleOptbentModeNaxis12.tsv' fInfo = file_info(sampFile) nCacheMisses=0L nNoCacheTests=100L if fInfo.exists then begin jd0=julday() spawn,'cat ' + sampFile,lins nTests=n_elements(lins) for iTemp=0L,nTests+nNoCacheTests-1L do begin if iTemp eq nTests then jdMid = julday() toks=strsplit(lins[iTemp MOD nTests],' ',/extract) temp = double(toks[0]+'d0') mode = long(toks[1]) naxis1 = long(toks[2]) naxis2 = long(toks[3]) modeStruct = { gsm_str, mode, naxis1, naxis2, temp, dumyDate } ptr_free,ptr_new(fithdr,/no_copy) for iTag=0L,n_elements(tns)-1L do begin sxaddpar,fithdr,tns[iTag],modeStruct.(iTag) endfor if iTemp lt nTests then begin ptr_free,ptr_new(cacheMiss,/no_copy) outSdc = getirspectralmap( fithdr, cacheSize=cacheSize, cacheMiss=cacheMiss,debug=debug) nCacheMisses += cacheMiss endif else begin outSdc = getirspectralmap( fithdr,debug=debug) endelse endfor jdEnd=julday() iTime_sec=round((jdMid-jd0)*864d2) rate_Hz=double(nTests)/iTime_sec period_sec=1d0/rate_Hz noCache_sec=round((jdEnd-jdMid)*864d2) noCacheRate_Hz = double(nNoCacheTests)/noCache_sec noCachePer_sec = 1/noCacheRate_Hz help,'','Speed results:' help,'',nTests,nCacheMisses,iTime_sec,rate_Hz,period_sec help,'',nNoCacheTests,noCache_sec,noCacheRate_Hz,noCachePer_sec endif else message,/continue,'Missing file: '+sampfile end