Changeset 3652 in Sophya for trunk/AddOn
- Timestamp:
- Jun 15, 2009, 10:57:12 AM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/brproc.cc
r3651 r3652 11 11 #include "ntuple.h" 12 12 #include "datatable.h" 13 #include "histos.h" 13 14 #include "fioarr.h" 14 15 #include "timestamp.h" … … 34 35 /* --Methode-- */ 35 36 BRProcARaw2C::BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean, 36 uint_4 nmax, bool fg notrl, int card)37 uint_4 nmax, bool fghist, bool fgnotrl, int card) 37 38 : memgr(mem) 38 39 { … … 42 43 path_ = path; 43 44 fgnotrl_ = fgnotrl; 45 fghist_ = fghist; 44 46 card_ = card; 45 47 if (pmutfftw==NULL) pmutfftw=new ZMutex; … … 90 92 double ms1,ms2,ms12,ms12re,ms12im,ms12phi; 91 93 ----*/ 94 // Time sample histograms 95 Histo h1(-0.5, 255.5, 256); 96 Histo h2(-0.5, 255.5, 256); 92 97 // Initialisation pour calcul FFT 93 98 TVector< complex<r_4> > cfour1; // composant TF … … 152 157 curtt=paq.TimeTag()-firsttt; 153 158 // Traitement voie 1 154 for(sa_size_t j=0; j<vx.Size(); j++) 155 vx(j) = (r_4)(*(paq.Data1()+j))-127.5; 159 if (fghist_) { 160 for(sa_size_t j=0; j<vx.Size(); j++) { 161 r_4 vts=(r_4)(*(paq.Data1()+j)); 162 h1.Add((r_8)vts); 163 vx(j) = vts-127.5; 164 } 165 } 166 else { 167 for(sa_size_t j=0; j<vx.Size(); j++) 168 vx(j) = (r_4)(*(paq.Data1()+j))-127.5; 169 } 156 170 // fftwf_complex* coeff1 = (fftwf_complex*)(procbuff+i*procpaqsz); 157 171 fftwf_execute(plan1); … … 162 176 memcpy(procbuff+i*procpaqsz, cfour1.Data(), sizeof(complex<r_4>)*cfour1.Size()); 163 177 // Traitement voie 2 164 for(sa_size_t j=0; j<vx.Size(); j++) 165 vx(j) = (r_4)(*(paq.Data2()+j))-127.5; 166 178 if (fghist_) { 179 for(sa_size_t j=0; j<vx.Size(); j++) { 180 r_4 vts=(r_4)(*(paq.Data2()+j)); 181 h2.Add((r_8)vts); 182 vx(j) = vts-127.5; 183 } 184 } 185 else { 186 for(sa_size_t j=0; j<vx.Size(); j++) 187 vx(j) = (r_4)(*(paq.Data2()+j))-127.5; 188 } 167 189 fftwf_execute(plan2); 168 190 for(sa_size_t j=0; j<spectreV2.Size(); j++) … … 225 247 spectreV2.Info()["EndTT"] = curtt; 226 248 visiV12.Info()["EndTT"] = curtt; 227 249 { 228 250 sprintf(fname,"%s_%d.ppf",path_.c_str(),(int)ifile); 229 251 POutPersist po(fname); … … 231 253 string tag2="specV2"; 232 254 string tag12="visiV12"; 255 string tagh1="tshV1"; 256 string tagh2="tshV2"; 233 257 if (card_==2) { 234 258 tag1 = "specV3"; 235 259 tag2 = "specV4"; 260 tagh1 = "tshV1"; 261 tagh2 = "tshV2"; 236 262 tag12="visiV34"; 237 263 } … … 239 265 po << PPFNameTag(tag2) << spectreV2; 240 266 po << PPFNameTag(tag12) << visiV12; 241 } 267 if (fghist_) { 268 po << PPFNameTag(tagh1) << h1; 269 po << PPFNameTag(tagh2) << h2; 270 } 271 } 242 272 spectreV1 = (r_4)(0.); 243 273 spectreV2 = (r_4)(0.); 244 274 visiV12 = complex<r_4>(0., 0.); 275 if (fghist_) { 276 h1.Zero(); 277 h2.Zero(); 278 } 245 279 nzm = 0; ifile++; 246 280 // ts.SetNow(); -
trunk/AddOn/TAcq/brproc.h
r3645 r3652 23 23 // Classe thread de traitement avec 2 voies par frame (donnees brutes) 24 24 //--------------------------------------------------------------------- 25 26 /*-- Arguments du constructeur : 27 o mem : gestionnaire zones memoires avec contenant les "frames" avec 2 voies/frame 28 o path : Chemin et nom des fichiers PPF produits (on ajoute _numero.ppf ) 29 o nmean : Nombre de frame (paquets) moyennes 30 o nmax : Nombre maxi de frames traites 31 o fghist = true -> fait aussi l'histo des valeurs des echantillons temps 32 o fgnotrl = true -> fichiers fits / paquets sans trailer 33 o card : numero de carte , juste pour les impressions 34 */ 25 35 class BRProcARaw2C : public ZThread { 26 36 public: 27 37 BRProcARaw2C(RAcqMemZoneMgr& mem, string& path, uint_4 nmean=10, 28 uint_4 nmax=100, bool fg notrl=false, int card=1);38 uint_4 nmax=100, bool fgtshist=false, bool fgnotrl=false, int card=1); 29 39 virtual void run(); 30 40 void Stop(); … … 36 46 uint_4 nmean_; // Nombre de blocs pour le calcul des moyennes 37 47 string path_; 48 bool fghist_; // if true, fill and save histogram with time sample values 38 49 bool fgnotrl_; // if true, don't check packet trailer - when using pre-june fits files 39 50 int card_; // Numeros de voies 2*card_-1, 2*card_ … … 43 54 // Classe thread de traitement 2 x 2 voies/frames (Apres BRProcARaw2C) 44 55 //--------------------------------------------------------------------- 56 /*-- Arguments du constructeur : 57 o mem1,mem2 : gestionnairea zones memoires avec contenant les donnees des 4 voies (2 voies/frame) 58 o path : Chemin et nom des fichiers PPF produits (on ajoute _numero.ppf ) 59 o nmean : Nombre de frame (paquets) moyennes 60 o nmax : Nombre maxi de frames traites 61 o fgnotrl = true -> fichiers fits / paquets sans trailer 62 o card : numero de carte , juste pour les impressions 63 */ 64 45 65 class BRProcBRaw4C : public ZThread { 46 66 public: -
trunk/AddOn/TAcq/mcrd.cc
r3650 r3652 61 61 static int GPaqSz=16424; 62 62 static double LossRate=0.1; 63 64 static bool fg4c=false; // true -> 4 channels (2 fibers) 65 static bool fgrdfits=true; // false -> Don't read fits files, generate paquets 66 static bool fgnotrl=false; // true -> fichier fits SANS Trailer de frame (< mai 2009) 67 static bool fghist=false; // true -> histo des valeurs des time sample 68 63 69 // ---- 64 70 int Usage(bool fgshort=true); 65 71 // Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW) 66 int Proc1FRawA(string& outname, string& inpath, int jf1, int jf2, bool fgnotrl=false, 67 bool fgrdfile=true); 72 int Proc1FRawA(string& outname, string& inpath, int jf1, int jf2); 68 73 // Pour traitement (calcul FFT et visibilites (ProcA,ProcB) 2 fibre, 4 voies RAW) 69 int Proc2FRawAB(string& outname, string& path1, string& path2, int jf1, int jf2, 70 bool fgnotrl=false, bool fgrdfile=true); 74 int Proc2FRawAB(string& outname, string& path1, string& path2, int jf1, int jf2); 71 75 72 76 //---------------------------------------------------- … … 82 86 try { 83 87 string act = arg[1]; 84 bool fg4c=false; // true -> 4 channels (2 fibers) 85 bool fgrdfits=true; // false -> Don't read fits files, generate paquets 86 bool fgnotrl=false; // true -> fichier fits SANS Trailer de frame (< mai 2009) 88 fg4c=false; // true -> 4 channels (2 fibers) 89 fgrdfits=true; // false -> Don't read fits files, generate paquets 90 fgnotrl=false; // true -> fichier fits SANS Trailer de frame (< mai 2009) 91 fghist=false; // true -> histo des valeurs des time sample 87 92 if (act.substr(0,2)=="-4") fg4c=true; 88 if (act.substr(2)=="g") fgrdfits=false; 89 else if (act.substr(2)=="nt") fgnotrl=true; 93 if (act.length()>2) { 94 for(size_t ks=2; ks<act.length(); ks++) { 95 if(act[ks]=='g') fgrdfits=false; 96 else if(act[ks]=='n') fgnotrl=true; 97 else if(act[ks]=='h') fghist=true; 98 } 99 } 90 100 if (fg4c && (narg<6)) return Usage(true); 91 101 … … 107 117 ResourceUsage resu; 108 118 if (fg4c) 109 rc = Proc2FRawAB(outname, inpath, inpath2, imin, imax , fgnotrl, fgrdfits);119 rc = Proc2FRawAB(outname, inpath, inpath2, imin, imax); 110 120 else 111 rc = Proc1FRawA(outname, inpath, imin, imax , fgnotrl, fgrdfits);121 rc = Proc1FRawA(outname, inpath, imin, imax); 112 122 cout << resu ; 113 123 } … … 135 145 136 146 // Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW) 137 int Proc1FRawA(string& outname, string& inpath, int imin, int imax, 138 bool fgnotrl, bool fgrdfile) 147 int Proc1FRawA(string& outname, string& inpath, int imin, int imax) 139 148 { 140 149 vector<string> infiles; … … 146 155 uint_4 nmaxz; 147 156 uint_4 paqsz, npaqf; 148 if (fgrdfi le) {157 if (fgrdfits) { 149 158 DecodeMiniFitsHeader(infiles[0],paqsz, npaqf, fgnotrl); 150 159 nmaxz = infiles.size()*npaqf/NPaqinZone; … … 167 176 168 177 outname += "/Ch12"; 169 BRProcARaw2C proc(mmgr, outname, NMean, nmaxz, fg notrl);178 BRProcARaw2C proc(mmgr, outname, NMean, nmaxz, fghist, fgnotrl); 170 179 171 180 cout << " mcrd/Proc1FRawA: Starting threads (reader, proc) ... " << endl; 172 181 173 if (fgrdfi le) reader.start();182 if (fgrdfits) reader.start(); 174 183 else pcird.start(); 175 184 … … 177 186 sleep(1); 178 187 cout << " mcrd/Proc1FRawA: Waiting for reader thread to finish ... " << endl; 179 if (fgrdfi le) reader.join();188 if (fgrdfits) reader.join(); 180 189 else pcird.join(); 181 190 cout << " mcrd/Proc1FRawA: Reader finished, waiting for process thread to finish ... " << endl; … … 189 198 190 199 // Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW) 191 int Proc2FRawAB(string& outname, string& path1, string& path2, int imin, int imax, 192 bool fgnotrl, bool fgrdfile) 200 int Proc2FRawAB(string& outname, string& path1, string& path2, int imin, int imax) 193 201 { 194 202 vector<string> infiles1; … … 203 211 uint_4 nmaxz; 204 212 uint_4 paqsz, npaqf; 205 if (fgrdfi le) {213 if (fgrdfits) { 206 214 DecodeMiniFitsHeader(infiles1[0],paqsz, npaqf, fgnotrl); 207 215 nmaxz = infiles1.size()*npaqf/NPaqinZone; … … 235 243 string outname1 = outname; 236 244 outname1 += "/Ch12"; 237 BRProcARaw2C proc1(mmgr1, outname1, NMean, nmaxz, fg notrl);245 BRProcARaw2C proc1(mmgr1, outname1, NMean, nmaxz, fghist, fgnotrl); 238 246 string outname2 = outname; 239 247 outname2 += "/Ch34"; 240 BRProcARaw2C proc2(mmgr2, outname2, NMean, nmaxz, fg notrl,2);248 BRProcARaw2C proc2(mmgr2, outname2, NMean, nmaxz, fghist, fgnotrl,2); 241 249 string outname12 = outname; 242 250 outname12 += "/Ch1234"; … … 245 253 cout << " mcrd/Proc2FRawAB: Starting threads (reader1,2, procA1,2, procAB) ... " << endl; 246 254 // cout << "[1]--- CR to continue ..." << endl; char ans[32]; gets(ans); 247 if (fgrdfi le) {255 if (fgrdfits) { 248 256 reader1.start(); 249 257 reader2.start(); … … 260 268 sleep(1); 261 269 cout << " mcrd/Proc2FRawAB: Waiting for reader threads to finish ... " << endl; 262 if (fgrdfi le) {270 if (fgrdfits) { 263 271 reader1.join(); 264 272 reader2.join(); … … 291 299 return 1; 292 300 } 293 cout << " ACT= -2 , -2g , -2nt -> 1 fiber, 2 raw channel processing (ProcA)\n" 294 << " ACT= -4 , -4g , -4g , -4nt -> 2 fibers, 4 raw channels (ProcA, ProcB)\n" 295 << " nt (notrl) -> FITS files without frame trailer \n" 296 << " g (generate paquets) -> generate paquets instead of reading fits files" <<endl; 301 cout << " ACT= -2[ghn] -> 1 fiber, 2 raw channel processing (ProcA)\n" 302 << " ACT= -4[ghn] -> 2 fibers, 4 raw channels (ProcA, ProcB)\n" 303 << " n (notrl) -> FITS files without frame trailer \n" 304 << " g (generate paquets) -> generate paquets instead of reading fits files\n" 305 << " h (time sample histograms) -> compute time sample histograms also \n" 306 << " Example: ACT = -2h 1 fiber, 2 raw channels and compute time sample histograms" <<endl; 297 307 cout << " OutPath : Output directory name " << endl; 298 308 cout << " InPath [InPath2] Imin,Imax: Input fits files directory name(s)\n"
Note:
See TracChangeset
for help on using the changeset viewer.