;+ ; NAME : faceonv (procedure) ; PURPOSE : Face-on vector magnetogram ; CALLING SEQUENCE : ; faceonv,img,bx,by,bl,gx=gx,gy=gy,h=h,pix1=pix1,btnoise=btnoise,flip=flip ; INPUTS : ; img -- image ; bx,by -- transversal magnetic field ; bl -- longitudinal magnetic field ; KEYWORD PARAMETERS : ; h -- header ; gx,gy -- central position on the solar disk (arc.sec.) ; pix1 -- size of pixel (arc.sec.) ; btnoise -- bias of Bt by noise for subtraction (G) ; flip -- if set, make modification of Bt direction ; OUTPUTS : ; img -- midified image for scatter ; SIDE EFFECT : ; h.correct --> h.correct+100 ; ; MODIFICATION HISTORY : ; created '93/04/18 S.Kawakami & K.Ichimoto ;- pro faceonv,img,bx,by,bl,gx=gx,gy=gy,h=h,pix1=pix1,btnoise=btnoise,flip=flip if n_elements(gx) eq 0 and not keyword_set(h) then begin print,'gx not defined!' retuen endif else begin if n_elements(gx) eq 0 then gx=h(0).g_x endelse if n_elements(gy) eq 0 and not keyword_set(h) then begin print,'gy not defined!' retuen endif else begin if n_elements(gy) eq 0 then gy=h(0).g_y endelse if n_elements(pix1) eq 0 and not keyword_set(h) then begin pix1=pix_size('ft1') endif else begin if n_elements(pix1) eq 0 then pix1=float(h(0).dx) endelse if n_elements(btnoise) eq 0 then btnoise=100. ; bias of Bt due to noise (G) s=size(img) & nx=s(1) & ny=s(2) ;Subtract Bt noise bias if btnoise ne 0. then begin bt=sqrt(float(bx)^2+float(by)^2) bx=fix(bx*float((bt-btnoise*10.)>0.)/(bt>1.)) by=fix(by*float((bt-btnoise*10.)>0.)/(bt>1.)) endif ;Modify Bt direction if keyword_set(flip) then begin pfact=nx/64 cff1n,rebin(bl,nx/pfact,ny/pfact),bxp,byp bxp=rebin(bxp,nx,ny) byp=rebin(byp,nx,ny) relay= abs( bx*bxp + by*byp ) ; relayability of the direction bxs=smooth(bx*relay,20) bys=smooth(by*relay,20) flip = where( bx*bxs + by*bys lt 0.0, count ) if count gt 0 then begin bx( flip ) = -bx( flip ) by( flip ) = -by( flip ) end end ;Normalization of Coordinates (unit=pixel number) rs=970./pix1 ;unit=pixel xc=fix(gx/pix1) ;center coordinate yc=-fix(gy/pix1) ;center coordinate, plus or minus? dx=nx/2 ;width of R.A. dy=ny/2 ;width of Dec. print,'Now, Calculating the Face-on Magnetic Field Vector' ; ;Transformation of Magnetic Vector bbx=intarr(nx,ny) bby=intarr(nx,ny) bbl=intarr(nx,ny) x=(xc-dx+indgen(nx))/rs y=(yc-dy+indgen(ny))/rs sram=fltarr(nx,ny) for j=0,ny-1 do sram(*,j) = x/sqrt(1-y(j)^2) cram=sqrt(1.-sram^2) sfai=y cfai=sqrt(1.-sfai^2) sfai=transpose(sfai) cfai=transpose(cfai) bbx=fix(bx*cram-bl*sram) for i=0,nx-1 do begin bby(i,*)=-bx(i,*)*sram(i,*)*sfai+by(i,*)*cfai-bl(i,*)*cram(i,*)*sfai bbl(i,*)=bx(i,*)*sram(i,*)*cfai+by(i,*)*sfai+bl(i,*)*cram(i,*)*cfai endfor ;Correction for Morphological Distortion img=faceon(img,gx,gy,pix1=pix1) bx=faceon(bbx,gx,gy,pix1=pix1) by=faceon(bby,gx,gy,pix1=pix1) bl=faceon(bbl,gx,gy,pix1=pix1) if keyword_set(h) then h.correct=h.correct+100 end