; CRIB SHEET TO REPRODUCE GEOTAIL REMOTE SENSING RESULTS ; This subroutine reads into idl an ascii file containing the following info. ; channelheadsector (chs) hour, min, sec of arrival of particles of almost ; 90 degree pitch angle at the detector, gyroradius, gyrophase delta i.e., the ; angle between the direction of the parcticle and the y' axis that is on the ; plane perpendicular to the instantaneous magnetic field direction. ; Note that g = 270 - delta, where g=gyrophase, if B is out of the page, ; for ions. ; pro get_d_vs_dt,epsilon,hh,mm,ss,rho,delta,dist,times times=hh*3600+mm*60+ss-(11.*3600.+19.*60.) dist=rho for i=0,n_elements(rho)-1 do begin dist(i)=rho(i)*sin((delta(i)-epsilon)*!PI/180.) endfor return end pro run ; intro_ascii,'remote_sense_A.txt',delta,rho,hh,mm,ss,nskip=13,format="(25x,f6.1,f8.1,3(1x,i2))" ; angle=fltarr(73) chisqrd=fltarr(73) for ijk=0,72 do begin epsilon=float(ijk*5) get_d_vs_dt,epsilon,hh,mm,ss,rho,delta,dist,times yfit=dist & yfit(*)=0. chi2=dist & chi2(*)=0. coeffs=svdfit(times,dist,2,yfit=yfit,chisq=chi2) angle(ijk)=epsilon chisqrd(ijk)=chi2 endfor ipos=indgen(30)+43 chisqrd_min=min(chisqrd(ipos),imin) plot,angle,chisqrd print,angle(ipos(imin)),chisqrd(ipos(imin)) ; stop ; ; once you determine epsilon0 for minimum chi2 then: epsilon0=angle(ipos(imin)) get_d_vs_dt,epsilon0,hh,mm,ss,rho,delta,dist,times yfit=dist & yfit(*)=0. chi2=dist & chi2(*)=0. coeffs=svdfit(times,dist,2,yfit=yfit,chisq=chi2) print,'angle=',epsilon0 print,'d0, V=',coeffs print,'tcross=',-coeffs(0)/coeffs(1) print,'chisqrd=',chi2 plot,times,dist,psym=1 oplot,times,yfit ; stop ; end