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

Gestion/decodage des nouveaux arguments et datacards -killfreq -nohh , Reza 19/08/2018

parent 7f7823ff
......@@ -33,12 +33,18 @@ norm g1H g2H g3H g4H g1V g2V g3V g4V
#### PrintLevel
# @prtlev PrintLevel PrintModulo
@prtlev 1 20
#### Definition de bandes de frequence, une carte par bande
######## Gestion des bandes de frequences
#### Definition de bandes de frequence, pour les cartes par bande OU pour les datatables
## @freqband CentralFreqMHz BandWidthMHz
@freqband 1390. 1
@freqband 1420.4 0.25
### Select VV and/or HV cross correlation processing
#### Definition de bandes de frequences a masquer / a tuer (Utilise en particulier par P4FreqSelectorFilterMgr)
## @killfreqband CentralFreqMHz BandWidthMHz
@killfreqband 1375. 1.
### Pour desactiver le traitement des cross correlations HH
@nohh
### Pour activer le traitement des cross correlations VV et/ou HV
@dovv
@dohv
### Require computation of dispersion (sigma) TFM maps, in addition to mean (average) TFM maps
### Pour demander le calcul de la dispersion (sigma) des cartes TFM maps, en plus de la moyenne
@dosigma
......@@ -215,7 +215,7 @@ P4AnaParams::P4AnaParams()
outfile_("p4a.ppf"), fitsoutfile_(""), prtlev_(0), prtmodulo_(1),
Nmean_(10), fgTFM_(false), TFMtimebin_(30), TFMfreqbin_(4), fgdtable_(false),
fgRA_(false), RAcenter_(12.), RAwidth_(24.), RAresol_mn_(1.),
doVV_(false), doHV_(false), doSigma_(false)
doHH_(true), doVV_(false), doHV_(false), doSigma_(false)
{
}
......@@ -225,12 +225,12 @@ P4AnaParams::P4AnaParams(P4AnaParams const & a)
fgserall_(a.fgserall_), fgtmsel_(a.fgtmsel_), inwsz_(a.inwsz_), fgreorderfreq_(a.fgreorderfreq_),
gain_gnu_file_(a.gain_gnu_file_),
gain_var_file_(a.gain_var_file_), gain_blind_filt_file_(a.gain_blind_filt_file_),
phase_corr_param_file_(a.phase_corr_param_file_), normalisation_(a.normalisation_),
phase_corr_param_file_(a.phase_corr_param_file_), normalisation_(a.normalisation_),
outfile_(a.outfile_), fitsoutfile_(a.fitsoutfile_), prtlev_(a.prtlev_), prtmodulo_(a.prtmodulo_),
Nmean_(a.Nmean_), fgTFM_(a.fgTFM_), TFMtimebin_(a.TFMtimebin_), TFMfreqbin_(a.TFMfreqbin_),
fgdtable_(a.fgdtable_), fbands_(a.fbands_),
fgdtable_(a.fgdtable_), fbands_(a.fbands_), kill_fbands_(a.kill_fbands_),
fgRA_(a.fgRA_), RAcenter_(a.RAcenter_), RAwidth_(a.RAwidth_), RAresol_mn_(a.RAresol_mn_),
doVV_(a.doVV_), doHV_(a.doHV_), doSigma_(a.doSigma_),
doHH_(a.doHH_), doVV_(a.doVV_), doHV_(a.doHV_), doSigma_(a.doSigma_),
lastargs_(a.lastargs_)
{
}
......@@ -247,9 +247,9 @@ P4AnaParams& P4AnaParams::operator = (P4AnaParams const & a)
outfile_=a.outfile_; fitsoutfile_=a.fitsoutfile_;
prtlev_=a.prtlev_; prtmodulo_=a.prtmodulo_;
Nmean_=a.Nmean_; fgTFM_=a.fgTFM_; TFMfreqbin_=a.TFMfreqbin_; TFMtimebin_=a.TFMtimebin_;
fgdtable_=a.fgdtable_; fbands_=a.fbands_;
fgdtable_=a.fgdtable_; fbands_=a.fbands_; kill_fbands_=a.kill_fbands_;
fgRA_=a.fgRA_; RAcenter_=a.RAcenter_; RAwidth_=a.RAwidth_; RAresol_mn_=a.RAresol_mn_;
doVV_=a.doVV_; doHV_=a.doHV_; doSigma_=a.doSigma_;
doHH_=a.doHH_; doVV_=a.doVV_; doHV_=a.doHV_; doSigma_=a.doSigma_;
lastargs_=a.lastargs_;
return *this;
}
......@@ -295,6 +295,9 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
else if (fbo=="-reorderfreq") {
fgreorderfreq_=true; arg++; narg--; lastargs_.clear();
}
else if (fbo=="-nohh") {
doHH_=false; arg++; narg--; lastargs_.clear();
}
else if (fbo=="-dovv") {
doVV_=true; arg++; narg--; lastargs_.clear();
}
......@@ -357,6 +360,12 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
sscanf(arg[2],"%lg,%lg",&f0,&df); fbands_.push_back(P4FreqBand(f0,df)); fgdtable_=true;
arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-killfreq") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
double f0,df;
sscanf(arg[2],"%lg,%lg",&f0,&df); kill_fbands_.push_back(P4FreqBand(f0,df));
arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-ra") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
int ja,jb;
......@@ -376,6 +385,7 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
// --- variables and functions to decode @freqbands card in datacard file
static vector<P4FreqBand> dc_fbands_;
static vector<P4FreqBand> dc_kill_fbands_;
static int dc_decode_freqband(string const& key, string const& toks)
{
if (key != "freqband") { // CA NE DEVRAIT PAS ARRIVER
......@@ -383,7 +393,15 @@ static int dc_decode_freqband(string const& key, string const& toks)
return 1;
}
double f0=1390.,df=1.;
sscanf(toks.c_str(),"%lg %lg",&f0,&df); dc_fbands_.push_back(P4FreqBand(f0,df));
sscanf(toks.c_str(),"%lg %lg",&f0,&df);
if (key == "freqband")
dc_fbands_.push_back(P4FreqBand(f0,df));
else if (key == "killfreqband")
dc_kill_fbands_.push_back(P4FreqBand(f0,df));
else { // CA NE DEVRAIT PAS ARRIVER
cout << "dc_decode_freqband()/ERROR BAD key = " << key << " ( <> freqband or killfreqband"<<endl;
return 1;
}
return 0;
}
......@@ -392,7 +410,10 @@ int P4AnaParams::ReadDatacardFile(const char * dcfilename)
DataCards dc;
string match="freqband";
dc.AddProcF(dc_decode_freqband, match);
match="killfreqband";
dc.AddProcF(dc_decode_freqband, match);
dc_fbands_.clear();
dc_kill_fbands_.clear();
dc.ReadFile(dcfilename);
int cnt = 0; // number of decoded cards
if (dc.HasKey("in5")) { // @in5 PathBao5
......@@ -477,6 +498,9 @@ int P4AnaParams::ReadDatacardFile(const char * dcfilename)
prtlev_=dc.IParam("prtlev",0,1); prtmodulo_=dc.IParam("prtlev",1,1);
cnt++;
}
if (dc.HasKey("nohh")) { //@nohh : DONT process HH cross-correlations
doHH_=true; cnt++;
}
if (dc.HasKey("dovv")) { //@dovv : process also VV cross-correlations
doVV_=true; cnt++;
}
......@@ -487,22 +511,26 @@ int P4AnaParams::ReadDatacardFile(const char * dcfilename)
doSigma_=true; cnt++;
}
for (size_t i=0; i<dc_fbands_.size(); i++) fbands_.push_back(dc_fbands_[i]);
for (size_t i=0; i<dc_kill_fbands_.size(); i++) kill_fbands_.push_back(dc_kill_fbands_[i]);
cout << " P4AnaParams::ReadDatacardFile(FileName=" << dcfilename << " ) -> decoded " << cnt+dc_fbands_.size()<<" cards"<<endl;
dc_fbands_.clear();
return cnt+(int)dc_fbands_.size();
dc_fbands_.clear(); dc_kill_fbands_.clear();
return cnt+(int)(dc_fbands_.size()+dc_kill_fbands_.size());
}
int P4AnaParams::UsageOptions()
int P4AnaParams::UsageOptions(bool fglong)
{
cout<< " P4AnaParams::UsageOptions(): decode datacard and/or command line options \n"
<< " [-dcf DataCardFileName ] [-in5 InputPath_BAO5] [-in6 InputPath_BAO6] [-inth InputPath_ThermeometerRFI] \n"
<< " [-inrange Imin,Imax[,Istep] ] [-inall] [-inseltm YYYY-MM-DDThh:mm:ss duration_minutes] \n"
<< " [-gnu gain_filename] [-vgf filename] [-bff filename] [-phcor filename] [-norm fac1H,fac2H...,fac4V] \n"
<< " [-o outfilename] [-fo fits_filename] [-nmean N] [-reorderfreq] \n"
<< " [-tfm timebin,freqbin] [-ra RAcenterHours,RAwidthHours,RAresolMinutes] [-freq f0,df] \n"
<< " [-dovv] [-dohv] [-dosigma] [-prt level] \n"
<< " [-tfm timebin,freqbin] [-ra RAcenterHours,RAwidthHours,RAresolMinutes] \n"
<< " [-freq f0,df] [-killfreq f0,df] \n"
<< " [-nohh] [-dovv] [-dohv] [-dosigma] [-prt level] \n"<<endl;
if (!fglong) return 0;
<< " -dcf DatacardFileName : read and decode parameters from datacard file \n"
cout<< " -dcf DatacardFileName : read and decode parameters from datacard file \n"
<< " -in5/6 InputPath_BAO5/6 : input file path for BAO5 and BAO6 \n"
<< " -inth InputPath_ThermeometerRFI : Use this option to specify path for thermeometer/RFI signal files\n"
<< " -inrange Imin,Imax[,Istep] : define range of visibilite matrices to be processed (Imin<=I<=Imax with step Istep) \n"
......@@ -520,9 +548,12 @@ int P4AnaParams::UsageOptions()
<< " -nmean N: compute average (and sigma...) using N visibility matrices \n"
<< " -reorderfreq: activate frequency reordering in VisiP4Reader, suitable for FFT firmware \n"
<< " -tfm timebin,freqbin : time-frequency maps, averaging timebin=nb of visi matrices, freqbin frequency components \n"
<< " -ra RAcenterHours,RAwidthHours,RAresolMinutes: define RA (right ascension) map center,total width (hours), resolution (minutes) \n"
<< " -ra RAcenterHours,RAwidthHours,RAresolMinutes: define RA (right ascension) map parameters \n"
<<" map center in hours (0<=ra<24), total width (in hours, <24), map resolution (in time-minutes) \n"
<< " -freq f0,df : definition of a frequency band centered on f0, with total width df (in MHz) \n"
<< " several frequency bands can be specified by mutiple -freq options \n"
<< " -killfreq f0,df : mask/kill the frequency band centered on f0, with total width df (in MHz) \n"
<< " several frequency bands can be specified by mutiple -freq OR -killfreq options \n"
<< " -nohh : DONT process HH cross correlations \n"
<< " -dovv : processing also VV cross correlations \n"
<< " -dohv : processing also HV cross correlations \n"
<< " -dosigma : compute also TFM maps of dispersion (sigma) \n"
......@@ -568,6 +599,11 @@ ostream& P4AnaParams::Print(ostream& os) const
<<"("<<RAcenter_-RAwidth_/2<<"<ra<"<<RAcenter_-RAwidth_/2<<")"<<endl;
if (fbands_.size()==0) os<<" No frequency band defined ..."<<endl;
else for(size_t i=0; i<fbands_.size(); i++) os<<"FreqBand["<<i<<"]: "<<fbands_[i]<<endl;
if (kill_fbands_.size()==0) {
os<<" Frequency bands to mask/kill defined :"<<endl;
for(size_t i=0; i<fbands_.size(); i++) os<<"KillFreqBand["<<i<<"]: "<<fbands_[i]<<endl;
}
if (doHH_) cout << "* Processing HH cross correlations demanded "<<endl;
if (doVV_) cout << "* Processing VV cross correlations demanded "<<endl;
if (doHV_) cout << "* Processing HV cross correlations demanded "<<endl;
if (doSigma_) cout << "* Computing also dispersion (Sigma) TFM maps, in addition to mean (average) "<<endl;
......
......@@ -164,7 +164,7 @@ public:
inline int ReadDatacardFile(std::string const & dcfilename)
{ return ReadDatacardFile(dcfilename.c_str()); }
//! prints command line parameters and options on stdout (cout)
static int UsageOptions();
static int UsageOptions(bool fglong=true);
//! print parameters on stdout (cout)
ostream& Print(ostream& os) const;
......@@ -209,15 +209,20 @@ public:
bool fgTFM_;
sa_size_t TFMtimebin_;
sa_size_t TFMfreqbin_;
// definition des bandes de frequences pour les DataTables
// definition des bandes de frequences pour les DataTables OU pour P4FreqSelectorFilterMgr
bool fgdtable_;
vector<P4FreqBand> fbands_;
vector<P4FreqBand> fbands_; // Bandes de frequences selectionnees
vector<P4FreqBand> kill_fbands_; // Bandes de frequences a masquer / a tuer
// Definition de la carte en ra (Right Ascension) - heures decimales, sauf pour la resolution, en minutes
bool fgRA_; // True , on a defini les limites de la carte en RA
double RAcenter_, RAwidth_, RAresol_mn_;
// les arguments en fin de ligne de commande
vector<string> lastargs_;
//------ flags controlling which correlation set we are computing (visiavg vis2ra visamm)
//-- default doHH_=true doVV_=doHV_=doSigma_=false
bool doHH_; // true : computes HxH cross correlations tf maps (visiavg)
bool doVV_; // true : also computes VxV cross correlations tf maps (visiavg)
bool doHV_; // true : also computes HxV cross correlations tf maps (visiavg)
bool doSigma_; // true : computes also dispersion (sigma) tf maps , in addition to mean (visiavg)
......
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