Changeset 3997 in Sophya for trunk


Ignore:
Timestamp:
Jun 13, 2011, 11:12:09 PM (14 years ago)
Author:
ansari
Message:

Modifs/debug prog lecture/traitement dump ADC Pittsburgh/CRT , Reza, 13/06/2011

File:
1 edited

Legend:

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

    r3996 r3997  
    4444int DecodeProc(int narg, char* arg[]);
    4545int ProcessADCFiles(string& inoutpath, string& outname, int imin, int imax, int istep,  int jf1, int jf2, int nfreq);
    46 int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  TMatrix< complex<r_8> >& correl);
     46int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel);
    4747//------------------------------------------------------------------------------------------------------------
    4848
     
    138138#define ADCNREAD 8192
    139139#define NBADC 2
    140 #define NFREQUSED 1280
     140#define NFREQUSED 2000
    141141
    142142  sa_size_t  NCHAN = 4*NBADC;
     
    144144  sa_size_t  NCORREL = NCHAN*(NCHAN+1)/2;
    145145  TMatrix< complex<r_8> > correl(NCORREL,NFREQUSED);
     146  TMatrix< complex<r_8> > autocorrel(NCHAN,NFREQUSED);
    146147
    147148  FILE* fip[NBADC]={NULL,NULL};
     
    153154  char fname[512];
    154155
    155   signed char rdbuff[16384];
     156  signed char rdbuff[ADCRDBLKSZ];
    156157  int prtmodulo=50;
    157158  for(int ifile=imin; ifile<=imax; ifile+=istep) {
     
    168169        fread(rdbuff,1,ADCRDBLKSZ,fip[ka]);
    169170        for(int jac=0; jac<4; jac++) {
    170           for(sa_size_t ls=0; ls<ADCFLEN; ls++) sigadc(ls)=(float)rdbuff[jac*ADCFLEN+ls];
     171          for(sa_size_t ls=0; ls<ADCFLEN; ls++) sigadc(ls)=(float)rdbuff[ls*4+jac];
    171172          ffts.FFTForward(sigadc, foursig);
    172           cfour.Row(irc)=foursig(Range(400,1679));  irc++;
     173          cfour.Row(irc)=foursig(Range(400,1679)).Transpose();  irc++;
    173174        }
    174175      }
    175       ComputeCorrel(cfour, correl);
     176      ComputeCorrel(cfour, correl, autocorrel);
    176177      if (m%prtmodulo==0)  cout << " ProcessADCFiles/Info Done read+FFT+correl m=" << m << " / Max=" << ADCNREAD << endl;
    177178    }
     
    183184  cout << "ProcessADCFiles: Opening file " << fname << " for writing correlation matrix" << endl; 
    184185  POutPersist po(fname);
    185   po << correl;
     186  po << PPFNameTag("correlmtx") << correl;
     187  po << PPFNameTag("acorrmtx") << autocorrel;
     188
    186189  cout << "ProcessADCFiles:  finished FFT + correlation computing " << endl;
    187190  return 0;
     
    189192
    190193/* --Fonction-- */
    191 int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  TMatrix< complex<r_8> >& correl)
     194int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel)
    192195{
    193196  sa_size_t jcr=0;
     
    196199      for(sa_size_t i=0; i<cfour.NCols(); i++)
    197200        correl(jcr,i) += complex<r_8> ( cfour(j1,i)*conj(cfour(j2,i)) );
     201      if (j1==j2) autocorrel.Row(j1)=correl.Row(jcr);
    198202      jcr++;
    199203    }
Note: See TracChangeset for help on using the changeset viewer.