Commit 64c98cab authored by OP's avatar OP
Browse files

modifs

parent a18deaf9
......@@ -178,7 +178,7 @@ std::vector<sa_size_t> P4AVisiNumEncoder::getAllVCrossCor()
P4AnaParams::P4AnaParams()
: inpath5_("bao5/"), inpath6_("bao6/"), Imin_(0), Imax_(10), Istep_(1),
fgserall_(false), fgtmsel_(false), inwsz_(8),
fgreorderfreq_(false), gain_gnu_file_("gain.ppf"),
fgreorderfreq_(false), gain_gnu_file_("gain.ppf"), gain_var_file_(""),gain_blind_filt_file_(""),
fitsoutfile_(""),outfile_("p4a.ppf"), Nmean_(10), prtlev_(0), prtmodulo_(1),
fgTFM_(false), TFMtimebin_(30), TFMfreqbin_(4), fgdtable_(false)
{
......@@ -188,7 +188,8 @@ 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_), inwsz_(a.inwsz_),
fgreorderfreq_(a.fgreorderfreq_), gain_gnu_file_(a.gain_gnu_file_),
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_),fitsoutfile_(a.fitsoutfile_),
outfile_(a.outfile_), Nmean_(a.Nmean_), prtlev_(a.prtlev_), prtmodulo_(a.prtmodulo_),
fgTFM_(a.fgTFM_), TFMtimebin_(a.TFMtimebin_), TFMfreqbin_(a.TFMfreqbin_),
fgdtable_(a.fgdtable_), fbands_(a.fbands_), lastargs_(a.lastargs_)
......@@ -201,6 +202,9 @@ P4AnaParams& P4AnaParams::operator = (P4AnaParams const & a)
Imin_=a.Imin_; Imax_=a.Imax_; Istep_=a.Istep_;
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_;
fitsoutfile_=a.fitsoutfile_;
outfile_=a.outfile_; Nmean_=a.Nmean_; prtlev_=a.prtlev_; prtmodulo_=a.prtmodulo_;
fgTFM_=a.fgTFM_; TFMfreqbin_=a.TFMfreqbin_; TFMtimebin_=a.TFMtimebin_;
fgdtable_=a.fgdtable_; fbands_=a.fbands_; lastargs_=a.lastargs_;
......@@ -240,6 +244,15 @@ int P4AnaParams::DecodeArgs(int narg, const char* arg[])
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
gain_gnu_file_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-vgf"){
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
gain_var_file_=arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-bff"){
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
gain_blind_filt_file_ = arg[2]; arg+=2; narg-=2; lastargs_.clear();
}
else if (fbo=="-nmean") {
if (narg<2) { cout << "P4AnaParams::DecodeArgs missing/bad argument, -h for help " << endl; return -1; }
Nmean_=atoi(arg[2]); arg+=2; narg-=2; lastargs_.clear();
......@@ -294,6 +307,8 @@ int P4AnaParams::UsageOptions()
<< " -o outfilename : specify output file name \n"
<< " -fo outfilename : specify output fits name \n"
<< " -gnu gain_filename: gain g(nu) file name \n"
<< " -vgf filename : gain variation parameters file (one line / feed) \n"
<< " -bff filename : blind filetered vectors ppf file (time + value) \n"
<< " -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"
......@@ -322,6 +337,7 @@ ostream& P4AnaParams::Print(ostream& os) const
}
os<<" VisiP4WindowReader window size="<<inwsz_<<endl;
os<<" Gain, g(nu) file:"<<gain_gnu_file_<<" OutFile="<<outfile_<<endl;
os<<" Gain variation : parameters in "<< gain_var_file_<< "\n filtered vectors in "<< gain_blind_filt_file_ <<endl;
os<<" Nmean="<<Nmean_<<" TFM: TimeBin="<<TFMtimebin_<<" FreqBin="<<TFMfreqbin_<<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;
......
......@@ -153,6 +153,11 @@ public:
bool fgreorderfreq_;
//--- nom de fichier de gain
string gain_gnu_file_;
//--- nom de fichier avec les params de var de gain
string gain_var_file_;
//--- fichier (ppf) avec les blind filters (time, valeur)
string gain_blind_filt_file_ ;
//--- nom du fichier de sortie
string outfile_;
//--- nom du fichier fits de sortie
......
......@@ -47,7 +47,7 @@ P4gvCor::P4gvCor(string const & filename,string const & filt_blind_name)
for (sa_size_t k=0 ; k < 8 ; k++) {
slopes_.push_back(arr(2,k));
offsets_.push_back(arr(1,k));
cout << " offs "<< arr(1,k) << " sl "<< arr(2,k) << endl;
}
pFile.close();
......@@ -77,6 +77,7 @@ double P4gvCor::getGain(size_t numch, TimeStamp const & tmstp ){
double vbl = my_interp_(tmstp.ToDays());
double gg = slopes_[numch] * vbl + offsets_[numch];
return(1./gg);
}
......@@ -94,8 +95,13 @@ void P4gvCor::applyGain(TMatrix <complex <float> > & mtx, TimeStamp const & tms
if (i == j ) gain = complex<r_4>( (r_4)getGain (i,tmstp), 0.);
else gain = complex< r_4 >( (r_4) sqrt( getGain(i,tmstp)*getGain(j,tmstp)) , 0.);
cout << " row "<<r<<" = "<< gain <<" "<< getGain (i,tmstp) << " " <<getGain(j,tmstp) << endl;
mtx.Row(r) *= gain ;
}
return;
}
......
......@@ -40,6 +40,7 @@
#include "p4autils.h"
#include "visp4winreader.h"
#include "p4gnugain.h"
#include "p4gvcor.h"
#include "fitsioserver.h"
#include "fiosinit.h"
......@@ -70,6 +71,7 @@ int main(int narg, const char* arg[])
if (fitsoutfile.length()>=1) {
fitsoutfile = "!"+fitsoutfile ; // adds '!' ?
}
int deltaIavg = params.TFMtimebin_;
sa_size_t TFMfbin = params.TFMfreqbin_;
int Imin = params.Imin_, Imax = params.Imax_, Istep = params.Istep_;
......@@ -101,15 +103,31 @@ int main(int narg, const char* arg[])
for(size_t k=0; k<KVCXHH.size(); k++) {
cout << "KVCXHH["<<k<<"]="<<KVCXHH[k]<<" ->"<<visiencod.Convert2VisiName(KVCXHH[k])<<endl;
}
string gvfile = params.gain_var_file_;
string fltfile = params.gain_blind_filt_file_;
P4gvCor * p4gvf = NULL ;
cout <<" gvfile "<< gvfile << endl;
cout <<"fltfile "<< fltfile << endl;
if ( gvfile.length()>1 && fltfile.length() > 1 ) p4gvf = new P4gvCor( gvfile, fltfile ) ;
// ---
HiStatsInitiator _inia;
int rc = 0;
// Gain correction class
P4gnuGain * p4g = NULL ;
try {
p4g = new P4gnuGain(params.gain_gnu_file_);
} catch (PException& exc) {
cerr << " visiavg.cc catched PException " << exc.Msg() << endl;
cerr << " on continue quand meme "<<endl ;
p4g = NULL ;
}
try {
ResourceUsage resu;
// Gain correction class
P4gnuGain p4g(params.gain_gnu_file_);
// setting up input visi reader
vector<string> paths;
......@@ -187,8 +205,11 @@ int main(int narg, const char* arg[])
cfdate = wreader.getAverageTimeTU();
// Apply gain g(nu)
p4g.applyGain(vismtx);
if (p4g != NULL )
p4g->applyGain(vismtx);
if (p4gvf != NULL)
p4gvf->applyGain(vismtx,cfdate);
if (cnt==0) { //resizing matrices for sum of auto-correlations and sum of 6 cross-correlations
acsum.SetSize(8, vismtx.NCols());
......@@ -398,6 +419,7 @@ int main(int narg, const char* arg[])
}
cout << resu; // Update est fait lors du print
if (p4g != NULL) delete(p4g);
}
......
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