;function return_file_list ; ;PURPOSE: ; To return a list of files that match the desired specification in ; object, filter, number of reads, etc. Not every file was recorded ; with the proper parameters in the filename, but the header contains ; the correct information. So the header is used to filter out the files ; that do not match. ; ;INPUTS: ; InitFileArray - An array of filenames that might potentially match ; the desired configuration. ;KEYWORDS: ; THISFILTER - The filter used in the exposure ; ; THISNDROPS - The number of drop frames in the exposure ; ; TIMES - The time of the exposures ; ; WINDOWMODE - A boolean stating whether or not the exposures were taken in ; windowmode. 0 indicates full frame mode. 1 indicates window mode. ;OUTPUS: ; FinFileArray - The filtered array of filenames that remove the ; errant filenames ; function return_file_list_1rg, InitFileArray, ThisFilter = ThisFilter, $ ThisNDrops = ThisNDrops, Times = Times, WindowMode = WindowMode If N_Elements(ThisNDrops) eq 0 then ThisNDrops = 0 ;The indices of the files that match ValidIndices = 0 Times = Fltarr(N_elements(InitFileArray)) ThisFilter = strtrim(ThisFilter, 2) ;Only use the images that have the filter we want For i = 0, n_elements(InitFileArray) - 1 do begin Fits_Read, InitFileArray(i), NoData, FitsHeader, /header_only Filter = SxPar(FitsHeader ,'FILTER') NDrops = SxPar(FitsHeader ,'NDROPS') NReads = SxPar(FitsHeader ,'NREADS') NGroups = SxPar(FitsHeader ,'NGROUPS') Time = SxPar(FitsHeader, 'TIME') WindowM = SxPar(FitsHeader, 'WINDOWM') ;Get the time FirstColon = stregex(Time,':') Hour = long(strmid(Time,FirstColon-2,2)) Minute = long(strmid(Time,FirstColon+1,2)) Second = long(strmid(Time,FirstColon+4,2)) Seconds = Hour*3600.+Minute*60.+Second ;Print out Some Info print, i, string(9B), InitFileArray(i) print, 'Filter:', string(9B), Filter print, 'NDrops:', string(9B), NDrops If stregex(Filter, ThisFilter ,/boolean) and $ stregex(NDrops, ThisNDrops,/boolean) and $ WindowM eq WindowMode then $ ValidIndices = [ValidIndices, i] ;Keep the times in an array Times(i) = Seconds Endfor ;Only keep the files that match FinFileArray = InitFileArray[ValidIndices(1:N_elements(ValidIndices)-1)] Times = Times[ValidIndices(1:N_elements(ValidIndices)-1)] return, FinFileArray end