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

suite implementation et premier execution OK de la nouvelle version du...

suite implementation et premier execution OK de la nouvelle version du programme d'ajustement des phases, Reza 19/02/2019
parent 8f06d719
/*---
/*----------------------------
PAON4 analysis :
Determining antenna pointing and dish size fitting parameters ...
(source track corresponds to a satellite track (or planet or sun ...)
......@@ -7,10 +7,27 @@
R. Ansari , February 2019
Evolution of trkacfit.cc , intended to replace it
Assuming that the file trk_1.d contains :
@zenang 10
@trk dt_A21 1358,1410 1278.5 trk_A21_43057
@trk dt_A21 1512,1555 1278.5 trk_A21_43055
Example command to run :
csh> ../AnaPaon4/Objs/trkacxfit -D 4.5 -sdec 10 -out A21_fac.txt dt_A21,trk_A21_43057,1358,1410,1278.5 dt_A21,trk_A21_43055,1512,1555,1278.5
csh> ../AnaPaon4/Objs/trkacxfit -D 4.5 -out A21_fac.txt trk_1.d
----------------------------------------------------------*/
visi-track-set datacard format
----------------------------------
# input path (directory for files) listed here (optional)
@inpath path
## Zenith angle or declination shift
# Zenith angle_in_degree (positive toward north) initial value for fit
@zenang ZenithAngle
### Input data and track files - multiple @trk cards
# filenames with .ppf extension , Tstart,Tend in minutes
@trk AutoCrossVisiDataTableFile Tstart,Tend Freq TrackFile
----------------------------------------------------------------------------*/
#include <stdlib.h>
#include <string.h>
......@@ -68,6 +85,7 @@ static bool fguseAac4Cx=true; //if true, use fitted Amplitudes on autocor
static int prtlevel=0; // print level
static string default_input_path;
static vector<string> trksetfiles; // datacard files defining the track/data sets
//--- End of list of global parameters
......@@ -90,19 +108,25 @@ int main (int narg, char* arg[])
int rcda=decode_args(narg, arg);
if (rcda) return rcda;
TrkFit_SetPrintLevel(prtlevel);
vector<AcxDataSet> v_acxd;
vector<TrackSet> v_trk;
for(size_t i=0; i<trksetfiles.size(); i++) {
TrkInputDataSet tids(trksetfiles[i]);
TrkInputDataSet tids(trksetfiles[i], default_input_path);
cout<<" --- Processing data-track set # "<<i+1<<" /max="<<trksetfiles.size()<<endl;
cout<<tids;
AcxDataSet acxd(tids);
TrackSet tks(tids);
ACxSetFitter acxfit(acxd, tks);
string acofile = "ac_"+outfilename;
char fnbuff[32];
sprintf(fnbuff,"ac_%d_",(int)(i+1));
string acofile = fnbuff+outfilename;
acxfit.doACfit(acofile);
string acckfile = "ac_"+checkfilename;
string acckfile = fnbuff+checkfilename;
acxfit.saveExpectedAC(acckfile);
string cxofile = "cx_"+outfilename;
string cxckfile = "ac_"+checkfilename;
sprintf(fnbuff,"cx_%d_",(int)(i+1));
string cxofile = fnbuff+outfilename;
string cxckfile = fnbuff+checkfilename;
acxfit.doCxfit(cxofile, cxckfile, fguseAac4Cx);
v_acxd.push_back(acxd);
......@@ -142,17 +166,25 @@ int decode_args(int narg, char* arg[])
if ((narg<2)||fglonghelp) {
cout << " trkacxfit : fit array geometry and \n"
<< " Usage: trkacxfit [-options] track_Set_1 [track_Set_2] [track_Set_3 ...] \n"
<< " options: -D dish_diameter -ngb -out OutBaseFileName -ckf CheckBaseFileName \n"
<< " -prt PrintLevel \n"<<endl;
<< " options: -inp def_input_path -out OutFileName -ckf CheckFileName \n"
<< " -D dish_diameter -ngb -prt PrintLevel \n"<<endl;
if (!fglonghelp) {
cout << " trkacxfit -h to get option description " << endl;
return 2;
}
cout << " -D dish_diameter : define effective dish diameter (in meter D*eff , def=4.5) \n"
cout << " -inp def_input_path : default directory path for input files (track_Set_J files) \n"
<< " This path can be overwritten in each track_Set_J datacard file \n"
<< " -out OutFileName : Output file (text) to save fitted parameters vectors (def trkfit.txt) \n"
<< " -ckf CheckFileName : Output file (PPF) to save expected signals (def chktrkfit.ppf) \n"
<< " 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"
<< " -D dish_diameter : define effective dish diameter (in meter D*eff , def=4.5) \n"
<< " -ngb : Use non gaussian beam profile (Bessel j1(angle)) \n"
<< " -prt PrintLevel: specify print level \n"
<< " -out OutFileName : Output file (text) to save fitted parameters vectors (def trkfit.txt) \n"
<< " -ckf CheckFileName : Output file (PPF) to save expected signals (def chktrkfit.ppf) \n"<<endl;
<< " track_Set_J (J=1..n) are the auto/cross correlation and track data sets \n"
<< " in datacard format [ @trk (multiple) @zenang cards @inpath] \n"
<< " @trk AutoCrossVisDataTableFile Tstart,Tend Freq TrackFileName \n"
<< " Filenames without .ppf extension, Tstart,Tend in minutes Freq in MHz for @trk cards \n" <<endl;
return 1;
}
......@@ -172,6 +204,10 @@ int decode_args(int narg, char* arg[])
else if (fbo=="-ngb") { // Use Non gaussian beam
fggaussbeam=false; arg++; narg--; lastargs.clear();
}
else if (fbo=="-inp") { // output file name
if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; }
default_input_path=arg[2]; arg+=2; narg-=2; lastargs.clear();
}
else if (fbo=="-out") { // output file name
if (narg<2) { cout << "trkacxfit/decode_args missing/bad argument, -h for help " << endl; return -1; }
outfilename=arg[2]; arg+=2; narg-=2; lastargs.clear();
......@@ -195,7 +231,7 @@ int decode_args(int narg, char* arg[])
cout << " ------------------- trkacxfit/run parameters:"<<endl;
cout << " Beam: D_dish (initial guess)="<<D_dish<<" GaussianBeam ? "<<(fggaussbeam?"Yes":"No")<<endl;
cout << " OutFileName= "<<outfilename<<" CheckFileName= "<<checkfilename<<endl;
cout << " --- TrackSetFiles: (NbFiles="<<lastargs.size()<<endl;
cout << " --- TrackSetFiles: (NbFiles="<<lastargs.size()<<" default directory: "<<default_input_path<<")"<<endl;
trksetfiles = lastargs;
for (size_t i=0; i<trksetfiles.size(); i++) {
cout << "["<<i<<"] : "<< trksetfiles[i]<<endl;
......
......@@ -29,9 +29,11 @@ void TrkFit_SetPrintLevel(int lev)
//------------------- TrkInputDataSet -------------------------------------
TrkInputDataSet::TrkInputDataSet(string dcfilename)
TrkInputDataSet::TrkInputDataSet(string dcfilename, string inp_path)
: zenang(0.) , theta_0(0.) , phi_0(0.)
{
setInputBasePath(inp_path);
ReadDatacardFile(dcfilename);
}
......@@ -67,10 +69,16 @@ static int decode_trkcard(string const& key, string const& toks)
}
void TrkInputDataSet::setInputBasePath(string inp_path)
{
if (inp_path.length()>0) input_base_path=inp_path;
return;
}
size_t TrkInputDataSet::ReadDatacardFile(string dcfilename)
{
DataCards dc;
string match="freqband";
string match="trk";
dc.AddProcF(decode_trkcard, match);
zenang=0.; theta_0=0.; phi_0=0.;
......@@ -339,10 +347,11 @@ ACxSetFitter::ACxSetFitter(AcxDataSet & data, TrackSet & tks)
v_err_phiant(tks.getNbAutoCor()), v_err_A(tks.getNbAutoCor()), v_err_B(tks.getNbAutoCor()),
v_acbeams(tks.getNbAutoCor()),
v_RcFit_cx(tks.getNbCrossCor()), v_xi2red_cx(tks.getNbCrossCor()),
v_phase(tks.getNbCrossCor()), v_Acx(tks.getNbCrossCor()),
v_err_phase(tks.getNbCrossCor()), v_err_Acx(tks.getNbCrossCor()),
v_phase(tks.getNbCrossCor()), v_Acx(tks.getNbCrossCor()), v_Bcx(tks.getNbCrossCor()),
v_err_phase(tks.getNbCrossCor()), v_err_Acx(tks.getNbCrossCor()), v_err_Bcx(tks.getNbCrossCor()),
v_cxbeams(tks.getNbCrossCor())
{
}
int ACxSetFitter::doACfit(string outfilename)
......@@ -528,9 +537,12 @@ int ACxSetFitter::doCxfit(string outfilenamecx, string outcheckfilenamecx, bool
size_t Anum2[6]={1,2,3,2,3,3};
for(size_t ii=0; ii<NB_CXCORS; ii++) {
v_Acx[ii].resize(NTRK);
v_Bcx[ii].resize(NTRK);
v_Bcx[ii].resize(NTRK);
v_err_Acx[ii].resize(NTRK);
v_err_Bcx[ii].resize(NTRK);
for(size_t j=0; j<NTRK; j++) {
v_Acx[ii][j]=1.; v_Bcx[ii][j]=complex<double>(0.,0.);
v_err_Acx[ii][j]=1.; v_err_Bcx[ii][j]=complex<double>(0.,0.);
}
Vector3d baseline=P4Coords::getBaseline(Anum1[ii]+1,Anum2[ii]+1);
cout << "--------- 1."<<ii+1<<" doCxfit() Doing fit for CrossCor= " << ii << " FxF= "
......
......@@ -28,7 +28,9 @@ void TrkFit_SetPrintLevel(int lev=0);
class TrkInputDataSet {
public:
TrkInputDataSet() : zenang(0.) , theta_0(0.) , phi_0(0.) { }
TrkInputDataSet(string dcfilename); // create the object reading filenames and other parameters from the datacard file
TrkInputDataSet(string dcfilename, string inp_path="");
void setInputBasePath(string inp_path);
// create the object reading filenames and other parameters from the datacard file
size_t ReadDatacardFile(string dcfilename);
ostream & Print(ostream & os) const;
......
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