function hsi_vis2pmap,vis,roll_angle,det_index,mapHwidth,dmap_xy,PLOT=plot,$ Rsize=rsize ;+ ; NAME: hsi_vis2pmap ; ; PURPOSE: Converts visibilities into a polar coordinate map ; ; METHOD: ; Compute the convolution of visibility and exp(i*k*r*cos(roll_angle)) ; ; INPUTS: ; vis=complex array of N_vis values for phi=0 to 2*!pi ; Note that the vis must be computed with phase center at the spin axis. ; ce=calib_eventlist structure ; det_index=0-27 ; mapHwidth = 2 * scalar width of map annulus ; RSIZE (optional) = maximum radius (default=960) ; ; OUTPUTS: ; dmap(j_r,n_theta) = "dirty" map ; Lots of plots if optional keyword PLOT is set ; Optional return of rectangular map if dmap_xy variable exists ; ; EXAMPLE: ; N=512 ; roll_angle=findgen(N)*2*!pi/N ; det_index=4 ; pitch=((hsi_grid_parameters()).pitch)(det_index) ; i=complex(0,1) ; vis=100*exp(i*2*!pi*605.*cos(roll_angle)/pitch) ; count=100+float(vis) ; phase_map_ctr=2*!pi*600.*cos(roll_angle)/pitch ; ce={roll_angle:roll_angle,count:count,phase_map_ctr:phase_map_ctr} ; mapHwidth=256 & RSIZE=906 ; central radius=650 ; dmap=hsi_vis2pmap(vis,roll_angle,det_index,mapHwidth,RSIZE=rsize,/plot) ; ; ; FUNCTIONS CALLED: ; hsi_convl.pro ; ; RESTRICTIONS: ; Makes only annular maps at present ; The visibilities must have been phase shifted to the polar center ; ; VERSION HISTORY: ; VERS. 1 EJS Mar 29, 1999 ; VERS. 2 EJS Sept 28, 1999 ; Doubled width of annulus, increased final map to 360-deg coverage. ; VERS. 3 EJS Oct 15, 1999 ; Replaced spin radius by a call to phase2radius ; fixed an error in r2 ; VERS. 4 EJS Oct 26, 1999 ; Changed Bessel function calls to hsi_convl calls. ; 4.1 EJS Nov 22, 1999 ; Removed dependence on calib_event list ce, ; replaced argument ce with roll_angle, so will work with ; any valid visibilities. ; NOTES: ;- ; function hsi_vis2pmap,vis,roll_angle,det_index,mapHwidth,dmap_xy,plot=plot message,'Beginning...',/inform !p.multi=[0,1,2] sigma=-1. if keyword_set(Rsize) then r2=Rsize else r2=960 r0=r2-mapHwidth ; mean radius of annulus r1=r0-mapHwidth ; inner radius of annulus message,'outer radius of annulus='+strcompress(rsize),/info message,'inner radius of annulus='+strcompress(r1),/info message,'mean radius of annulus='+strcompress(r0),/info phi1=-!pi & phi2=!pi ; min and max azimuths to be mapped if (keyword_set(plot)) then begin window,1 plot,float(vis),xsty=1,tit='Real Part of Visibilities' plot,imaginary(vis),xsty=1,tit='Imaginary Part of Visibilities' endif pitch=((hsi_grid_parameters()).pitch)(det_index mod 9) if (max(abs(vis)) LT .0001) then message,'All visibilities are essentially 0' Nroll=n_elements(roll_angle) k=2*!pi/pitch r=r1+findgen(r2-r1) kr=k*r i=complex(0,1) dmap=fltarr(Nroll,r2-r1) message,'Doing'+string(r2-r1)+' radii...',/inform cos_roll=cos(roll_angle) for j=0,r2-r1-1 do begin v=exp(-i*kr[j]*cos_roll) d=hsi_convl(v,vis) dmap[*,r[j]-r1]=d ; 1st arg is azimuth, 2nd is radius endfor if (keyword_set(plot)) then begin erase ndx=n_elements(dmap(*,0)) & ndy=n_elements(dmap(0,*)) window,/free,xsize=ndx,ysize=ndy,title='hsi_vis2pmap.pro: Real Part of DMAP' print,'Pausing for 1 sec..' & wait,1 erase tvscl,dmap endif if (n_elements(dmap_xy) NE 0) then begin message,'Calling hsi_pmap2xy.pro...' ,/inform ; dmap: 1st index is azimuth (0 to 2*!pi), 2nd is radius dmap_xy=hsi_pmap2xy(dmap,r1,r2, box_size=256, pixel_size=2.0) ;box_size of 256 pixels @ 1 arcsec message,'r1,r0,r2='+string(r1)+string(r0)+string(r2),/inform size_xy = (size(dmap_xy))[1:2] if (!d.name NE 'PS') then begin get_xwin,0,xsize=size_xy[0],ysize=size_xy[1],title='hsi_vis2pmap.pro' if !d.x_size lt size_xy[0] or !d.y_size lt size_xy[1] then begin wdelete,0 window,0,xsize=size_xy[0],ysize=size_xy[1],title='hsi_vis2pmap.pro' endif endif tvscl,dmap_xy endif return,dmap end