PRO imgcateg,paths,filtlist,typelist,texplist ; Set up OS-specific details @isitdos ; Make sure supplied array of paths is legitimate. fsize=SIZE(paths) IF fsize(0) GT 0 THEN BEGIN ; Truncate input array string lengths as needed to simplify ; file name extraction pathslen=STRLEN(paths) ; pmin=0 ; pmax=0 ; ; What lengths do the available paths have? ; phist=HISTOGRAM(pathslen,OMIN=pmin,OMAX=pmax) ; ; For each length, truncate the paths with this length pmin=MIN(pathslen(uniq(pathslen,SORT(pathslen))),MAX=pmax) files=paths FOR i=pmin,pmax DO BEGIN wp=WHERE(pathslen EQ i,nwp) IF nwp GT 0 THEN files(wp)=STRMID(paths(wp),i-pmin,pmin) ENDFOR ; Now extract the last 12 characters of each path to get file names files=STRMID(files,pmin-12,12) fc=STRMID(files,0,1) ; extract only first characters filt=STRMID(files,4,1) ; extract filter numbers texp=STRMID(files,5,3) ; extract exposure times ; Correct entries for cases where no image found wno=WHERE(STRPOS(files,'___') NE -1,nwno) IF nwno GT 0 THEN BEGIN fc(wno)='_' filt(wno)='-1' texp(wno)='-1' ENDIF ; Make output array dimensions match the input dimensions ; Default entry is -1 => no image found CASE fsize(0) OF 1: typelist=INTARR(fsize(1))-1 2: typelist=INTARR(fsize(1),fsize(2))-1 ENDCASE ; Store the image type codes in typelist FOR i=0,N_ELEMENTS(firstchars)-1 DO BEGIN wfc=WHERE(fc EQ firstchars(i),nwfc) IF nwfc GT 0 THEN typelist(wfc)=i ENDFOR ; Store the filter numbers in filtlist filtlist=FIX(filt) ; Store the exposure times in texplist texplist=FIX(texp) ENDIF ELSE BEGIN ; Warn the user that the input was degenerate MESSAGE,'"paths" must be at least a 1-d array',/INFORMATIONAL filtlist=-1 typelist=-1 texplist=-1 ENDELSE RETURN END