Commit 6a5ca06a authored by Réza Ansari's avatar Réza Ansari
Browse files

1/ Decodage des options -inall -inseltm ds la classe P4AnaParams ce qui permet de soit

  selectionner toutes les matrices de visi a lire (-inall) soit de slecetionner les
  matrices dans un intervalle en temps (-inseltm)
  toutes les matrices a lire ou ds P4AnaParams
2/ adaptation de rdvisip4.cc et visi2dtacx.cc pour l'utilisation des parametres definis
  et decodes ci-dessus (ds P4AnaParams).
                          Reza 19/9/2017
parent 62a7fcbb
......@@ -167,6 +167,7 @@ std::vector<sa_size_t> P4AVisiNumEncoder::getAllVCrossCor()
//---------------------------------------------------------------------
P4AnaParams::P4AnaParams()
: inpath5_("bao5/"), inpath6_("bao6/"), Imin_(0), Imax_(10), Istep_(1),
fgserall_(false), fgtmsel_(false),
fgreorderfreq_(false), gain_gnu_file_("gain.ppf"),
outfile_("p4a.ppf"), Nmean_(10), prtlev_(0), prtmodulo_(1),
fgTFM_(false), TFMtimebin_(30), TFMfreqbin_(4), fgdtable_(false)
......@@ -176,6 +177,7 @@ P4AnaParams::P4AnaParams()
P4AnaParams::P4AnaParams(P4AnaParams const & a)
: inpath5_(a.inpath5_), inpath6_(a.inpath6_), Imin_(a.Imin_), Imax_(a.Imax_), Istep_(a.Istep_),
fgserall_(a.fgserall_), fgtmsel_(a. fgtmsel_),
fgreorderfreq_(a.fgreorderfreq_), gain_gnu_file_(a.gain_gnu_file_),
outfile_(a.outfile_), Nmean_(a.Nmean_), prtlev_(a.prtlev_), prtmodulo_(a.prtmodulo_),
fgTFM_(a.fgTFM_), TFMtimebin_(a.TFMtimebin_), TFMfreqbin_(a.TFMfreqbin_),
......@@ -187,6 +189,7 @@ P4AnaParams& P4AnaParams::operator = (P4AnaParams const & a)
{
inpath5_=a.inpath5_; inpath6_=a.inpath6_;
Imin_=a.Imin_; Imax_=a.Imax_; Istep_=a.Istep_;
fgserall_=a.fgserall_; fgtmsel_=a. fgtmsel_;
fgreorderfreq_=a.fgreorderfreq_; gain_gnu_file_=a.gain_gnu_file_;
outfile_=a.outfile_; Nmean_=a.Nmean_; prtlev_=a.prtlev_; prtmodulo_=a.prtmodulo_;
fgTFM_=a.fgTFM_; TFMfreqbin_=a.TFMfreqbin_; TFMtimebin_=a.TFMtimebin_;
......@@ -201,8 +204,17 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
string fbo = arg[1];
if (fbo=="-inrange") { // specification numeros de fichiers de visi a traiter
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
sscanf(arg[2],"%d,%d,%d",&Imin_,&Imax_,&Istep_); arg+=2; narg-=2; lastargs_.clear();
sscanf(arg[2],"%d,%d,%d",&Imin_,&Imax_,&Istep_); fgserall_=fgtmsel_=false; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-inall") {
fgserall_=true; fgtmsel_=false; arg++; narg--; lastargs_.clear();
}
else if (fbo=="-inseltm") {
if (narg<3) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
tmsel_tu_=TimeStamp(arg[2]); tmsel_duration_=atof(arg[3]); fgserall_=false; fgtmsel_=true;
arg+=3; narg-=3; lastargs_.clear();
}
else if (fbo=="-in5") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
inpath5_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
......@@ -251,12 +263,16 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
int P4AnaParams::UsageOptions()
{
cout<< " P4AnaParams::UsageOptions(): -inrange -in5 -in6 -gnu -o -nmean -tfm -freq -prt \n"
<< " [-inrange Imin,Imax[,Istep] ] [-in5 InputPath_BAO5] [-in6 InputPath_BAO6] \n"
cout<< " P4AnaParams::UsageOptions(): -in5 -in6 -inrange -inall -inseltm -gnu -o -nmean -tfm -freq -prt \n"
<< " [-in5 InputPath_BAO5] [-in6 InputPath_BAO6] \n"
<< " [-inrange Imin,Imax[,Istep] ] [-inall] [-inseltm YYYY-MM-DDThh:mm:ss duration_minutes] \n"
<< " [-o outfilename] [-gnu gain_filename] [-nmean N] [-reorderfreq] \n"
<< " [-tfm timebin,freqbin] [-freq f0,df] [-prt level] \n"
<< " -inrange Imin,Imax[,Istep] define range of visibilite matrices to be processed (Imin<=I<=Imax with step Istep) \n"
<< " -in5/6 InputPath_BAO5/6 : input file path for BAO5 and BAO6 \n"
<< " -inrange Imin,Imax[,Istep] : define range of visibilite matrices to be processed (Imin<=I<=Imax with step Istep) \n"
<< " -inall : try to process all visibility matrices present in data directory \n"
<< " -inseltm date_timeTU duration : define set of visibility matrices to be processed as time interval \n"
<< " centered at date_timeTU (YYYY-MM-DDThh:mm:ss) and duration in minutes \n"
<< " -o outfilename : specify output file name \n"
<< " -gnu gain_filename: gain g(nu) file name \n"
<< " -nmean N: compute average (and sigma...) using N visibility matrices \n"
......@@ -271,8 +287,17 @@ int P4AnaParams::UsageOptions()
ostream& P4AnaParams::Print(ostream& os) const
{
os<<" In5 path="<<inpath5_<<" In6 path="<<inpath6_<< "Range:"<<Imin_<<"<=I<="<<Imax_<<" (step="<<Istep_<<")"<<endl;
os<<" In5 path="<<inpath5_<<" In6 path="<<inpath6_ << endl;
if (!fgserall_ && !fgtmsel_)
os << " Input VisibMtx seq. number in Range: "<<Imin_<<"<=I<="<<Imax_<<" (step="<<Istep_<<")"<<endl;
if (fgreorderfreq_) os<<" (frequency reordering for FFT firmware) ";
else if (fgserall_)
os << " Process ALL visibilty matrices ... " << endl;
else {
TimeStamp tustart = tmsel_tu_; tustart.ShiftSeconds(-tmsel_duration_*30.);
TimeStamp tuend = tmsel_tu_; tuend.ShiftSeconds(tmsel_duration_*30.);
os << " Process VisibMtx within time interval: TUStart=" << tustart.ToString() << " TUEnd="<<tuend.ToString()<<endl;
}
os<<" Gain, g(nu) file:"<<gain_gnu_file_<<" OutFile="<<outfile_<<endl;
os<<" Nmean="<<Nmean_<<" TFM: TimeBin="<<TFMtimebin_<<" FreqBin="<<TFMfreqbin_<<endl;
if (fbands_.size()==0) os<<" No frequency band defined ..."<<endl;
......
......@@ -19,6 +19,7 @@
#include "machdefs.h"
#include "sopnamsp.h"
#include "pexceptions.h"
#include "timestamp.h"
//---------------------------------------------------------------------------------
//---- Classe definition de bande de frequence, frequence centrale et largeur
......@@ -140,7 +141,12 @@ public:
//--- definition des fichiers de visibilite en entree
string inpath5_, inpath6_;
int Imin_,Imax_,Istep_;
//---- Selection de la serie des matrices de visibilites a traiter
int Imin_,Imax_,Istep_; // Definition de la sequence Imin <= I <= Imax I += Istep
bool fgserall_; // if true, read all the visi matrices
TimeStamp tmsel_tu_; // selection defini par tmsel_tu_ +/- tmsel_duration_/2
double tmsel_duration_;
bool fgtmsel_; // if true, selection defined as tmsel_tu_ +/- tmsel_duration_/2
bool fgreorderfreq_;
//--- nom de fichier de gain
string gain_gnu_file_;
......
......@@ -67,12 +67,13 @@ int main(int narg, const char* arg[])
bool fgrdmean = false;
if( (params.lastargs_.size()>0) &&(params.lastargs_[0]==string("-m")) ) fgrdmean = true;
params.Print(cout);
cout<<"rdvisip4/Info: Path BAO5:"<<path5<<" BAO6:"<<path6<<"\n"
<<"fgreorderfreq="<<params.fgreorderfreq_<<"\n"
<<"Imin,max,step="<<Imin<<","<<Imax<<","<<Istep<<"\n"
<<"PrtLev="<<prtlev<<" OutFile:"<<outfile<<endl;
if(fgrdmean) cout<<"Trying to read also the FFT mean coef matrix"<<endl;
P4AVisiNumEncoder vencod;
cout << vencod;
// ---
......@@ -90,7 +91,21 @@ int main(int narg, const char* arg[])
VisiP4ReaderBase * reader = VisiP4ReaderBase::getReader(paths);
VisiP4ReaderBase & vreader = (*reader);
vreader.setFreqReordering(fgreorderfreq);
vreader.SelectSerialNum(Imin,Imax,Istep);
if (!params.fgserall_ && !params.fgtmsel_) {
cout << " vreader.SelectSerialNum(Imin="<<Imin<<" ,Imax="<<Imax<<" ,Istep="<<Istep<<")"<<endl;
vreader.SelectSerialNum(Imin,Imax,Istep);
}
else if (params.fgserall_) {
cout << " vreader.SelectAll() ... " << endl;
vreader.SelectAll();
}
else {
TimeStamp tustart = params.tmsel_tu_; tustart.ShiftSeconds(-params.tmsel_duration_*30.);
TimeStamp tuend = params.tmsel_tu_; tuend.ShiftSeconds(params.tmsel_duration_*30.);
cout << " vreader.SelectTimeFrame(TUStart="<<tustart.ToString()<<" ,TUEnd="<<tuend.ToString()
<<" ,Istep="<<Istep<<")"<<endl;
vreader.SelectTimeFrame(tustart, tuend, Istep);
}
vreader.setPrintLevel(prtlev);
bool fgok=true;
//vismtx: visib matrice, meanmtx: mean FFT coef, vismtx_center: visib matrix corrigee de l'offset (normalisee avec NPAQSUM)
......
......@@ -67,6 +67,7 @@ int main(int narg, const char* arg[])
int Imin = params.Imin_, Imax = params.Imax_, Istep = params.Istep_;
int prtlev = params.prtlev_;
params.Print(cout);
cout <<"visi2dtacx/Info: Path BAO5:"<<params.inpath5_<<" BAO6:"<<params.inpath6_<<"\n"
<<"fgreorderfreq="<<params.fgreorderfreq_<<"\n"
<<"Imin,max,step="<<Imin<<","<<Imax<<","<<Istep<<" DeltaIAvg="<<deltaIavg<<"\n"
......@@ -160,7 +161,21 @@ int main(int narg, const char* arg[])
VisiP4ReaderBase * reader = VisiP4ReaderBase::getReader(paths);
VisiP4ReaderBase & vreader = (*reader);
vreader.setFreqReordering(params.fgreorderfreq_);
vreader.SelectSerialNum(Imin,Imax,Istep);
if (!params.fgserall_ && !params.fgtmsel_) {
cout << " vreader.SelectSerialNum(Imin="<<Imin<<" ,Imax="<<Imax<<" ,Istep="<<Istep<<")"<<endl;
vreader.SelectSerialNum(Imin,Imax,Istep);
}
else if (params.fgserall_) {
cout << " vreader.SelectAll() ... " << endl;
vreader.SelectAll();
}
else {
TimeStamp tustart = params.tmsel_tu_; tustart.ShiftSeconds(-params.tmsel_duration_*30.);
TimeStamp tuend = params.tmsel_tu_; tuend.ShiftSeconds(params.tmsel_duration_*30.);
cout << " vreader.SelectTimeFrame(TUStart="<<tustart.ToString()<<" ,TUEnd="<<tuend.ToString()
<<" ,Istep="<<Istep<<")"<<endl;
vreader.SelectTimeFrame(tustart, tuend, Istep);
}
vreader.setPrintLevel(prtlev);
bool fgok=true;
TMatrix< complex<r_4> > vismtx;
......
......@@ -141,6 +141,7 @@ int main(int narg, char* arg[])
VisiP4ReaderBase * reader = VisiP4ReaderBase::getReader(paths);
VisiP4ReaderBase & vreader = (*reader);
vreader.setFreqReordering(fgreorderfreq);
cout << " vreader.SelectSerialNum(Imin="<<Imin<<" ,Imax="<<Imax<<" ,Istep="<<Istep<<")"<<endl;
vreader.SelectSerialNum(Imin,Imax,Istep);
vreader.setPrintLevel(prtlev);
......
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