Changeset 3941 in Sophya for trunk/AddOn/TAcq/svv2mtx2_1210.cc


Ignore:
Timestamp:
Jan 26, 2011, 6:52:12 PM (15 years ago)
Author:
cmv
Message:

on enleve le binnig en freq, pas bon car RFI, cmv 26/01/2011

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/AddOn/TAcq/svv2mtx2_1210.cc

    r3940 r3941  
    4141    <<" -f freq0 : 1ere frequence en MHz"<<endl
    4242    <<" -T it1,it2 : numero (temps) des fichiers a traiter [it1,it2]"<<endl
    43     <<" -F if1,if2,ngrpfreq : numero des frequences [if1,if2] de [0,N[ a traiter et regroupement par ngrpfreq"<<endl
    4443    <<"ATTENTION: lancer ce prog depuis le repertoire ou doivent etre ecrits les fichiers de visi"<<endl;
    4544}
     
    5655  int vacq1=-1, vacq2=-1;
    5756  int ifilmin=0, ifilmax=99999;
    58   int jfr1=0, jfr2=-1, ngrpfreq=1;
    5957
    6058  char c;
    61   while((c = getopt(narg,arg,"hDCo:t:r:f:T:F:v:")) != -1) {
     59  while((c = getopt(narg,arg,"hDCo:t:r:f:T:v:")) != -1) {
    6260    switch (c) {
    6361    case 'v' :
     
    8583      sscanf(optarg,"%d,%d",&ifilmin,&ifilmax);
    8684      if(ifilmin<0) ifilmin=0;
    87       break;
    88     case 'F' :
    89       sscanf(optarg,"%d,%d,%d",&jfr1,&jfr2,&ngrpfreq);
    90       if(ngrpfreq<=0) ngrpfreq=1;
    9185      break;
    9286    case 'h' :
     
    106100  cout<<"freq0="<<freq0<<" MHz"<<endl;
    107101  cout<<"request: file "<<ifilmin<<" to "<<ifilmax<<endl; if(ifilmax<ifilmin) return -3;
    108   cout<<"request: freq "<<jfr1<<" to "<<jfr2<<" grouped by "<<ngrpfreq<<endl;
    109102
    110103  InitTim();
     
    163156  TMatrix< complex<r_4> > MVisi;
    164157  TVector<r_8> MeanTT(nfile);
     158  TVector<int_4> Npaqsum(nfile);
    165159  TVector<r_4> Freq;
    166   TVector<int_4> Npaqsum(nfile);
    167160  string tudeb, tufin;
    168161  double tudeb_day, tufin_day;
     
    192185    MeanTT(ntimefill) = (double)vismtx.Info()["MeanTT"]/125.e6;
    193186    uint_4 npaqsum = vismtx.Info()["NPAQSUM"];
     187    Npaqsum(ntimefill) = npaqsum;
    194188
    195189    // --- Initialisation purposes for the first read file
     
    202196        return -5;
    203197      }
    204 
    205       // frequency grouping
    206       int nfreq0 = vismtx.NCols();
    207       cout<<"vismtx: number of frequencies = "<<nfreq0<<endl;
    208       if(jfr1<=0) jfr1=0; if(jfr1>=nfreq0) jfr1=nfreq0-1;
    209       if(jfr2<jfr1 || jfr2>=nfreq0) jfr2=nfreq0-1;
    210       cout<<"frequency from jfr1="<<jfr1<<" to jfr2="<<jfr2<<" grouped by "<<ngrpfreq<<endl;
    211       nfreq = 0; for(int i=jfr1;i<=jfr2;i+=ngrpfreq) nfreq++;
    212       cout<<"frequency from [jfr1="<<jfr1<<" , jfr2="<<jfr2<<"] grouped by "<<ngrpfreq
    213           <<": total of "<<nfreq<<" freq"<<endl;
    214       Freq.ReSize(nfreq); Freq = 0.;
    215       for(int i=0;i<nfreq;i++) {
    216         int nf=0;
    217         for(int j=0; j<ngrpfreq; j++) {
    218           int f = jfr1 + i*ngrpfreq + j;
    219           if(f>jfr2) break;
    220           Freq(i) += f;
    221           nf++;
    222         }
    223         if(nf>0) Freq(i) /= (double)nf;
    224         else {cout<<"ERROR: last freq bin with 0 freq in it"<<endl; return -6;}
    225         if(i<4 || i>nfreq-4) cout<<"  F("<<i<<") = "<<Freq(i)<<" nf="<<nf<<endl;
    226       }
    227 
     198      // Frequency
     199      nfreq = vismtx.NCols();
     200      cout<<"vismtx: number of frequencies = "<<nfreq<<endl;
     201      Freq.ReSize(nfreq); for(int i=0;i<nfreq;i++) Freq(i) = i;
    228202      // allocate visib matrice <f> vs t
    229203      cout<<"allocating visibility matrice ("<<nfile<<","<<nfreq<<") "
     
    234208
    235209    // Fill time-freq visibility matrix
    236     for(int i=0;i<nfreq;i++) {
    237       int nf=0;
    238       for(int j=0; j<ngrpfreq; j++) {
    239         int f = jfr1 + i*ngrpfreq + j;
    240         if(f>jfr2) break;
    241         MVisi(ntimefill,i) += vismtx(numrow,f);
    242         nf++;
    243       }
    244       Npaqsum(ntimefill) = nf * npaqsum;
    245       MVisi(ntimefill,i) /= double(Npaqsum(ntimefill));
    246       if(doconj) MVisi(ntimefill,i) = conj(MVisi(ntimefill,i));
     210    for(int c=0;c<nfreq;c++) {
     211      MVisi(ntimefill,c) = vismtx(numrow,c) / complex<r_4>(npaqsum);
     212      if(doconj) MVisi(ntimefill,c) = conj(MVisi(ntimefill,c));
    247213    }
    248214    ntimefill++;
     
    279245  dvl["freq0"] = freq0;
    280246  dvl["dfreq0"] = 500./8192.;
    281   dvl["jfr1"] = jfr1;
    282   dvl["jfr2"] = jfr2;
    283   dvl["ngrpfreq"] = ngrpfreq;
     247  dvl["jfr1"] = 0;
     248  dvl["jfr2"] = nfreq-1;
     249  dvl["nfreq"] = nfreq;
     250  dvl["ngrpfreq"] = 1;
    284251  dvl["ifilmin"] = ifilmin;
    285252  dvl["ifilmax"] = ifilmax;
     
    298265    dum3.Info() = dvl;
    299266    pos.PutObject(dum3,"visi");
    300   }
    301   pos.PutObject(Freq,"ifreq");
     267    pos.PutObject(Freq,"ifreq");
     268  }
    302269
    303270  }
     
    330297n/plot ifreq.val%n ! ! "cpts"
    331298
    332 n/plot npaqsum.val%n ! ! "cpts"
    333 
    334299n/plot meantt.val%n ! ! "cpts"
    335300cp meantt dmeantt
Note: See TracChangeset for help on using the changeset viewer.