; parse_waveform, 'test2_sc_sh_log.txt' ;pro parse_waveform, filename BSPACE = (byte(' '))[0] BZERO = (byte('0'))[0] BCOMMA = (byte(','))[0] ;path = '../../data/' ;filename = path+filename f = file_info(filename) if ~f.exists then message, 'File not found.' ; Open file for readingw openr, lun, filename, /get_lun temp = 'temp' ; Get the horizontal scale header: readf, lun, temp btemp = byte(temp) spaces = where(btemp eq BSPACE) hScale = float(string(btemp[spaces[3]:spaces[4]-1])) hIndex = findgen(1000) * hscale * 1e6 ; Now get the vertical scale readf, lun, temp btemp = byte(temp) spaces = where(btemp eq BSPACE) vScale = float(string(btemp[spaces[3]:spaces[4]-1])) npixels = 32 ^ 2. vals = fltarr(32, 32, 1000) for n = 0, npixels - 1 do begin readf, lun, temp btemp = byte(temp) spaces = where(btemp eq BSPACE) xCell = fix(string(btemp[spaces[0]:spaces[1]-1])) yCell = fix(string(btemp[spaces[1]:spaces[2]-1])) ; print, xCell, yCell readf, lun, temp btemp = byte(temp) commas = where(btemp eq BCOMMA, nfound) ; Parse the values last = 0 for i = 0, nfound -1 do begin vals[xCell, yCell, i] = float(string(btemp[last:commas[i]-1])) last = commas[i]+1 endfor vals[xCell, yCell, nfound] = float(string(btemp[last:*])) endfor close, lun free_lun, lun !p.multi = [0, 8, 8] !y.range = yrange !y.style = 1 !p.charsize=0.8 for i = 0, 15 do begin ;if not keyword_set(set_ps_plot) then window, xsize = 1200*1.5, ysize = 1200 for y0 = 0, 7 do begin for x0= 0, 7 do begin x1=x0+((i mod 4)*8) y1=y0+(i/4)*8 plot, hindex, vals[x1, y1, *] * vScale, $ title = 'X '+num2str(x1) + ', Y '+num2str(y1),$ xtitle = 'Microseconds', ytitle = 'Volts' endfor endfor endfor !p.multi = [0, 0, 0] end