pro spectraplot filename = Dialog_Pickfile(/read) ;designed to be platetransformout, can be easily adapted (probably) to other files OpenR, 1, filename OpenW, 2, 'badspectraout', width = 500 OpenW, 3, 'goodspectraout', width = 500 x = 0 badbool = 0 ;read,x,prompt = 'enter how many lines of data to read in: ' firstarray = fltArr(23,100000) header = '' ReadF, 1, header while(badbool eq 0) do begin ;this errorcatching is designed to get the length of the input file, so you dont have to yourself ReadF, 1, header x = x + 1 Catch, theError if(theError ne 0) then begin Catch, /Cancel print, x badbool = 1 endif endwhile array = fltArr(23,x) close, 1 OpenR, 1, filename ReadF, 1, header ReadF, 1, array plate = array[0,*] fiber = array[1,*] g = array[7,*] r = array[9,*] plate = Reform(plate) fiber = Reform(fiber) g = Reform(g) r = Reform(r) q = '' z = '' i = 0L while(i lt x) do begin if(q ne 'quit') then begin ;this means that typing quit will exit the program if(g(i) lt 18) then begin ;only selects brighter stars to look at plotspec,plate(i),fiber(i),/nosyn print,(g(i)-r(i)) read,q,prompt = 'type something: ' if(q eq 'write') then begin ;typing 'write' means the spectra is bad, and you want to write it (with a comment) to the bad spectra file read,z,prompt = 'comment? ' printf, 2, plate(i),fiber(i),(g(i) - r(i)),' ',z endif else begin good = array[*,i] ;if everything's good it writes it to the good file printf, 3, good platestr = string(plate(i), format = '(i4.4)') fibstr = string(fiber(i), format = '(i3.3)') specname = platestr + '_' + fibstr writespec, plate(i),fiber(i),filename= specname endelse endif endif i = i + 1L endwhile close,1 close,2 close,3 end