PRO DIG_SELECT,mereni,noframes,sellist,w ; ; Reads headers of all .dig files in the directory, extracts time of exposures ; and outputs a string array SELLIST with names of selected files with equidistantly ; distributed instants of exposures. ; INPUT: mereni - path to data directory ; noframes - number of frames we want to select ; OUTPUT: sellist - list of selected spectra filenames ; w - list of selected spectra seq. numbers ; ; Copyright M. Klvana and M. Sobotka, ASU AVCR Ondrejov, Czech Rep., 2008 ; list=findfile(mereni + '*.dig') s=n_elements(list) time=fltarr(s) for i=0, s-1 do begin openr, 102, list(i) hlavicka = bytarr(88) readu, 102, hlavicka ;********************** Cas mereni *********************** hodina=long(hlavicka(72:75)) hodina=((hodina[3]*256+hodina[2])*256+hodina[1])*256+hodina[0] ; no correction is necessary here because time=time-time(0) minuta=long(hlavicka(76:79)) minuta=((minuta[3]*256+minuta[2])*256+minuta[1])*256+minuta[0] vterina=long(hlavicka(80:83)) vterina=((vterina[3]*256+vterina[2])*256+vterina[1])*256+vterina[0] tisicina=long(hlavicka(84:87)) tisicina=((tisicina[3]*256+tisicina[2])*256+tisicina[1])*256+tisicina[0] sekunda=hodina*3600. + minuta*60. + vterina + tisicina*0.001 time(i)=sekunda close, 102 endfor print,'DIG_SELECT: Headers are read and times calculated' time = time - time(0) ; array of times starting at 0 dt=max(time)/noframes ; mean time difference tt=findgen(noframes)*dt ; array of equidistant times w=lonarr(noframes) ; loop over equidistant times - look for a spectrum closest in time for i=0,noframes-1 do begin mi=min(abs(time-tt(i)),pos) w(i)=pos ; subscript of the closest in time spectrum endfor sellist = list(w) seltime = time(w) window,2 plot,seltime,/xst,/yst,psym=3,xtit='Selected frame',ytit='Time [s]' wait,0.1 END