Changeset 3997 in Sophya for trunk/AddOn/TAcq/corrcrtadc.cc
- Timestamp:
- Jun 13, 2011, 11:12:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/corrcrtadc.cc
r3996 r3997 44 44 int DecodeProc(int narg, char* arg[]); 45 45 int 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 );46 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel); 47 47 //------------------------------------------------------------------------------------------------------------ 48 48 … … 138 138 #define ADCNREAD 8192 139 139 #define NBADC 2 140 #define NFREQUSED 1280140 #define NFREQUSED 2000 141 141 142 142 sa_size_t NCHAN = 4*NBADC; … … 144 144 sa_size_t NCORREL = NCHAN*(NCHAN+1)/2; 145 145 TMatrix< complex<r_8> > correl(NCORREL,NFREQUSED); 146 TMatrix< complex<r_8> > autocorrel(NCHAN,NFREQUSED); 146 147 147 148 FILE* fip[NBADC]={NULL,NULL}; … … 153 154 char fname[512]; 154 155 155 signed char rdbuff[ 16384];156 signed char rdbuff[ADCRDBLKSZ]; 156 157 int prtmodulo=50; 157 158 for(int ifile=imin; ifile<=imax; ifile+=istep) { … … 168 169 fread(rdbuff,1,ADCRDBLKSZ,fip[ka]); 169 170 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]; 171 172 ffts.FFTForward(sigadc, foursig); 172 cfour.Row(irc)=foursig(Range(400,1679)) ; irc++;173 cfour.Row(irc)=foursig(Range(400,1679)).Transpose(); irc++; 173 174 } 174 175 } 175 ComputeCorrel(cfour, correl );176 ComputeCorrel(cfour, correl, autocorrel); 176 177 if (m%prtmodulo==0) cout << " ProcessADCFiles/Info Done read+FFT+correl m=" << m << " / Max=" << ADCNREAD << endl; 177 178 } … … 183 184 cout << "ProcessADCFiles: Opening file " << fname << " for writing correlation matrix" << endl; 184 185 POutPersist po(fname); 185 po << correl; 186 po << PPFNameTag("correlmtx") << correl; 187 po << PPFNameTag("acorrmtx") << autocorrel; 188 186 189 cout << "ProcessADCFiles: finished FFT + correlation computing " << endl; 187 190 return 0; … … 189 192 190 193 /* --Fonction-- */ 191 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, TMatrix< complex<r_8> >& correl )194 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel) 192 195 { 193 196 sa_size_t jcr=0; … … 196 199 for(sa_size_t i=0; i<cfour.NCols(); i++) 197 200 correl(jcr,i) += complex<r_8> ( cfour(j1,i)*conj(cfour(j2,i)) ); 201 if (j1==j2) autocorrel.Row(j1)=correl.Row(jcr); 198 202 jcr++; 199 203 }
Note:
See TracChangeset
for help on using the changeset viewer.