Changeset 3647 in Sophya for trunk/AddOn/TAcq
- Timestamp:
- Jun 12, 2009, 4:49:47 PM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brproc.cc
r3646 r3647 10 10 #include "tvector.h" 11 11 #include "ntuple.h" 12 #include "datatable.h" 12 13 #include "fioarr.h" 13 14 #include "timestamp.h" … … 78 79 // filog << " ... NMaxMemZones=" << nmax_ << " NMean=" << nmean_ << " Step=" << step_ << endl; 79 80 80 / /NTuple81 /*----DELETE NTuple 81 82 const char* nnames[8] = {"fcs","tts","s1","s2","s12","s12re","s12im","s12phi"}; 82 83 NTuple nt(8, nnames); … … 84 85 uint_4 nmnt = 0; 85 86 double ms1,ms2,ms12,ms12re,ms12im,ms12phi; 87 ----*/ 86 88 // Initialisation pour calcul FFT 87 89 TVector< complex<r_4> > cfour1; // composant TF … … 113 115 uint_4 ifile = 0; 114 116 uint_4 nzm = 0; 117 118 uint_4 curfc=0; 119 uint_8 curtt=0; 120 uint_8 firsttt=0; 121 bool fgfirst=true; 115 122 for (uint_4 kmz=0; kmz<nmax_; kmz++) { 116 123 if (stop_) break; … … 126 133 break; 127 134 } 128 nmnt=0; ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.;135 //---- DELETE nmnt=0; ms1=ms2=ms12=ms12re=ms12im=ms12phi=0.; 129 136 for(uint_4 i=0; i<memgr.NbPaquets(); i++) { 130 137 BRPaquet paq(NULL, buff+i*paqsz, paqsz); 131 138 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; 133 142 // Traitement voie 1 134 143 for(sa_size_t j=0; j<vx.Size(); j++) … … 154 163 visiV12(j)+=cfour1(j)*conj(cfour2(j)); 155 164 // 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 } 156 173 nzm++; 174 /*----DELETE 157 175 if (nmnt==0) { xnt[0]=paq.FrameCounter(); xnt[1]=paq.TimeTag(); } 158 176 for(sa_size_t j=2700; j<2800; j++) { … … 163 181 } 164 182 nmnt++; 183 ----*/ 165 184 totnbytesproc += paq.DataSize(); 166 185 totnbytesout += (2*sizeof(complex<r_4>)*cfour1.Size()); 167 186 168 187 } // Fin de boucle sur les paquets d'une zone 188 189 /*---- DELETE 169 190 if (nmnt>0) { 170 191 double fnorm = (double)nmnt*(2800-2700); … … 177 198 nt.Fill(xnt); 178 199 } 200 ----*/ 179 201 if ((nzm >= nmean_) || ((kmz==(nmax_-1))&&(nzm>1))) { 180 202 spectreV1 /= (r_4)(nzm); … … 186 208 spectreV2.Info()["NPaqMoy"] = nzm; 187 209 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; 188 216 { 189 217 sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile); … … 214 242 cout << " ------------ BRProcARaw2C::run() END " << card2name_(card_) 215 243 << " ------------ " << endl; 216 { 244 /*---- DELETE 245 { 246 nt.Info()["FirstTT"]=firsttt; 217 247 cout << nt; 218 248 sprintf(fname,"%s_nt.ppf",path_.c_str()); … … 220 250 po << PPFNameTag("ntv12") << nt; 221 251 cout << " BRProcARaw2C::run() created NTuple file " << fname << card2name_(card_) << endl; 222 } 252 } 253 ---- */ 223 254 ts.SetNow(); 224 255 tm.SplitQ(); … … 320 351 << " *8=" << szfour*8 << endl; 321 352 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 322 360 uint_4 nzm = 0; 323 361 uint_4 totnoksfc = 0; … … 325 363 uint_4 totnpaq = 0; 326 364 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; 327 373 for (uint_4 kmz=0; kmz<nmax_; kmz++) { 328 374 uint_4 noksfc = 0; … … 377 423 // Les deux framecounters sont identiques ... 378 424 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 379 439 complex<r_4>* zp1 = (complex<r_4>*)(procbuff1+i1*procpaqsz); 380 440 complex<r_4>* zp2 = (complex<r_4>*)(procbuff1+i1*procpaqsz+procpaqsz/2); … … 387 447 visiV24(j)+=zp2[j]*conj(zp4[j]); 388 448 } 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 } 389 459 nzm++; i1++; i2++; 390 460 totnbytesproc += 2*paq1.DataSize(); … … 402 472 visiV23.Info()["NPaqMoy"] = nzm; 403 473 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; 404 482 char fname[512]; 405 483 { … … 427 505 } // Fin de boucle sur les zones a traiter 428 506 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 } 429 517 ts.SetNow(); 430 518 tm.SplitQ(); -
trunk/AddOn/TAcq/svv2mtx.cc
r3646 r3647 40 40 int Usage(bool fgshort=true); 41 41 // 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);42 int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int nfreq, int card=1); 43 43 44 44 //---------------------------------------------------- … … 61 61 int jf1=0; 62 62 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); 64 65 cout << " ----- svv2mtx.cc Start - InOutPath= " << inoutpath << " IMin,Max,Step=" 65 66 << imin << "," << imax << "," << istep << " JF=" << jf1 << "," << jf2 << " ------- " << endl; … … 94 95 95 96 // 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)97 int ProcSVFiles(string& inoutpath, int imin, int imax, int istep, int jf1, int jf2, int nfreq, int card) 97 98 { 98 99 Timer tm("ProcSVFiles"); 99 100 char fname[512]; 100 101 // NTuple 101 const char* nnames[ 8] = {"fcs","tts","s1","s2","s12","s12re","s12im","s12phi"};102 NTuple nt( 8, nnames);103 double xnt[1 0];102 const char* nnames[10] = {"fcsm","ttsm","jfreq","s1","s2","s12","s12re","s12im","s12phi","s12mod"}; 103 NTuple nt(10, nnames); 104 double xnt[15]; 104 105 uint_4 nmnt = 0; 105 double ms1,ms2,ms12,ms12re,ms12im,ms12phi ;106 double ms1,ms2,ms12,ms12re,ms12im,ms12phi,ms12mod; 106 107 107 108 TMatrix<r_4> s1, s2; 108 TMatrix<r_4> v12re, v12im, v12phi ;109 TMatrix<r_4> v12re, v12im, v12phi,v12mod; 109 110 sa_size_t ncols = (imax-imin+1)/istep; 110 111 sa_size_t nrows = 10; … … 143 144 v12im.SetSize(nrows, ncols); 144 145 v12phi.SetSize(nrows, ncols); 146 v12mod.SetSize(nrows, ncols); 145 147 } 146 148 s1.Column(kc) = sv1; … … 149 151 v12im.Column(kc) = imag(vv12); 150 152 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 } 173 187 kc++; 174 188 … … 213 227 { 214 228 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; 216 230 if (fgshort) { 217 231 cout << " mcrd -h for detailed instructions" << endl; … … 221 235 cout << " Imin,Imax,IStep: Input PPF files sequence number \n" 222 236 << " 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" 223 238 << " card=1 Ch12 , card=2 Ch34 " << endl; 224 239 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.