Commit 0b052f3b authored by OP's avatar OP
Browse files

add determination of freq limits

parent bc550f69
......@@ -70,10 +70,40 @@ P4gnuGain::P4gnuGain(string const & gainfilename, double gthr)
cout<<" ... Gain normalisation:"<<endl;
for (int p=0; p<8; p++) cout<<"gn["<<p<<"]="<<gnorm_(p)<<" ";
cout<<endl;
// 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.);
}
P4FreqBand myp4fre;
int maxg=gains_.NCols()/2;
for (sa_size_t c = gains_.NCols()/2 ; c < gains_.NCols() ; c++) {
int ok=0;
for(sa_size_t r=0;r<gains_.NRows();r++) {
if (gains_(r,c) ==0 ) { ok=1; }
}
if (ok==1) break;
maxg=c;
}
int ming=gains_.NCols()/2;
for (sa_size_t c = gains_.NCols()/2 ; c >=0 ; c--) {
int ok=0;
for(sa_size_t r=0;r<gains_.NRows();r++) {
if (gains_(r,c) ==0 ) { ok=1; }
}
if (ok==1) break;
ming=c;
}
minGoodF_ = myp4fre.freqstart_ + ming* myp4fre.getP4FreqResolution();
maxGoodF_ = myp4fre.freqstart_ + maxg* myp4fre.getP4FreqResolution();
for(sa_size_t r=0; r<vmtxgains_.NRows(); r++) {
std::pair<sa_size_t , sa_size_t> pij = venc.getFeedPair(r);
sa_size_t i=pij.first;
......
......@@ -43,13 +43,15 @@ public:
//! return the multiplicative complex gain matrix, applicable to the full visibility matrix.
inline SOPHYA::TMatrix< complex<r_4> > const & getVisiGainMatrix() const { return vmtxgains_; }
inline int minGoodF(){return minGoodF_;}
inline int maxGoodF(){return maxGoodF_;}
protected:
// ----- adaptation de la fonction de calcul de gain, ecrit par cmv pour l'analyse Amas (Aout 2013)
static SOPHYA::Matrix computeGain2(SOPHYA::Matrix & acs, int SZW=96, float frackeep=0.75);
// ----- fonction pour normaliser les gains
static SOPHYA::Vector normalizeGain2(SOPHYA::Matrix & gain);
int minGoodF_,maxGoodF_;
std::string gainfilename_;
SOPHYA::TMatrix<r_8> gains_;
SOPHYA::TVector<r_8> gnorm_;
......
......@@ -598,12 +598,24 @@ int main(int narg, const char* arg[])
}
} // end option HV
P4FreqBand myp4fre;
TVector <double> lim_freq(2);
if (params.gain_gnu_file_.length()>0) {
P4gnuGain p4gnu( params.gain_gnu_file_ );
lim_freq(0) = p4gnu. minGoodF();
lim_freq(1) = p4gnu. maxGoodF();
}else{
lim_freq(0) = myp4fre.freqstart_;
lim_freq(1) = myp4fre.freqend_;
}
potfm << PPFNameTag("FreqLims") << lim_freq ;
potfm << PPFNameTag("TimeVec") << timevec ;
potfm << PPFNameTag("RAVec") << ravec ;
// --- FIN sauvegarde cartes temps-frequence
// resu.Update();
P4FreqBand myp4fre;
TVector <double> avg_freqs( myp4fre.getP4NbFreqChannels()/TFMfbin);
double frbase = myp4fre.freqstart_ + myp4fre.getP4FreqResolution()/2. ;
......@@ -611,7 +623,10 @@ int main(int narg, const char* arg[])
avg_freqs(kf) = frbase ;
potfm << PPFNameTag("FreqVec") << avg_freqs;
if (fos != NULL) {
ext_names.push_back("FreqsLims");
(*fos)<< lim_freq ;
ext_names.push_back("Frequences");
(*fos)<< avg_freqs ;
ext_names.push_back("RAs");
......
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