pro spali,omov,out,x1,x2,y1,y2 ;Spatial Limitation - interactive program to extract a light curve ; of an absolute maximum (minimum) from a subfield. ;INPUT: 3-D full-size movie OMOV . ;OPTIONAL INPUT: limits of the subfield X1,X2,Y1,Y2 ;OUTPUT: 1-D array (table) OUT with intensity. ;Called routines: ANIMATE ; 30 January 1996, Michal. on_error,1 ;--- PARAMETER - initial size of the subfield (about 1.5 x 1.5") p=13 ; pixels ;--------------------------------------------------------------- if (n_params() ne 2) and (n_params() ne 6) then message, $ 'USAGE: spali, movie, lightcurve [, x1, x2, y1, y2]' si=size(omov) if si(0) ne 3 then message,'ERROR - Input must be a 3-D array' opt: print,'Selected feature will be DARK (0) or BRIGHT (1) ?' op=get_kbrd(1) case op of '0' : op=0 '1' : op=1 else: goto,opt endcase print,' ' if n_params() eq 6 then goto,subex ;if the limits are defined ;the limits are to be defined interactively... ANIMATE,bytscl(omov) read,'Number of the pilot frame:',pn print,' ' pilot=rebin(omov(*,*,pn),si(1)*2,si(2)*2) ;2x enlarged window,0,xsize=si(1)*2,ysize=si(2)*2 tvscl,pilot print,'CURSOR selection: left button, confirm: right button' curs: cursor,x,y,/device,/down if !err eq 4 then goto,fincur print,x,y,pilot(x,y) ; arrow if x lt si(1) then xs=x+10 else xs=x-10 if y lt si(2) then ys=y+10 else ys=y-10 arrow,xs,ys,x,y goto,curs fincur: print,' ' x=x/2 ;back to original coordinates y=y/2 x1=x-p/2 ;initial setting of subfield limits x2=x+p/2 y1=y-p/2 y2=y+p/2 subex: ; subfield extraction mov=omov(x1:x2,y1:y2,*) s=size(mov) chmov=bytscl(mov) ;check movie to be shown with marked pixel out=fltarr(s(3)) ;output array if op eq 1 then begin ;search for MAXIMUM for i=0,s(3)-1 do begin out(i)=max(mov(*,*,i),pos) chmov(pos mod s(1),pos/s(1),i)=0 ;mark the pixel endfor endif else begin ;search for MINIMUM for i=0,s(3)-1 do begin out(i)=min(mov(*,*,i),pos) chmov(pos mod s(1),pos/s(1),i)=255 ;mark the pixel endfor endelse ANIMATE,rebin(chmov,s(1)*5,s(2)*5,s(3),/sample) ;show check movie print,'Extraction OK (y/n) ?' if get_kbrd(1) eq 'y' then goto,fin print,' ' read,'LEFT edge: cut (-number) or add (+number) pixels:',di x1=x1-di read,'RIGHT edge: cut (-number) or add (+number) pixels:',di x2=x2+di read,'BOTTOM edge: cut (-number) or add (+number) pixels:',di y1=y1-di read,'TOP edge: cut (-number) or add (+number) pixels:',di y2=y2+di print,' ' goto,subex fin: x1=' '+strtrim(fix(x1),2)+' ' x2=' '+strtrim(fix(x2),2)+' ' y1=' '+strtrim(fix(y1),2)+' ' y2=' '+strtrim(fix(y2),2)+' ' print,' ' print,'FINAL EXTRACTION IS: ('+x1+':'+x2+','+y1+':'+y2+')' window,0 plot,out,/xst,/yst,col=0,back=255 end