;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;; pro parse_test, filename f = file_info(filename) if ~f.exists then message, 'File not found.' ; Open file for reading openr, lun, filename, /get_lun type = 'temp' ; Get the file header: readf, lun, type first=-1l last=-1l i=0l nlines = 0 while not eof(lun) and last EQ -1l do begin temp = 'string' readf, lun, temp if (strpos(temp,'DONE') ne -1) then last=0 else begin ;Just to make life easier, add a space at the end of the string temp = temp+' ' tempbyte = byte(temp) ; Get the date: space = where(tempbyte eq 32, nspace) tempdate = string(tempbyte[0:min(space)]) if nlines eq 0 $ then date = tempdate $ else date = [date, tempdate] nentries = 0 for i = 2, nspace - 1 do begin if space[i] - space[i-1] eq 1 then continue if nlines eq 0 and nentries eq 0 $ then data = float(string(tempbyte[space[i-1]+1:space[i]])) $ else data = [data, float(string(tempbyte[space[i-1]+1:space[i]])) ] nentries++ endfor if nentries gt 18 then message, 'Prolem with this row!' nlines++ endelse endwhile close,lun free_lun, lun data = reform(data, 18, nlines) pixels = data[0:1, *] counts = data[2:*, *] npixel = n_elements(pixels[0,*]) ndata = n_elements(counts[*,0]) counts2= fltarr(32,32,ndata) for i=0,npixel-1 do begin ix=pixels[0,i] iy=pixels[1,i] counts2[ix,iy,*]=counts[*,i] endfor end