Changeset 3962 in Sophya


Ignore:
Timestamp:
Mar 4, 2011, 4:37:56 PM (15 years ago)
Author:
ansari
Message:

suite debug/amelioration visfits2dt.cc remplissage DataTable mis en option, Reza+Cedric, 04/03/2011

File:
1 edited

Legend:

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

    r3961 r3962  
    5757  cout << " --- visfits2dt : Read fits visibility matrices produced by visfmib to make \n"
    5858       << "     time-frequency matrices and Visibilites=f(time) datatable " << endl;
    59   cout << " Usage: visfits2dt InOutPath Imin,Imax,step NumFreq1,NumFreq2,NBinFreq [VisMtxRowList] \n" << endl;
     59  cout << " Usage: visfits2dt InOutPath Imin,Imax,step NumFreq1,NumFreq2,NBinFreq VisMtxRowList [DT] \n" << endl;
    6060  if (fgshort) {
    6161    cout << " svv2mtx -h for detailed instructions" << endl;
     
    6666       << "    FileNames=InOutPath/vismtxII.fits Imin<=II<=Imax II+=IStep \n"
    6767       << " NumFreq1,NumFreq2,NBinFreq: Freq Zone and number of frequency bins for DataTable\n"
    68        << " VisMtxRowList : List of visibiliy matrix rows (0,2,...) -> time-freq map \n" << endl;
     68       << " VisMtxRowList : List of visibiliy matrix rows (0,2,...) -> time-freq map \n"
     69       << " DT : Fill datatable if DT arg specified " << endl;
    6970  return 1;
    7071}
     
    7576{
    7677  if ((narg>1)&&(strcmp(arg[1],"-h")==0))  return Usage(false);
    77   if (narg<4) return Usage(true);
     78  if (narg<5) return Usage(true);
    7879  HiStatsInitiator _inia;
    7980  //   TArrayInitiator  _inia;
     
    110111//       Traitement fichiers produits par vismfib  (V Nov09)
    111112/* --Fonction-- */
     113static  bool fgfilldt=false;
     114
    112115int DecodeProc(int narg, char* arg[])
    113116{
     
    124127  int card=1;
    125128  vector<sa_size_t> rowlist;
    126   if (narg>3) {
    127     EnumeratedSequence es;
    128     int nbad;
    129     es.Append(arg[3], nbad, ",");
    130     for(int j=0; j<es.Size(); j++) rowlist.push_back((int)es.Value(j));
    131   }
     129  EnumeratedSequence es;
     130  int nbad;
     131  es.Append(arg[3], nbad, ",");
     132  for(int j=0; j<es.Size(); j++) rowlist.push_back((int)es.Value(j));
     133  fgfilldt=false;
     134  if ((narg>4)&&(strcmp(arg[4],"DT")==0))  fgfilldt=true;
    132135  //  if (rowlist.size()<1) rowlist.push_back(0);
    133136
     
    165168  if (djf<1) djf=1;
    166169
    167   cout << " --- ProcVisMtxFiles jf1=" << jf1 << " jf2= " << jf2 << " djf=" << djf << endl;
     170  cout << " --- ProcVisMtxFiles Frequency binng Start=" << jf1 << " End= " << jf2 << " DFreq=" << djf << " NBinFreq=" << nfreq << endl;
    168171  char fname[1024];
    169172
     
    179182  cout << " ---- ProcVisMtxFiles()-Read chanum done " << endl;
    180183  sa_size_t nrows = (imax-imin+1)/istep;
    181   sa_size_t kr=0;
    182 
    183   sa_size_t mtf_binfreq=25;
    184   sa_size_t mtf_bintime=5;
     184  sa_size_t ktime=0;
     185
     186  //  sa_size_t mtf_binfreq=25;
     187  sa_size_t mtf_bintime=1;
    185188
    186189  sa_size_t ncols=1;
     
    197200      ncols = vismtx.NCols();
    198201      cout << " ProcVisMtxFiles/Info: Output Time-Frequency matrices NRows(time) "
    199            << nrows/mtf_bintime+1 << " NCols(freq) =" << ncols/mtf_binfreq+1 << endl;
     202           << nrows/mtf_bintime+1 << " NCols(freq) =" << nfreq << endl;
    200203      for(size_t j=0; j<rowlist.size(); j++)   
    201         vmtf.push_back(TMatrix< r_4 >(nrows/mtf_bintime+1, ncols/mtf_binfreq+1));
     204        vmtf.push_back(TMatrix< r_4 >(nrows/mtf_bintime+1, nfreq));
    202205    }
    203206
    204207    if (rowlist.size()>0) {
    205       for(size_t j=0; j<rowlist.size(); j++)
    206         for(sa_size_t icf=0; icf<ncols; icf++)  {
    207           vmtf[j](kr/mtf_bintime,icf/mtf_binfreq)+=vismtx(rowlist[j],icf);
     208      for(size_t j=0; j<rowlist.size(); j++) {
     209        sa_size_t jfreb=0;
     210        for(sa_size_t jf=jf1; jf<jf2; jf+=djf) {
     211          sa_size_t jfreb=(jf-jf1)/djf;
     212          if (jfreb>=nfreq)  break;
     213          vmtf[j](ktime/mtf_bintime,jfreb)+=vismtx(rowlist[j],jf);
    208214        }
     215      }
    209216    }
    210217    //    cout << " DBG* kr=" << kr << " kr/mtf_bintime=" << kr/mtf_bintime
    211218    //     << " ncols/2/mtf_binfreq=" << ncols/2/mtf_binfreq << endl;
    212     kr++;
     219    ktime++;
    213220
    214221     
    215222// Calcul moyenne dans des bandes en frequence
    216     FillVisDTable(visdt, vismtx, chanum, jf1, jf2, djf);
     223    if (fgfilldt)   FillVisDTable(visdt, vismtx, chanum, jf1, jf2, djf);
    217224  }
    218225
     
    221228    cout << "ProcVisMtxFiles: Opening file " << fname << " for writing Visi(Freq,Time) matrices" << endl; 
    222229    FitsInOutFile fo(fname, FitsInOutFile::Fits_Create);
    223     for(size_t j=0; j<rowlist.size(); j++) 
     230    for(size_t j=0; j<rowlist.size(); j++)  {
     231      cout << " Writing Time-Freq visibility matrix for " << chanum(rowlist[j]) << endl;
    224232      fo << vmtf[j];
    225   }
    226   cout << visdt;
    227   sprintf(fname, "!%s/visidt.ppf",inoutpath.c_str());
    228   cout << "ProcVisMtxFiles: writing visibility datatable to file " << fname << endl;
    229   FitsInOutFile fod(fname, FitsInOutFile::Fits_Create);
    230   fod << visdt;
    231 
     233    }
     234  }
     235  if (fgfilldt)  {
     236    cout << visdt;
     237    sprintf(fname, "!%s/visidt.fits",inoutpath.c_str());
     238    cout << "ProcVisMtxFiles: writing visibility datatable to file " << fname << endl;
     239    FitsInOutFile fod(fname, FitsInOutFile::Fits_Create);
     240    fod << visdt;
     241  }
    232242  return 0;
    233243}
Note: See TracChangeset for help on using the changeset viewer.