pro sxt_xy4_xda,index,data,xyout=xyout,dxyout=dxyout,plot=plot,kill=kill,$ nosmooth=nosmooth,look=look,nopix=nopix,$ reject=reject,resol=resol,loud=loud,attin=attin ; obsolete: pixout=pixout ;+ ; NAME ; sxt_xy4_xda ; PURPOSE ; To adjust (correct) the x and y pointing values ; evaluated for completeness of the fitting data points in ; angle around the limb with the use of sector_pix.pro. ; CALLING SEQUENCE ; sxt_xy4_xda,index,data,xyout=xyout,dxyout=dxyout,plot=plot,kill=kill,$ ; nosmooth=nosmooth,look=look,nopix=nopix,$ ; pixout=pixout,reject=reject,resol=resol,loud=loud,attin=attin ; INPUT ; index, xda index structure. ; data, floating point or integer image cube. Unless optical ; image safe_log10 is applied to data. ; OPTIONAL KEYWORD INPUT ; kill, iterations of limb point cleaning in fit_xlimb. ; (default: kill=3) ; /nosmooth, if set, do NOT do fit_xlimb on 5-pixel smoothed image. ; /plot, displays before/after results of adjustment on screen. ; (If plot not set then look=0 and nopix=1 by default.) ; /look, pause after each fitting for examination. ; /nopix, don't display sector images. ; /loud, print diagnistics. ; attin, input att rather than using sxt_cen. ; KEYWORD OUTPUT ; dxyout, shift of suncenter coordinates (HR pix) ; NOTE: For unacceptable shift or no fit xyout=dxyout=-1000. ; OPTIONAL KEYWORD OUTPUT ; pixout, structure containing output of sector_pix (OBSOLETE) ; xyout, revised suncenter coordinates (HR pix) ; reject, array of times of reject images. ; RESTRICTIONS ; For review/interactive feature to work /plot and /look have ; to be set. ; Input must be an SSW map file of 512x512 images. ; QR images are often to noisy for fit_xlimb to work well. ; PROGRAMS CALLED ; get_rb0p, fit_xlimb, rebin, plot_map ; HISTORY ; 6-Oct-2008 LWA Created from sxt_xy4 to eliminate use of FITS. ; 7-Oct-2008 LWA More debugging. ; 15-Oct-2008 LWA Deleted obsolete comments. ; Added rcycle flag and keyword attin. ; 18-Dec-2008 LWA Added logic for wset,4 call. ; Added keyword no_ask to fit_xlimb call. ; 8-May-2013 LWA Added /quiet in call to get_rb0p. ;- xyout=fltarr(2,n_elements(index)) dxyout=fltarr(2,n_elements(index)) plot=keyword_set(plot) loud=keyword_set(loud) look=keyword_set(look) nopix=keyword_set(nopix) a_in=keyword_set(attin) if not plot then begin look=0 nopix=1 in0=1 endif nosmooth=keyword_set(nosmooth) smooth=1-nosmooth if NOT keyword_set(kill) then kill=3 else kill=kill if plot then begin clearplot wdef,4 & wdef,2 & wdef,3 endif jumpout=0 ; Step through the images for the day. for i=0,n_elements(index)-1 do begin recycle=0 rsun=get_rb0p(index(i),/radius,/quiet) if a_in then begin aj=tim2dset(attin,index(i)) xy=shift_res(attin(aj).pnt(0:1)/100.,/xy,/fh) endif else begin xy=shift_res(sxt_cen(index(i)),/xy,/fh) endelse if gt_res(index(i)) eq 2 then pdat=mod_res(index(i),data(*,*,i),$ outres=1) else pdat=data(*,*,i) if gt_filta(index(i)) eq 2 or gt_filta(index(i)) eq 5 then $ pdat=pdat else pdat=safe_log10(pdat) info=get_info(index(i),/non) if plot then begin set_plot,'x' wset,2 tvscl,pdat draw_circle,/dev,xy(0),xy(1),rsun/4.91 xyouts,/dev,10,10,info,charsize=1.2 xyouts,/dev,50,40,strtrim(i,2)+' BEFORE ADJUSTMENT',charsize=1.4 ;Following returns a 1 for yes or 0 for no. yesnox,'Is the ATT for this image OK?',an0,'n' if an0 then begin xi=xy(0) yi=xy(1) xyout(*,i)=[xi,yi] in0=0 goto,rejected endif in0=0 endif x=xy(0) y=xy(1) redo : if plot then wset,4 if loud then help,x,y,rsun pdatx=big_smooth(pdat,5)>0 fit_xlimb,pdatx,x0,y0,/norfit,initial_values=[x,y,rsun/4.91],$ pixel_size=1.,kill=kill,/quiet, $ limb_points=plot,interactive=interactive,xlimb=xout,ylimb=yout, $ no_ask=1-plot if (x0 eq -1.0 and y0 eq -1.0) then begin ;Jump if fit_xlimb fails. xyout(*,i)=[-1000.,-1000.] dxyout(*,i)=[-1000.,-1000.] goto,noxfit ;Jump if values are unreasonable. endif xyout(*,i)=[x0,y0] if not recycle then begin dxyout(*,i)=[x0-x,y0-y] endif else begin dxyout(0,i)=dxyout(0,i)+(x0-x) dxyout(1,i)=dxyout(1,i)+(y0-y) endelse x=x0 y=y0 if max(abs(dxyout(*,i)) gt 30) then begin print,'noxfit' ;goto, NOXFIT print,dxyout(*,i) endif noxfit : print,i,' Xshift:',dxyout(0,i),' Yshift:',dxyout(1,i) ;#### The following steps are merely to create outpix. #### ; tstimg=bytarr(512,512) ; tstimg(fix(round(xout)),fix(round(yout)))=1 ; Limits on the annulus to be searched for the limb. ; rin=(rsun/4.91)-15. ;LWA 2/06/2006 ; rout=(rsun/4.91)+15. ;LWA 2/06/2006 ; outpix=sector_pix(x0,y0,tstimg,r_inner=rin,r_outer=rout,$ ; nopix=nopix) ; outpix=add_tag2(outpix,anytim(index(i),/yoh),'time',index=-1,/quiet) ; if i eq 0 then pixout=outpix else pixout=concat_struct(pixout,outpix) ;#### ----------------------------------------------- #### if keyword_set(plot) then begin set_plot,'x' wset,3 tvscl,pdat draw_circle,/dev,x0,y0,rsun/4.91 xyouts,/dev,0,70,info,charsize=1.2 xyouts,/dev,50,50,strtrim(i,2)+' AFTER ADJUSTMENT',charsize=1.4 xyouts,/dev,50,30,'dx = '+strtrim(dxyout(0,i),2),charsize=1.6 xyouts,/dev,50,10,'dy = '+strtrim(dxyout(1,i),2),charsize=1.6 if look then begin yesnox,'Do you like the fit, else redo '+$ strtrim(i,2)+'.',in,'y' if not in then begin interactive=1 recycle=1 goto,redo endif else begin interactive=0 endelse endif endif rejected: if jumpout eq 1 then goto, outahere endfor outahere : ; Here's a chance to go back and refit selected images. ;if plot and look and NOT in0 then begin ; yesnox,'Do you want to redo any particular image?',it,'n' ; if it then begin ; read,'Please type in the image number. ',mm ; i=mm ; jumpout=1 ; goto, redo ; endif ;endif end