function STEPPER4, header, movie, subscript=subscript,pauz=pauz ;+ ; NAME: ; STEPPER4 ; PURPOSE: ; This code takes fits format data as input. ; Step through fits-format movies a single frame at a time ; and permit flagging the output vector with a 0, 1, 2, 3 or 4. ; It is possible to switch back and forth on a given image ; as much as you want. Stepping or jumping through the data ; cube is the same as in stepper. ; SAMPLE CALLING SEQUENCE: ; out = stepper4(header,movy) ; INPUT: ; header, fits header structure. ; movie, data cube corresponding to header. ; OUTPUT ; A vector of 0's, 1's, 2's, or 3's permitting easy selection or ; de-selection of images for further processing. ; OPTIONAL INPUT KEYWORDS: ; subscript = Subset of array is displayed. ; pauz, wait between images (sec) [Default: pauz=0.] ; PROCEDURE ; 0 returns a 0 in the output vector. ; 1 returns a 1 in the output vector. ; 2 returns a 2 in the output vector. ; 3 returns a 3 in the output vector ; 4 returns a 4 in the ouptut vector. ; HISTORY: ; 31-Jul-2007 LWA Created from stepper3.pro to accomodate ; FITS format input. ; 28-Jan-2007 LWA Added capability of use of 4 as a flag. ; 15-May-2008 LWA Added L or C info to info_array msg. ; 15-Oct-2008 LWA Added keyword pauz. ;- ;on_error,2 ; Return to caller ans= '' pauzr=keyword_set(pauz) head=header movy=movie info_array=sxt_fits_info(head) index2map,head,movy,xmap if keyword_set(subscript) then out=intarr(n_elements(subscript)) else $ out=intarr(n_elements(xmap)) nimg=n_elements(xmap) if (n_elements(subscript) eq 0) then subscript = indgen(nimg) n_sel = n_elements(subscript) stt=0 ; Starting image stt = min(abs(stt-subscript)) & stt=!c & !c=0 ; Get closest index i = stt qdisp = 1 qmovie = 0 qprint = 1 ;always print the menu message the first time qdone = 0 qfirst = 1 while not qdone do begin if (qfirst or qprint) then begin print, '-------- STEPPER4 Options --------' print,'There are ',strtrim(string(nimg),2),' images in the array' print,'There are ',strtrim(string(n_sel),2),' images selected' print, 'Enter "b" to step backwards' print, ' "m" for movie mode' print, ' "s" to select new start index' print, ' "0" to set out(i) to 0.' print, ' "1" to set out(i) to 1.' print, ' "2" to set out(i) to 2.' print, ' "3" to set out(i) to 3.' print, ' "4" to set out(i) to 4.' print, ' "q" to quit' print, ' "anything else" to step forward' end qprint = 0 if (not qfirst) then ans = get_kbrd(1-qmovie) ans = strlowcase(ans) ; Convert to lower case if (qmovie) and (ans ne '') then begin qmovie = 0 qdisp = 0 ;;ans = '-' ;zero out the answer which stopped movie (might be "q") end qdisp = qfirst case ans of '-': ;do nothing 'm': begin ;movie mode selected print,'Type anything to abort movie mode ("q" will exit movie and STEPPER)' qmovie = 1 qdisp = 1 end 'b': begin i = i-1 if i lt 0 then i=n_sel-1 qdisp = 1 end 'q': qdone = 1 's': begin print,'* Enter the requested start image number',format='($,a)' read,i i=min(abs(i-subscript)) i=!c !c=0 qdisp = 1 end '0': begin out(i)=0 xyouts,charsize=1.5,/norm,0.15,0.05,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '1': begin out(i)=1 xyouts,charsize=1.5,/norm,0.15,0.05,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '2': begin out(i)=2 xyouts,charsize=1.5,/norm,0.15,0.05,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '3': begin out(i)=3 xyouts,charsize=1.5,/norm,0.15,0.05,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '4': begin out(i)=4 xyouts,charsize=1.5,/norm,0.15,0.05,'Switched out('+strtrim(i,2)+') value to'+string(out(i)) end '*': stop else: if (not qfirst) then begin i = i + 1 if i ge n_sel then i = 0 qdisp = 1 end endcase if (qdisp) then begin j = subscript(i) ; Get selected images x0=0 & y0=0 plot_map,xmap(j),/limb,margin=.0001,/noaxes,/square,/noerase xyouts,charsize=1.5,/norm,0.15,0.09,$ 'Currently out('+strtrim(i,2)+') is set to'+string(out(i)) msg=strmid(info_array(j),0,49)+strmid(info_array(j),53,3)+'DPE='+strmid(info_array(j),57,2) xyouts,charsize=1.4,/norm,.02,.002,msg endif if pauzr then wait,pauz qfirst = 0 endwhile return, out end