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

Suite (peut-etre fin) de la prise en charge de la lecture des voies...

Suite (peut-etre fin) de la prise en charge de la lecture des voies thermometre et RFI (gestion automatique du nombre de calculateurs de visibilites), Reza 21/07/2018
parent 1dc88577
......@@ -29,32 +29,31 @@ VisiP4ReaderBase * VisiP4ReaderBase::getReader(vector<string> const& vpath, bool
cout << "... file vmtxdbdesc.txt exist -> VisiP4ReaderDB object"<<endl;
}
int nbvisgrp=0;
if (fgrdtherm) {
cout << "... Reading Thermometer/RFI signals visibilities -> NbVisGrp=1"<<endl;
bool fgok = true;
sprintf(filenamebuff,"%s/chanum.ppf",vpath[0].c_str());
if ((fid=open(filenamebuff,O_RDONLY))>=0) {
close(fid);
nbvisgrp=1;
fgok=false;
}
else {
bool fgok = true;
while (fgok) {
sprintf(filenamebuff,"%s/chanum_%d.ppf",vpath[0].c_str(),nbvisgrp);
if ((fid=open(filenamebuff,O_RDONLY))>=0) {
close(fid);
nbvisgrp++;
}
else fgok = false;
while (fgok) {
sprintf(filenamebuff,"%s/chanum_%d.ppf",vpath[0].c_str(),nbvisgrp);
if ((fid=open(filenamebuff,O_RDONLY))>=0) {
close(fid);
nbvisgrp++;
}
cout << "... NbVisGrp determined from chanum_JJ.ppf file -> NbVisGrp="<<nbvisgrp<<endl;
else fgok = false;
}
cout << "... NbVisGrp determined from chanum_JJ.ppf file -> NbVisGrp="<<nbvisgrp<<endl;
VisiP4ReaderBase * reader=NULL;
if (fgdb) reader = new VisiP4ReaderDB(vpath, fgrdtherm);
else reader = new VisiP4ReaderNoDB(vpath,0,0,1,false);
reader->setNbVisGrp(nbvisgrp);
if (fgdb) reader = new VisiP4ReaderDB(vpath, fgrdtherm, nbvisgrp);
else reader = new VisiP4ReaderNoDB(vpath,0,0,1,false, fgrdtherm, nbvisgrp);
return reader;
}
/* --Methode-- */
VisiP4ReaderBase::VisiP4ReaderBase(vector<string> const& vpath, bool fgrdtherm)
VisiP4ReaderBase::VisiP4ReaderBase(vector<string> const& vpath, bool fgrdtherm, int nvisgrp)
: paths_(vpath), fgreorderfreq_(false),
cur_serialnum_(0), fgrdtherm_(fgrdtherm)
{
......@@ -73,13 +72,14 @@ VisiP4ReaderBase::VisiP4ReaderBase(vector<string> const& vpath, bool fgrdtherm)
setNBands(paths_.size());
setNbVisGrp();
}
if (nvisgrp > 0) setNbVisGrp(nvisgrp);
setPrintLevel();
chanpairs.ReSize(NVIS,2);
char filenamebuff[2048];
cout << "VisiP4ReaderBase channel pair list:"<<endl;
int r=0;
for(int g=0; g<NVISGRP; g++) {
if (fgrdtherm) sprintf(filenamebuff,"%s/chanum.ppf",paths_[0].c_str());
if (NVISGRP==1) sprintf(filenamebuff,"%s/chanum.ppf",paths_[0].c_str());
else sprintf(filenamebuff,"%s/chanum_%d.ppf",paths_[0].c_str(), g);
{
TMatrix<int_4> chanpg;
......@@ -303,8 +303,9 @@ TMatrix< complex<r_4> > VisiP4ReaderBase::SubtractOffset(TMatrix< complex<r_4>
}
/* --Methode-- */
VisiP4ReaderNoDB::VisiP4ReaderNoDB(vector<string> const& vpath, int first, int last, int step, bool reorderfreq)
: VisiP4ReaderBase(vpath)
VisiP4ReaderNoDB::VisiP4ReaderNoDB(vector<string> const& vpath, int first, int last, int step, bool reorderfreq,
bool fgrdtherm, int nvisgrp)
: VisiP4ReaderBase(vpath, fgrdtherm, nvisgrp)
{
setFreqReordering(reorderfreq);
SelectSerialNum(first, last, step);
......@@ -337,16 +338,16 @@ void VisiP4ReaderNoDB::ReadVisMtx(int band, int visgrp, long sernum, TMatrix< co
}
/* --Methode-- */
VisiP4ReaderDB::VisiP4ReaderDB(vector<string> const& vpath, bool fgrdtherm)
: VisiP4ReaderBase(vpath, fgrdtherm)
VisiP4ReaderDB::VisiP4ReaderDB(vector<string> const& vpath, bool fgrdtherm, int nvisgrp)
: VisiP4ReaderBase(vpath, fgrdtherm, nvisgrp)
{
Init();
SelectSerialNum(0,0,1);
}
/* --Methode-- */
VisiP4ReaderDB::VisiP4ReaderDB(vector<string> const& vpath, int first, int last, int step, bool reorderfreq)
: VisiP4ReaderBase(vpath)
VisiP4ReaderDB::VisiP4ReaderDB(vector<string> const& vpath, int first, int last, int step, bool reorderfreq, bool fgrdtherm, int nvisgrp)
: VisiP4ReaderBase(vpath, fgrdtherm, nvisgrp)
{
Init();
setFreqReordering(reorderfreq);
......
......@@ -32,7 +32,7 @@ public:
if fgrdtherm == true , this is a thermometer/RFI visibility signal path, don't open chanum_j.ppf file */
static VisiP4ReaderBase * getReader(vector<string> const& vpath, bool fgrdtherm=false);
VisiP4ReaderBase(vector<string> const& vpath, bool fgrdtherm=false);
VisiP4ReaderBase(vector<string> const& vpath, bool fgrdtherm=false, int nvisgrp=0);
virtual ~VisiP4ReaderBase();
/*! \brief Select range of Serial Number for Visibility Matrices to be processed
......@@ -178,8 +178,8 @@ protected:
with a single visibility matrix per file */
class VisiP4ReaderNoDB : public VisiP4ReaderBase {
public:
VisiP4ReaderNoDB(vector<string> const& vpath, int first, int last, int step=1, bool reorderfreq=false);
VisiP4ReaderNoDB(vector<string> const& vpath, int first, int last, int step=1, bool reorderfreq=false,
bool fgrdtherm=false, int nvisgrp=0);
protected:
virtual void ReadVisMtx(int band, int visgrp, long sernum, TMatrix< complex<r_4> > & vmtx, TMatrix< complex<r_4> > * mmtx,
TMatrix< complex<r_4> > * fxmtx);
......@@ -194,8 +194,9 @@ protected:
class VisiP4ReaderDB : public VisiP4ReaderBase {
public:
VisiP4ReaderDB(vector<string> const& vpath, bool fgrdtherm=false);
VisiP4ReaderDB(vector<string> const& vpath, int first, int last, int step=1, bool reorderfreq=false);
VisiP4ReaderDB(vector<string> const& vpath, bool fgrdtherm=false, int nvisgrp=0);
VisiP4ReaderDB(vector<string> const& vpath, int first, int last, int step=1, bool reorderfreq=false,
bool fgrdtherm=false, int nvisgrp=0);
virtual ~VisiP4ReaderDB();
virtual void SelectSerialNum(long first, long last, long step=1);
......
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