Changeset 3647 in Sophya for trunk


Ignore:
Timestamp:
Jun 12, 2009, 4:49:47 PM (16 years ago)
Author:
ansari
Message:

Petites amelioration programme traitrement donnees de Pittsburgh - Reza 12/06/2009

Location:
trunk/AddOn/TAcq
Files:
2 edited

Legend:

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

    r3646 r3647  
    1010#include "tvector.h"
    1111#include "ntuple.h"
     12#include "datatable.h"
    1213#include "fioarr.h"
    1314#include "timestamp.h"
     
    7879//    filog << " ... NMaxMemZones=" << nmax_ << " NMean=" << nmean_ << " Step=" << step_ << endl;       
    7980
    80 // NTuple
     81/*----DELETE  NTuple
    8182    const char* nnames[8] = {"fcs","tts","s1","s2","s12","s12re","s12im","s12phi"};
    8283    NTuple nt(8, nnames);
     
    8485    uint_4 nmnt = 0;
    8586    double ms1,ms2,ms12,ms12re,ms12im,ms12phi;
     87----*/
    8688// Initialisation pour calcul FFT
    8789    TVector< complex<r_4> > cfour1;  // composant TF
     
    113115    uint_4 ifile = 0;                           
    114116    uint_4 nzm = 0; 
     117
     118    uint_4 curfc=0;
     119    uint_8 curtt=0;
     120    uint_8 firsttt=0;
     121    bool fgfirst=true;
    115122    for (uint_4 kmz=0; kmz<nmax_; kmz++) {
    116123      if (stop_) break;
     
    126133        break; 
    127134      }
    128       nmnt=0;  ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.;
     135//---- DELETE      nmnt=0;  ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.;
    129136      for(uint_4 i=0; i<memgr.NbPaquets(); i++) {
    130137            BRPaquet paq(NULL, buff+i*paqsz, paqsz);
    131138        if (!pcheck.Check(paq)) continue;   // on ne traite que les paquets OK
    132        
     139        if (fgfirst) { firsttt=paq.TimeTag(); fgfirst=false; }
     140        curfc=paq.FrameCounter();
     141        curtt=paq.TimeTag()-firsttt;
    133142// Traitement voie 1       
    134143            for(sa_size_t j=0; j<vx.Size(); j++)
     
    154163          visiV12(j)+=cfour1(j)*conj(cfour2(j));
    155164//        for(sa_size_t j=0; j<visiV12.Size(); j++) visiV12(j)+=zp1[j]*zp2[j];
     165        if (nzm==0) {
     166          spectreV1.Info()["StartFC"] = curfc;
     167          spectreV2.Info()["StartFC"] = curfc;
     168          visiV12.Info()["StartFC"] = curfc;
     169          spectreV1.Info()["StartTT"] = curtt;
     170          spectreV2.Info()["StartTT"] = curtt;
     171          visiV12.Info()["StartTT"] = curtt;
     172        }
    156173        nzm++;   
     174/*----DELETE
    157175        if (nmnt==0)  { xnt[0]=paq.FrameCounter();  xnt[1]=paq.TimeTag(); }
    158176        for(sa_size_t j=2700; j<2800; j++) {
     
    163181        }
    164182        nmnt++;   
     183----*/
    165184        totnbytesproc += paq.DataSize();
    166185        totnbytesout += (2*sizeof(complex<r_4>)*cfour1.Size());
    167186
    168187      } // Fin de boucle sur les paquets d'une zone
     188
     189/*---- DELETE
    169190      if (nmnt>0)  {
    170191        double fnorm = (double)nmnt*(2800-2700);
     
    177198        nt.Fill(xnt);
    178199      }
     200----*/
    179201      if ((nzm >= nmean_) || ((kmz==(nmax_-1))&&(nzm>1))) {
    180202        spectreV1 /= (r_4)(nzm);
     
    186208        spectreV2.Info()["NPaqMoy"] = nzm;
    187209        visiV12.Info()["NPaqMoy"] = nzm;
     210        spectreV1.Info()["EndFC"] = curfc;
     211        spectreV2.Info()["EndFC"] = curfc;
     212        visiV12.Info()["EndFC"] = curfc;
     213        spectreV1.Info()["EndTT"] = curtt;
     214        spectreV2.Info()["EndTT"] = curtt;
     215        visiV12.Info()["EndTT"] = curtt;
    188216            {
    189217        sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile);
     
    214242  cout << " ------------  BRProcARaw2C::run() END " << card2name_(card_)
    215243       << " ------------ " << endl;
    216   {     
     244/*---- DELETE
     245  {
     246  nt.Info()["FirstTT"]=firsttt;     
    217247  cout << nt;
    218248  sprintf(fname,"%s_nt.ppf",path_.c_str());
     
    220250  po << PPFNameTag("ntv12") << nt;
    221251  cout << " BRProcARaw2C::run() created NTuple file " << fname << card2name_(card_) << endl;
    222   }     
     252  }
     253---- */
    223254  ts.SetNow();
    224255  tm.SplitQ();
     
    320351         << " *8="  << szfour*8 << endl;
    321352
     353    DataTable dt;
     354    dt.AddLongColumn("fc1");
     355    dt.AddLongColumn("fc2");
     356    dt.AddLongColumn("tt1");
     357    dt.AddLongColumn("tt2");
     358    DataTableRow dtr = dt.EmptyRow();
     359
    322360    uint_4 nzm = 0;
    323361    uint_4 totnoksfc = 0;
     
    325363    uint_4 totnpaq = 0;
    326364    uint_4 ifile = 0;
     365
     366    uint_4 curfc=0;
     367    uint_8 curtt=0;
     368    uint_4 curfc2=0;
     369    uint_8 curtt2=0;
     370    uint_8 firsttt=0;
     371    uint_8 firsttt2=0;
     372    bool fgfirst=true;
    327373    for (uint_4 kmz=0; kmz<nmax_; kmz++) {
    328374      uint_4 noksfc = 0;
     
    377423        // Les deux framecounters sont identiques ...
    378424        noksfc++;
     425        curfc=paq1.FrameCounter();
     426        curfc2=paq2.FrameCounter();
     427        if (fgfirst) {
     428          firsttt=paq1.TimeTag();  firsttt=paq2.TimeTag();
     429          cout << " BRProcBRaw4C()/Info First FC="<<curfc<<" , "<<curfc2<<" -> TT="
     430               << firsttt<<" , "<<firsttt2 <<endl;
     431          fgfirst=false;
     432        }
     433        curtt=paq1.TimeTag()-firsttt;
     434        curtt2=paq2.TimeTag()-firsttt2;
     435        dtr[0]=curfc;  dtr[1]=curtt;
     436        dtr[2]=curfc2;  dtr[3]=curtt2;
     437        dt.AddRow(dtr);
     438
    379439        complex<r_4>* zp1 = (complex<r_4>*)(procbuff1+i1*procpaqsz);
    380440        complex<r_4>* zp2 = (complex<r_4>*)(procbuff1+i1*procpaqsz+procpaqsz/2);
     
    387447          visiV24(j)+=zp2[j]*conj(zp4[j]);
    388448        }
     449        if (nzm==0) {
     450          visiV13.Info()["StartFC"] = curfc;
     451          visiV14.Info()["StartFC"] = curfc;
     452          visiV23.Info()["StartFC"] = curfc;
     453          visiV24.Info()["StartFC"] = curfc;
     454          visiV13.Info()["StartTT"] = curtt;
     455          visiV14.Info()["StartTT"] = curtt;
     456          visiV23.Info()["StartTT"] = curtt;
     457          visiV24.Info()["StartTT"] = curtt;
     458        }
    389459        nzm++;  i1++; i2++;
    390460        totnbytesproc += 2*paq1.DataSize();
     
    402472        visiV23.Info()["NPaqMoy"] = nzm;
    403473        visiV24.Info()["NPaqMoy"] = nzm;
     474        visiV13.Info()["EndFC"] = curfc;
     475        visiV14.Info()["EndFC"] = curfc;
     476        visiV23.Info()["EndFC"] = curfc;
     477        visiV24.Info()["EndFC"] = curfc;
     478        visiV13.Info()["EndTT"] = curtt;
     479        visiV14.Info()["EndTT"] = curtt;
     480        visiV23.Info()["EndTT"] = curtt;
     481        visiV24.Info()["EndTT"] = curtt;
    404482        char fname[512];
    405483        {
     
    427505    }  // Fin de boucle sur les zones a traiter
    428506    cout << " ------------------  BRProcBRaw4C::run() END ----------------- " << endl;
     507    {     
     508    dt.Info()["FirstTT1"]=firsttt;     
     509    dt.Info()["FirstTT2"]=firsttt2;     
     510    cout << dt;
     511    char fname[512];
     512    sprintf(fname,"%s_fctt.ppf",path_.c_str());
     513    POutPersist po(fname);
     514    po << PPFNameTag("ttfc") << dt;
     515    cout << " BRProcBRaw4C::run() created TimeTag/FrameCounter file " << fname  << endl;
     516    }     
    429517    ts.SetNow();
    430518    tm.SplitQ();
  • trunk/AddOn/TAcq/svv2mtx.cc

    r3646 r3647  
    4040int Usage(bool fgshort=true);
    4141// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    42 int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int card=1);
     42int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int nfreq, int card=1);
    4343
    4444//----------------------------------------------------
     
    6161    int jf1=0;
    6262    int jf2=0;
    63     sscanf(arg[3],"%d,%d",&jf1,&jf2);
     63    int nfreq=0;
     64    sscanf(arg[3],"%d,%d,%d",&jf1,&jf2,&nfreq);
    6465    cout << " ----- svv2mtx.cc Start - InOutPath= " << inoutpath << " IMin,Max,Step="
    6566         << imin << "," << imax << "," << istep << " JF=" << jf1 << "," << jf2 << "  ------- " << endl;
     
    9495
    9596// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    96 int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int card)
     97int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int nfreq, int card)
    9798{
    9899  Timer tm("ProcSVFiles");
    99100  char fname[512];
    100101// NTuple
    101   const char* nnames[8] = {"fcs","tts","s1","s2","s12","s12re","s12im","s12phi"};
    102   NTuple nt(8, nnames);
    103   double xnt[10];
     102  const char* nnames[10] = {"fcsm","ttsm","jfreq","s1","s2","s12","s12re","s12im","s12phi","s12mod"};
     103  NTuple nt(10, nnames);
     104  double xnt[15];
    104105  uint_4 nmnt = 0;
    105   double ms1,ms2,ms12,ms12re,ms12im,ms12phi;
     106  double ms1,ms2,ms12,ms12re,ms12im,ms12phi,ms12mod;
    106107
    107108  TMatrix<r_4> s1, s2;
    108   TMatrix<r_4> v12re, v12im, v12phi;
     109  TMatrix<r_4> v12re, v12im, v12phi,v12mod;
    109110  sa_size_t ncols = (imax-imin+1)/istep;
    110111  sa_size_t nrows = 10;
     
    143144      v12im.SetSize(nrows, ncols);
    144145      v12phi.SetSize(nrows, ncols);
     146      v12mod.SetSize(nrows, ncols);
    145147    }
    146148    s1.Column(kc) = sv1;
     
    149151    v12im.Column(kc) = imag(vv12);
    150152    v12phi.Column(kc) = phase(vv12);
    151     nmnt=0;  ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.;
    152     for(sa_size_t jf=jf1; jf<=jf2; jf++) {
    153       ms1 += s1(jf,kc);
    154       ms2 += s2(jf,kc);
    155       ms12re += v12re(jf,kc);
    156       ms12im += v12im(jf,kc);
    157       ms12phi += v12phi(jf,kc);
    158     }
    159     nmnt = (jf2-jf1+1);
    160     if (nmnt>0)  {
    161       double fnorm = (double)nmnt;
    162       xnt[0] = kc;
    163       xnt[1] = 0;
    164       xnt[2] = ms1 /= fnorm;
    165       xnt[3] = ms2 /= fnorm;
    166       xnt[4] = ms12 /= fnorm;
    167       xnt[5] = ms12re /= fnorm;
    168       xnt[6] = ms12im /= fnorm;
    169       xnt[7] = ms12phi /= fnorm;
    170       nt.Fill(xnt);
    171     }
    172 
     153    v12mod.Column(kc) = module(vv12);
     154
     155// Calcul moyenne dans des bandes en frequence
     156    int deltajf=(jf2-jf1)/nfreq;
     157    if (deltajf<1) deltajf=1;
     158    for(int kf=0; kf<nfreq; kf++) {
     159      sa_size_t jfstart=jf1+kf*deltajf;
     160      sa_size_t jfend=jfstart+deltajf;
     161      if (jfend>jf2)  break;
     162      nmnt=0;  ms1=ms2=ms12=ms12re=ms12im=ms12phi=ms12mod=0.;
     163      for(sa_size_t jf=jfstart; jf<jfend; jf++) {
     164        ms1 += s1(jf,kc);
     165        ms2 += s2(jf,kc);
     166        ms12re += v12re(jf,kc);
     167        ms12im += v12im(jf,kc);
     168        ms12phi += v12phi(jf,kc);
     169        ms12mod += v12mod(jf,kc);
     170      }
     171      nmnt = (jfend-jfstart);
     172      if (nmnt>0)  {
     173        double fnorm = (double)nmnt;
     174        xnt[0] = ((int_8)(sv1.Info()["StartFC"])+(int_8)(sv1.Info()["EndFC"]))*0.5;
     175        xnt[1] = ((int_8)(sv1.Info()["StartTT"])+(int_8)(sv1.Info()["EndTT"]))*0.5;
     176        xnt[2] = kf;
     177        xnt[3] = ms1/fnorm;
     178        xnt[4] = ms2/fnorm;
     179        xnt[5] = ms12/fnorm;
     180        xnt[6] = ms12re/fnorm;
     181        xnt[7] = ms12im/fnorm;
     182        xnt[8] = ms12phi/fnorm;
     183        xnt[9] = ms12mod/fnorm;
     184        nt.Fill(xnt);
     185      }
     186    }
    173187    kc++;
    174188
     
    213227{
    214228  cout << " --- svv2mtx.cc : Read PPF files produced by mcrd to make matrices BAORadio" << endl;
    215   cout << " Usage:  mcrd InOutPath Imin,Imax,step NumFreq1,NumFreq2 [card=1]" << endl;
     229  cout << " Usage:  mcrd InOutPath Imin,Imax,step NumFreq1,NumFreq2,NBinFreq [card=1]" << endl;
    216230  if (fgshort) {
    217231    cout << " mcrd -h for detailed instructions" << endl;
     
    221235  cout << " Imin,Imax,IStep: Input PPF files sequence number \n"
    222236       << "    FileNames=InOutPath/Ch12_II.fits Imin<=II<=Imax II+=IStep \n"
     237       << " NumFreq1,NumFreq2,NBinFreq: Freq Zone and number of frequency bins for ntuple\n"
    223238       << " card=1 Ch12 , card=2 Ch34 " << endl;
    224239  return 1;
Note: See TracChangeset for help on using the changeset viewer.