;+ ; NAME: ; ISSI_EGGS ; PURPOSE: ; 1) fit cavity shape as truncated ellipse with point-and-click on ; previously defined submap arrays ; 2) save the cavity geometry for the submaps ; CATEGORY: ; CALLING SEQUENCE: ; issi_eggs, maplist ; INPUTS: ; OPTIONAL (KEYWORD) INPUT PARAMETERS: ; bright, the pixel value for display scaling ; dmin, dmax, alternate method of pixel value display scaling ; OUTPUTS: ; Writes .genx file (default to './map_test.genx') ; COMMON BLOCKS: ; SIDE EFFECTS: ; RESTRICTIONS: ; MODIFICATION HISTORY: ; Sterling, Hudson, Tripathi (5 Nov. 2009) ; bugs to hhudson@ssl.berkeley.edu ; 7-Jul-09, display improvements (HSH) ; 8-Nov-09 Including B0, L0, RSun in output array ; Added _extra, DMin and DMax (T. Kucera) ; 1-Dec-09 added ROT_MAP call (TAK) ;- pro ISSI_EGGS, smap0, bright=bright, outfile=outfile, outstr=outstr, $ qdebug=qdebug,_extra=_extra ;rotate map to roll angle 0 if tag_exist(smap0,'ROLL_ANGLE') then $ if max(abs(smap0.roll_angle)) ne 0 then smap=rot_map(smap0,roll_angle=0.) $ else smap=smap0 maplist = smap default, outfile, 'map_test' default, bright, mean(maplist[0].data) ; ; sequentially read images with three point-and-click sessions: ; 1) click nougat center [cavity center] ; 2) click on bottom edge [occultation or floating bottom] ; 3) left-click a sequence (> 6) of points defining the cavity inner edge ; (click on disk to terminate selection) ; nfiles = n_elements(maplist) outstr = {time:0L, day:0L,id:'',date:'', center:fltarr(2), bottom:fltarr(2), ellipse:fltarr(5)} if tag_exist(smap,'B0') then outstr=add_tag(outstr,0.,'B0',index=3) if tag_exist(smap,'L0') then outstr=add_tag(outstr,0.,'L0',index=4) if tag_exist(smap,'RSun') then outstr=add_tag(outstr,0.,'RSun',index=5) else $ message,/info,'No RSun in map header' outstr=replicate(outstr,nfiles) if n_elements(dmin) ne 1 and keyword_set(bright) then dmin=0.2*bright if n_elements(dmax) ne 1 and keyword_set(bright) then dmax=5*bright for jj = 0, nfiles-1 do begin bright = mean(smap[jj].data) plot_map, maplist[jj], _extra=_extra,dmax=dmax, dmin=dmin print, maplist[jj].time,' ', maplist[0].id print, 'First: left-click on Nougat or cavity center' print, '(click inside disk to terminate)' cursor, x_noug, y_noug, /up, /data plots,[x_noug,x_noug],[y_noug,y_noug],psym=2,symsiz=2 if sqrt(x_noug^2+y_noug^2) lt 900 then goto, bail print, 'Second: left-click on Nougat bottom edge' cursor, x_bot, y_bot, /up, /data print, 'Third: left-clicks to define elliptical cavity, click well within solar disk to quit' x_ell = x_bot & y_ell = y_bot plots,[x_bot,x_bot],[y_bot,y_bot],psym=2,symsiz=2 while sqrt(x_bot^2 + y_bot^2) gt 900. do begin cursor, x_bot, y_bot, /up, /data plots, [x_bot, x_bot], [y_bot, y_bot], psym=2, /data x_ell = [x_ell, x_bot] & y_ell = [y_ell, y_bot] endwhile nclicks = n_elements(x_ell) x_ell = x_ell[1:nclicks-2] & y_ell = y_ell[1:nclicks-2] parm = mpfitellipse(x_ell,y_ell,/tilt,/quiet) parm[2] = parm[2] & parm[3] = parm[3] phi = dindgen(101)*2D*!dpi/100 xx = parm[0]*cos(phi) & yy = parm[1]*sin(phi) mat = [[cos(-parm[4]),-sin(-parm[4])],[sin(-parm[4]),cos(-parm[4])]] xy = fltarr(2,101) for ii = 0, 100 do begin dum = [xx[ii],yy[ii]]#mat xy[*,ii] = dum endfor oplot,parm[2]+xy[0,*],parm[3]+xy[1,*],psym=1 outstr[jj].date= anytim(maplist[jj].time) outstr[jj].time = (anytim(maplist[jj].time,/int)).time outstr[jj].day = (anytim(maplist[jj].time,/int)).day outstr[jj].id = smap[jj].id if tag_exist(smap,'B0') then outstr[jj].B0=smap[jj].B0 if tag_exist(smap,'L0') then outstr[jj].L0=smap[jj].L0 if tag_exist(smap,'RSun') then outstr[jj].RSun = smap[jj].RSun outstr[jj].ellipse = parm outstr[jj].center = [x_noug,y_noug] outstr[jj].bottom = [x_bot,y_bot] default, in, 'Yes' yes_no,'Save this geometry now?', 'Yes', in if(in) then begin savegen,file=outfile,outstr endif else begin jj = jj-1 endelse bail: endfor if keyword_set(qdebug) then stop end