Commit 62a7fcbb authored by Réza Ansari's avatar Réza Ansari
Browse files

programmes visi2dtacx.cc visi2ntac.cc adaptes pour utiliser la classe...

 programmes visi2dtacx.cc visi2ntac.cc adaptes pour utiliser la classe P4gnuGain et VisiP4ReaderBase::getReader(), Reza 18/9/2017
parent 322f8157
......@@ -39,6 +39,7 @@
// include lecteur de fichiers visibilites
#include "p4autils.h"
#include "visip4reader.h"
#include "p4gnugain.h"
int Usage(void);
int Usage(void)
......@@ -112,22 +113,10 @@ int main(int narg, const char* arg[])
sa_size_t KVAC[8]={0,8,15,21,26,30,33,35};
// Numero des lignes des cross-correlations 1H-2H 1H-3H 1H-4H 2H-3H 2H-4H 3H-4H dans la matrice des visibilites
sa_size_t KVCXHH[6]={1,2,3,9,10,16};
P4gnuGain p4g(params.gain_gnu_file_);
Matrix const & gains = p4g.getGainMatrix();
cout<<"visi2dtacx/Info: reading input gain file: \""<<params.gain_gnu_file_<<"\" ...\n";
Matrix gains;
Vector gn;
double GAINTHR = 0.005; // limite inferieur du gain avant faire 1/G
{
PInPersist pin(params.gain_gnu_file_);
pin>>PPFNameTag("gains")>>gains;
pin>>PPFNameTag("gn")>>gn;
for (int p=0; p<8; p++) cout<<"gn["<<p<<"]="<<gn(p)<<" ";
// on transforme gains en facteur multiplicatif
for(sa_size_t r=0;r<gains.NRows();r++) {
for(sa_size_t c=0; c<gains.NCols(); c++) gains(r,c)=((gains(r,c)>GAINTHR)?1./gains(r,c):0.);
}
cout<<endl;
}
// Gains pour les cross-correlations g_ij(nu) = sqrt(g_ii(nu) 8 g_jj(nu) )
Matrix gaincx(6, gains.NCols());
for(sa_size_t c=0; c<gains.NCols(); c++) {
......@@ -166,7 +155,12 @@ int main(int narg, const char* arg[])
vector<string> paths;
paths.push_back(params.inpath5_);
paths.push_back(params.inpath6_);
VisiP4Reader vreader(paths, Imin,Imax,Istep,params.fgreorderfreq_);
VisiP4ReaderBase * reader = VisiP4ReaderBase::getReader(paths);
VisiP4ReaderBase & vreader = (*reader);
vreader.setFreqReordering(params.fgreorderfreq_);
vreader.SelectSerialNum(Imin,Imax,Istep);
vreader.setPrintLevel(prtlev);
bool fgok=true;
TMatrix< complex<r_4> > vismtx;
......
......@@ -38,6 +38,8 @@
// include lecteur de fichiers visibilites
#include "visip4reader.h"
#include "p4autils.h"
#include "p4gnugain.h"
//--------------------------- Fonctions de ce fichier -------------------
int Usage(bool fgshort=true);
......@@ -69,49 +71,42 @@ int Usage(bool fgea)
int main(int narg, char* arg[])
{
if ((narg>1)&&(strcmp(arg[1],"-h")==0)) return Usage(false);
if (narg<9) return Usage(true);
string path5 = arg[1];
string path6 = arg[2];
int aoff = 0;
bool fgreorderfreq=false;
if ((narg>1)&&(strcmp(arg[1],"-reorderfreq")==0)) {
fgreorderfreq=true;
aoff = 1;
}
if (narg<9+aoff) return Usage(true);
string path5 = arg[1+aoff];
string path6 = arg[2+aoff];
int Imin,Imax,Istep=1;
sscanf(arg[3],"%d,%d",&Imin,&Imax);
sscanf(arg[3+aoff],"%d,%d",&Imin,&Imax);
Istep=1;
string gainfile=arg[4];
string outfile=arg[5];
string gainfile=arg[4+aoff];
string outfile=arg[5+aoff];
// frequency range definition
sa_size_t JFmin=1300,JFmax=1460;
int jf1,jf2;
if ((narg>6)&&(strcmp(arg[6],"-")!=0)) sscanf(arg[6],"%d,%d",&jf1,&jf2);
if ((narg>6)&&(strcmp(arg[6+aoff],"-")!=0)) sscanf(arg[6+aoff],"%d,%d",&jf1,&jf2);
JFmin=jf1; JFmax=jf2;
sa_size_t JFminB=2130,JFmaxB=2290;
if ((narg>7)&&(strcmp(arg[7],"-")!=0)) sscanf(arg[7],"%d,%d",&jf1,&jf2);
if ((narg>7)&&(strcmp(arg[7+aoff],"-")!=0)) sscanf(arg[7+aoff],"%d,%d",&jf1,&jf2);
JFminB=jf1; JFmaxB=jf2;
// time averaging interval definition, in term of visibility files
int deltaIavg=10;
if (narg>8) deltaIavg=atoi(arg[8]);
if (narg>8) deltaIavg=atoi(arg[8+aoff]);
if (deltaIavg<1) deltaIavg=1;
int prtlev=1;
if (narg>9) prtlev=atoi(arg[9]);
if (narg>9) prtlev=atoi(arg[9+aoff]);
cout << " visi2ntac/Info: Path BAO5:"<<path5<<" BAO6:"<<path6<<"\n"
<< " Imin,max,step="<<Imin<<","<<Imax<<","<<Istep<<" OutFile:"<<outfile<<"\n"
<< JFmin<<" <=NumFreq<= "<<JFmax<<" "<<JFminB<<" <=NumFreqB<= "<<JFmaxB
<<" DeltaIAvg="<<deltaIavg<<" PrtLev="<<prtlev<<endl;
cout << " visi2ntac/Info: reading input gain file"<<gainfile<<endl;
Matrix gains;
Vector gn;
double GAINTHR = 0.005; // limite inferieur du gain avant faire 1/G
{
PInPersist pin(gainfile);
pin>>PPFNameTag("gains")>>gains;
pin>>PPFNameTag("gn")>>gn;
for (int p=0; p<8; p++) cout<<"gn["<<p<<"]="<<gn(p)<<" ";
// on transforme gains en facteur multiplicatif
for(sa_size_t r=0;r<gains.NRows();r++) {
for(sa_size_t c=0; c<gains.NCols(); c++) gains(r,c)=((gains(r,c)>GAINTHR)?1./gains(r,c):0.);
}
cout<<endl;
}
P4gnuGain p4g(gainfile);
Matrix const & gains = p4g.getGainMatrix();
// Bande de frequence de 2 MHz autour du 21 cm (1420 MHz -> JF=2792)
sa_size_t JFmin21=2776,JFmax21=2808; // +/- 1 MHz autour de 1420 MHz
sa_size_t JFmin21_5=2710,JFmax21_5=2874; // +/- 5 MHz autour de 1420 MHz
......@@ -143,8 +138,12 @@ int main(int narg, char* arg[])
Range freqs21_5(JFmin21_5,JFmax21_5);
Range freqsB(JFminB,JFmaxB);
VisiP4Reader vreader(paths, Imin,Imax,Istep,true);
VisiP4ReaderBase * reader = VisiP4ReaderBase::getReader(paths);
VisiP4ReaderBase & vreader = (*reader);
vreader.setFreqReordering(fgreorderfreq);
vreader.SelectSerialNum(Imin,Imax,Istep);
vreader.setPrintLevel(prtlev);
bool fgok=true;
TMatrix< complex<r_4> > vismtx;
TMatrix< complex<r_4> > acsum;
......
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