;Calibration program to generate variances and averages ;Declare the arrays avg = lonarr(256,256) temp = intarr(256,256) var = lonarr(256,256) exp = 1 FOR i = 0,7 DO BEGIN avg = 0 var = 0 for j = 0,9 DO BEGIN name = '../ns' + string(exp) + '.' + string(j) name = STRCOMPRESS(name,/REMOVE_ALL) openr,1,name readu,1,temp byteorder,temp avg = avg + LONG(temp) close,1 ENDFOR avg = avg/10 fname = 'ns' + string(exp) + '.avg' fname = STRCOMPRESS(fname,/REMOVE_ALL) openw,1,fname writeu,1,avg close,1 FOR j = 0,9 DO BEGIN name = '../ns' + string(exp) + '.' + string(j) name = STRCOMPRESS(name,/REMOVE_ALL) openr,1,name readu,1,temp byteorder,temp var = var + (LONG(temp) - avg)*(LONG(temp) - avg) close,1 ENDFOR var = var/9 fname = 'ns' + string(exp) + '.var' fname = STRCOMPRESS(fname,/REMOVE_ALL) openw,1,fname writeu,1,var close,1 exp = 2*exp ENDFOR end