PRO HSI_VIS_SIZE_VS_PA, vis ; ; Uses visibilities to calculate/display gaussian FWHM diameter as a function of position angle. ; ; vis is a stucture containing visibility data ; ; 27-Mar-05 Initial version (ghurford@ssl.berkeley.edu), adapted from hsi_vis_avg_size ; ; Interpolate amplitudes to output position angles. amp = TRANSPOSE(SQRT(vis.x^2 + vis.y^2)) pa = TRANSPOSE(vis.posn_angle) ok = TRANSPOSE(vis.ok) nrb = N_ELEMENTS(ok)/9 amp = [amp, amp] ; amp[*,9] pa = [pa, pa+360] ; pa[*,9] ok = [ok, ok] ; ok[*,9] paout = (FINDGEN(nrb)+0.5) * 360./nrb + 180. ; output position angles in range [180, 540] ampint = FLTARR(nrb, 9) ; will hold amplitudes interpolated to paout angpitch = 2 * 2.26 * 3.^(FINDGEN(9)*0.5) spatfreq = 1./angpitch dok = INTARR(9) ; = number of valid measurements for each detector flux = FLTARR(nrb) ; will hold resulting flux, fwhm estimates as a function of pa fwhm = FLTARR(nrb) ; ; Loop over detectors FOR nd = 0,8 DO BEGIN iok = WHERE(ok[*,nd] EQ 1, nok) IF nok GT 8 THEN BEGIN ampint[*, nd] = INTERPOL(amp[iok,nd], pa[iok,nd], paout, /QUADRATIC) dok[nd] = nok ENDIF ENDFOR idok = WHERE(dok GT 0, nidok) ; valid detectors IF nidok LT 4 THEN STOP ; ; Loop over position angles FOR j = 0, nrb-1 DO BEGIN output = hsi_gaussfit(spatfreq[idok], REFORM(ampint[j, idok])) ; output[1,2] = fwhm, flux fwhm[j] = output[1] flux[j] = output[2] ENDFOR paplot = paout MOD 360. !P.MULTI = [0,2,2] nrb2 = nrb/2 incr = SORT(paplot) paplot= paplot[incr] fwhm = fwhm[incr] flux = flux[incr] fwhmav = (fwhm[0:nrb2-1] + fwhm[nrb2:nrb-1])/2 ; average over opposite position angles fluxav = (flux[0:nrb2-1] + flux[nrb2:nrb-1])/2 PLOT, paplot, [fwhmav, fwhmav], YTITLE='DIAMETER (arcsec)', XTITLE='POSN ANGLE (deg)', PSYM=6, XSTYLE=1, XRANGE=[0,360] PLOT, paplot, [fluxav, fluxav], YTITLE='FLUX (ph/cm2/s)', XTITLE='POSN ANGLE (deg)', PSYM=6, XSTYLE=1, XRANGE=[0,360] RETURN END