Commit 0e412981 authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

On recupere le resultat du fit meme si fit a echoue pour les auto-cor, Reza 22/02/2019

parent dc50265f
......@@ -372,7 +372,7 @@ int ACxSetFitter::doACfit(string outfilename)
cout << "---- ACxSetFitter::doACfit() ; Performing antenna pointing fit ..."<<endl;
ofstream ofr(outfilename.c_str());
ofr << "#### Pointing/dish diameter fit on autocorrelation (ACxSetFitter::doACfit() "<<endl
<< "## NumAntenna Xi2red Deff err_Deff Elevation err_Elev Azimuth err_Ezim A0 err_A0 B0 err_B0 A1 err_A1 B1 err_B1 ..."<<endl;
<< "## NumAntenna RcFit Xi2red Deff err_Deff Elevation err_Elev Azimuth err_Ezim A0 err_A0 B0 err_B0 A1 err_A1 B1 err_B1 ..."<<endl;
size_t NB_ANTENNES = acxd_.getNbAutoCor();
size_t NTRK = acxd_.NbTrk();
......@@ -436,53 +436,55 @@ int ACxSetFitter::doACfit(string outfilename)
if(rcfit>0) {
cout<< "------- Fit result for Antenna No="<<ii+1<<" Reduce_Chisquare = " << mFit.GetChi2Red()
<< " nstep="<<mFit.GetNStep() << " rc="<<rcfit<<endl;
ofr <<setw(4)<<ii+1<<" "<<setw(8)<<mFit.GetChi2Red()<<" ";
v_xi2red_ac[ii]=mFit.GetChi2Red();
double Dfit=mFit.GetParm(0); double err_Dfit=mFit.GetParmErr(0);
cout <<setw(16)<<"DishDiameter= "<<setw(10)<<Dfit<<" +/- "<<setw(10)<<err_Dfit<<" m."<<endl;
ofr <<setw(8)<<Dfit<<" "<<setw(8)<<err_Dfit<<" ";
v_Ddish[ii]=Dfit;
v_err_Ddish[ii]=err_Dfit;
double thetaant=mFit.GetParm(1); double err_thetaant=mFit.GetParmErr(1);
v_thetaant[ii]=thetaant;
double elevdeg=90.-Angle(thetaant).ToDegree();
double err_elevdeg=Angle(err_thetaant).ToDegree();
cout <<setw(16)<<"ThetaAntenne= "<<setw(12)<<Angle(thetaant).ToDegree()<< " +/- "
<<setw(12)<<Angle(err_thetaant).ToDegree()<<" (elevation="
<<setw(8)<<elevdeg<<" +/- "<<setw(8)<<err_elevdeg<<") deg."<<endl;
ofr <<setw(8)<<elevdeg<<" "<<setw(8)<<err_elevdeg<<" ";
double phiant=mFit.GetParm(2); double err_phiant=mFit.GetParmErr(2);
double azimdeg=90.-Angle(phiant).ToDegree();
if (azimdeg<0.) azimdeg += 360.;
double err_azimdeg=Angle(err_phiant).ToDegree();
v_phiant[ii]=phiant;
cout <<setw(16)<<"PhiAntenne= "<<setw(12)<<Angle(phiant).ToDegree()<< " +/- "
<<setw(12)<<Angle(err_phiant).ToDegree()<<" (azimuth ="
<<setw(8)<<azimdeg<<" +/- "<<setw(8)<<err_azimdeg<<" ) deg."<<endl;
ofr <<setw(8)<<azimdeg<<" "<<setw(8)<<err_azimdeg<<" ";
for(size_t j=0; j<NTRK; j++) {
double A=mFit.GetParm(3+2*j); double err_A=mFit.GetParmErr(3+2*j);
double B=mFit.GetParm(4+2*j); double err_B=mFit.GetParmErr(4+2*j);
cout << " Trk/Sat["<<j<<"] -> A= "<<A<<" +/- "<<err_A<<" B= "<<B<<" +/- "<<err_B<<endl;
v_A[ii][j]=A; v_B[ii][j]=B;
v_err_A[ii][j]=err_A; v_err_B[ii][j]=err_B;
ofr <<setw(8)<<A<<" "<<setw(8)<<err_A<<" "<<setw(8)<<B<<" "<<setw(8)<<err_B<<" ";
}
ofr << endl;
double clight = PhysQty::c().SIValue();
double lambda = clight/(acxd_.v_freqs[0]*1.e6);
ACBeam acb1(Dfit, thetaant, phiant, lambda);
acb1.setGaussianLobe(fggaussbeam_);
ACBeam acb2(Dfit, thetaant, phiant, lambda);
acb2.setGaussianLobe(fggaussbeam_);
Vector3d baseline0(0.,0.,0.);
v_acbeams[ii]=CxBeam(acb1, acb2, baseline0);
}
else {
cout << "---Fit failed for "<<ii+1<<"--- Fit_Error, rc = " << rcfit << " nstep="<<mFit.GetNStep()<<endl;
ofr <<setw(4)<<ii+1<<" ERROR FIT RC="<<rcfit<<" nstep="<<mFit.GetNStep()<<endl;
if (_prtlevel_>0) mFit.PrintFitErr(rcfit);
}
ofr <<setw(4)<<ii+1<<" "<<setw(8)<<mFit.GetChi2Red()<<" ";
v_xi2red_ac[ii]=mFit.GetChi2Red();
double Dfit=mFit.GetParm(0); double err_Dfit=mFit.GetParmErr(0);
cout <<setw(16)<<"DishDiameter= "<<setw(10)<<Dfit<<" +/- "<<setw(10)<<err_Dfit<<" m."<<endl;
ofr <<setw(5)<<rcfit<<" "<<setw(8)<<Dfit<<" "<<setw(8)<<err_Dfit<<" ";
v_Ddish[ii]=Dfit;
v_err_Ddish[ii]=err_Dfit;
double thetaant=mFit.GetParm(1); double err_thetaant=mFit.GetParmErr(1);
v_thetaant[ii]=thetaant;
double elevdeg=90.-Angle(thetaant).ToDegree();
double err_elevdeg=Angle(err_thetaant).ToDegree();
cout <<setw(16)<<"ThetaAntenne= "<<setw(12)<<Angle(thetaant).ToDegree()<< " +/- "
<<setw(12)<<Angle(err_thetaant).ToDegree()<<" (elevation="
<<setw(8)<<elevdeg<<" +/- "<<setw(8)<<err_elevdeg<<") deg."<<endl;
ofr <<setw(8)<<elevdeg<<" "<<setw(8)<<err_elevdeg<<" ";
double phiant=mFit.GetParm(2); double err_phiant=mFit.GetParmErr(2);
double azimdeg=90.-Angle(phiant).ToDegree();
if (azimdeg<0.) azimdeg += 360.;
double err_azimdeg=Angle(err_phiant).ToDegree();
v_phiant[ii]=phiant;
cout <<setw(16)<<"PhiAntenne= "<<setw(12)<<Angle(phiant).ToDegree()<< " +/- "
<<setw(12)<<Angle(err_phiant).ToDegree()<<" (azimuth ="
<<setw(8)<<azimdeg<<" +/- "<<setw(8)<<err_azimdeg<<" ) deg."<<endl;
ofr <<setw(8)<<azimdeg<<" "<<setw(8)<<err_azimdeg<<" ";
for(size_t j=0; j<NTRK; j++) {
double A=mFit.GetParm(3+2*j); double err_A=mFit.GetParmErr(3+2*j);
double B=mFit.GetParm(4+2*j); double err_B=mFit.GetParmErr(4+2*j);
cout << " Trk/Sat["<<j<<"] -> A= "<<A<<" +/- "<<err_A<<" B= "<<B<<" +/- "<<err_B<<endl;
v_A[ii][j]=A; v_B[ii][j]=B;
v_err_A[ii][j]=err_A; v_err_B[ii][j]=err_B;
ofr <<setw(8)<<A<<" "<<setw(8)<<err_A<<" "<<setw(8)<<B<<" "<<setw(8)<<err_B<<" ";
}
ofr << endl;
double clight = PhysQty::c().SIValue();
double lambda = clight/(acxd_.v_freqs[0]*1.e6);
ACBeam acb1(Dfit, thetaant, phiant, lambda);
acb1.setGaussianLobe(fggaussbeam_);
ACBeam acb2(Dfit, thetaant, phiant, lambda);
acb2.setGaussianLobe(fggaussbeam_);
Vector3d baseline0(0.,0.,0.);
v_acbeams[ii]=CxBeam(acb1, acb2, baseline0);
}
fit_ac_done=true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment