Commit cfc7c51f authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Correction calcul valeur initiale de l'amplitude pour fit auto-correlation et...

Correction calcul valeur initiale de l'amplitude pour fit auto-correlation et ajout option -cxB0 au programme trkacxfit.cc pour fixer ou laisser libre la base ou offset des visibilites ds le fit des cross-corr, Reza 03/03/2019
parent 8cdea869
......@@ -90,6 +90,7 @@ static string default_input_path;
static vector<string> trksetfiles; // datacard files defining the track/data sets
static bool do_cxfit = true ; // if false, perform AutoCor fit only
static bool fg_cxB0 = false ; // if true, fix offset B to zero (complex(0,0)) when fitting cross-correlations
static bool fg_phi0only = true; // if false, linear varying phase with frequency, in AutoCor and Cross-Cor fits
// ---- fit simultane sur les 6 cross-correlations
......@@ -138,7 +139,7 @@ int main (int narg, char* arg[])
sprintf(fnbuff,"cx_%d_",(int)(i+1));
string cxofile = fnbuff+outfilename;
string cxckfile = fnbuff+checkfilename;
acxfit.doCxfit(cxofile, fguseAac4Cx, fg_phi0only);
acxfit.doCxfit(cxofile, fguseAac4Cx, fg_cxB0, fg_phi0only);
acxfit.saveExpectedCx(cxckfile);
}
v_acxd.push_back(acxd);
......@@ -199,7 +200,7 @@ int decode_args(int narg, char* arg[])
cout << " trkacxfit : fit array geometry and \n"
<< " Usage: trkacxfit [-options] track_Set_1 [track_Set_2] [track_Set_3 ...] \n"
<< " options: -inp def_input_path -out OutFileName -ckf CheckFileName \n"
<< " -nocxf -phifreq -docx6f -fixb -docx6s \n"
<< " -nocxf -cxB0 -phifreq -docx6f -fixb -docx6s \n"
<<" -D dish_diameter -ngb -prt PrintLevel \n"<<endl;
if (!fglonghelp) {
cout << " trkacxfit -h to get option description " << endl;
......@@ -212,6 +213,7 @@ int decode_args(int narg, char* arg[])
<< " Output file names are constructed from OutFileName and CheckFileName prepending \n"
<< " ac_JJ_ or cx_JJ_ where JJ=1...n is the track_set number \n"
<< " -nocxf : Don't perform fit on cross-cor (AutoCor only fit) - default YES -> DO Cx fits) \n"
<< " -cxB0 : Fix the visibility offset B to zero (complex(0,0)) for cross-cor fitting - default NO -> fit B0 \n"
<< " -phifreq : Use linearly varying phase with frequency model - default No fixed Phi=Phi0 \n"
<<" Linear phi model : Phi(freq)=Phi_0 + a_Phi*(freq-1250)/250 \n"
<< " -docx6f : Perform simultaneous fit over 6 cross-corr (baseline and phases determination) - default NO \n"
......@@ -235,6 +237,7 @@ int decode_args(int narg, char* arg[])
do_baselinefit=false;
fg_fixbaseline=false;
do_baselinesimplex=false;
fg_cxB0=false;
vector<string> lastargs;
while (narg>1) {
......@@ -249,6 +252,9 @@ int decode_args(int narg, char* arg[])
else if (fbo=="-nocxf") { // DON'T FIT Cross-Correlations
do_cxfit=false; arg++; narg--; lastargs.clear();
}
else if (fbo=="-cxB0") { // Fix B = 0 when fitting Cross-cor
fg_cxB0=true; arg++; narg--; lastargs.clear();
}
else if (fbo=="-phifreq") { // Use linear model for phase(frequency) - If not Phi(freq) = Phi0
fg_phi0only=false; arg++; narg--; lastargs.clear();
}
......@@ -291,7 +297,8 @@ int decode_args(int narg, char* arg[])
cout << " Beam: D_dish (initial guess)="<<D_dish<<" GaussianBeam ? "<<(fggaussbeam?"Yes":"No")<<endl;
cout << " OutFileName= "<<outfilename<<" CheckFileName= "<<checkfilename<<endl;
cout << " Perform fits on cross-correlations ? " << (do_cxfit?"Yes":"No")
<< " Phase model : Phase(freq)= " << (fg_phi0only?"Phi0":"Phi0+aPhi*(freq-1250)/250") << endl;
<< " Phase model : Phase(freq)= " << (fg_phi0only?"Phi0":"Phi0+aPhi*(freq-1250)/250")
<< " Fix B0 to zero ? "<<(fg_cxB0?"Yes":"No")<<endl;
cout << " Perform baseline fit ? " << (do_baselinefit?"Yes":"No")
<<(fg_fixbaseline?" With FIXED baselines":" (Phases & baselines)")
<<" Simplex-Minimisation ? "<<(do_baselinesimplex?"Yes":"No")<<endl;
......
......@@ -479,6 +479,11 @@ int ACxSetFitter::doACfit(string outfilename)
for(size_t j=0; j<NTRK; j++) {
double A = acxd_.v_max_data[j][ii];
double B = acxd_.v_min_data[j][ii];
A -= B;
if (A<1.e-9) {
cout << " doACfit()/Warning NumAnt/ii="<<ii<<" NumTrk/j="<<j<<" Negative A , A="<<A<<" B="<<B<<" A->"<<0.1*B<<endl;
A=0.1*B;
}
v_A[ii][j]=A; v_err_A[ii][j]=0.;
v_B[ii][j]=B; v_err_B[ii][j]=0.;
//DEL if (acxd_.v_noAC[j]) continue;
......@@ -609,7 +614,7 @@ int ACxSetFitter::saveExpectedAC(string outcheckfilename)
}
int ACxSetFitter::doCxfit(string outfilenamecx, bool useAac, bool fgphi0only)
int ACxSetFitter::doCxfit(string outfilenamecx, bool useAac, bool fg_B0, bool fgphi0only)
{
size_t NB_ANTENNES=acxd_.getNbAutoCor(); // nombre d'antennes
size_t NB_CXCORS=acxd_.getNbCrossCor();
......@@ -734,8 +739,10 @@ int ACxSetFitter::doCxfit(string outfilenamecx, bool useAac, bool fgphi0only)
mFit.SetParam(3+3*j,pname,0.,A/25.,-A/5,A/5.);
sprintf(pname,"Bim%d",(int)(j+1));
mFit.SetParam(4+3*j,pname,0.,A/25.,-A/5,A/5.);
mFit.SetFix(3+3*j,0.);
mFit.SetFix(4+3*j,0.);
if (fg_B0) {
mFit.SetFix(3+3*j,0.);
mFit.SetFix(4+3*j,0.);
}
}
//DBG mFit.PrintFit();
if (_prtlevel_>1)
......
......@@ -138,7 +138,7 @@ class ACxSetFitter {
public:
ACxSetFitter(AcxDataSet & data, TrackSet & tks);
int doACfit(string outfilename); // outfilename : fit results
int doCxfit(string outfilenamecx, bool useAac=true, bool fgphi0only=true); // outfilename : fit results
int doCxfit(string outfilenamecx, bool useAac=true, bool fg_B0=false, bool fgphi0only=true); // outfilename : fit results
int saveExpectedAC(string outcheckfilename); // outfilename PPF (or fits ?) file with the expected AC signals
int saveExpectedCx(string outcheckfilename); // outfilename PPF (or fits ?) file with the expected signals
......
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