Changeset 3635 in Sophya for trunk/AddOn
- Timestamp:
- May 26, 2009, 5:05:44 PM (16 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/README
r3560 r3635 49 49 serverName : Name or IP adress of the machine where tsok S is running 50 50 NLoop,SizeX,SizeY: Number of transfers, 2D array size for OPEMsg=PPFSOCKET 51 52 53 6/ --- Avril 2009 54 Amelioration programme mfits2spec 55 --- Mai 2009 56 o Amelioration du programme tmtacq.cc (+/- copie programme d'acquisition) 57 o Introduction du programme de lecture / traitement multi-thread des fichiers 58 minifits acquisition 59 Ajout fichiers : mcrd.cc , brfitsrd.h .cc , brproc.h .cc -
trunk/AddOn/TAcq/brpaqu.h
r3623 r3635 141 141 inline UInt32 TimeTag1() {return *((UInt32*)(dst_+(BRTMTAGOFF+OFFSET)));} 142 142 inline UInt32 TimeTag2() {return (*((UInt32*)(dst_+(BRFRCPTOFF+OFFSET))) &0xFFFF);} 143 inline UInt64 TimeTag() {return (*((UInt64*)(dst_+(BRTMTAGOFF+OFFSET))) &0x0000FFFFFFFFFFFF LL);}143 inline UInt64 TimeTag() {return (*((UInt64*)(dst_+(BRTMTAGOFF+OFFSET))) &0x0000FFFFFFFFFFFFULL);} 144 144 145 145 inline UInt32 PaqId() {return *((UInt32*)(dst_+(BRPKTIDOFF+OFFSET)));} -
trunk/AddOn/TAcq/makefile
r3623 r3635 2 2 3 3 # all : traidio tmtfft tstminifits tbrpaq tpciew tmtacq tstrdfits mfits2spec tsok 4 all : traidio tmtfft tstminifits tmtacq tstrdfits mfits2spec tsok 4 all : traidio tmtfft tstminifits tmtacq tstrdfits mfits2spec tsok mcrd 5 5 6 6 clean : 7 rm *.o traidio tmtfft tstminifits tpciew tbrpaq tmtacq tstrdfits mfits2spec 7 rm *.o traidio tmtfft tstminifits tpciew tbrpaq tmtacq tstrdfits mfits2spec mcrd 8 8 rm mfits2spec tsok *.ppf *.fits 9 9 … … 25 25 racquproc.o : racquproc.cc racquproc.h racqurw.h racqumem.h 26 26 $(CXXCOMPILE) -c -o racquproc.o racquproc.cc 27 28 ## Lecture / traitement minifits multi-thread 29 ## -------------- 30 mcrd : mcrd.o racqumem.o brfitsrd.o brproc.o racquproc.o brpaqu.o pciewrap.o minifits.o 31 $(CXXLINK) -o mcrd mcrd.o racqumem.o brfitsrd.o brproc.o racquproc.o brpaqu.o minifits.o $(SOPHYAALLSLBLIST) 32 33 mcrd.o : mcrd.cc brfitsrd.h racqumem.h brproc.h 34 $(CXXCOMPILE) -c -o mcrd.o mcrd.cc 35 36 brfitsrd.o : brfitsrd.cc brfitsrd.h racqumem.h 37 $(CXXCOMPILE) -c -o brfitsrd.o brfitsrd.cc 38 39 brproc.o : brproc.cc brproc.h racqumem.h 40 $(CXXCOMPILE) -c -o brproc.o brproc.cc 41 27 42 28 43 ## -------------- -
trunk/AddOn/TAcq/mfits2spec.cc
r3610 r3635 45 45 int ana_data_0(vector<string>& infiles, string& outfile); 46 46 // Fonction d'analyse 2eme version , 1 voie / paquet 47 int ana_data_1(vector<string>& infiles, string& oufile );47 int ana_data_1(vector<string>& infiles, string& oufile, bool fgnotrl=false); 48 48 // Fonction d'analyse 2eme version , 2 voies / paquet 49 int ana_data_2(vector<string>& infiles, string& oufile );49 int ana_data_2(vector<string>& infiles, string& oufile, bool fgnotrl=false); 50 50 // Fonction d'analyse 2eme version , 2 voies / paquet 51 int ana_data_fft_2(vector<string>& infiles, string& oufile );51 int ana_data_fft_2(vector<string>& infiles, string& oufile, bool fgnotrl=false); 52 52 53 53 //---------------------------------------------------- … … 59 59 cout << " Usage: mfits2spec ACT OutPPF file1 [file2 file3 ...] " << endl; 60 60 cout << " Or : mfits2spec ACT OutPPF -infits DirName Imin Imax " << endl; 61 cout << " ACT=-0,-1,-2,-fft2 \n"61 cout << " ACT=-0,-1,-2,-fft2 , -1nt -2nt -fft2nt \n" 62 62 << " -0: Nancay-July2008 \n" 63 63 << " -1,-2 : Raw data 1 ou 2 channels / packet(or frame) \n" 64 << " -fft2 : FFT data 2 channels / packet " << endl; 64 << " -fft2 : FFT data 2 channels / packet \n" 65 << " nt : (-1nt -2nt -fft2nt) fits files without frame trailer " << endl; 65 66 cout << " OutPPF : Output PPF file name " << endl; 66 67 cout << " file1,file2 ... : Input FITS files " << endl; … … 96 97 cout << " ---------- mfits2spec.cc Start - ACT= " << act << " ------------- " << endl; 97 98 ResourceUsage resu; 99 bool fgnotrl=false; // fichier fits avec Trailer de frame (> mai 2009) 100 if ((act=="-1nt")||(act=="-2nt")||(act=="-fft2nt")) fgnotrl=true; // fichier fits SANS trailer 101 98 102 if (act == "-0") ana_data_0(infiles, outppf); 99 else if ( act == "-1") ana_data_1(infiles, outppf);100 else if ( act == "-2") ana_data_2(infiles, outppf);101 else if ( act == "-fft2") ana_data_fft_2(infiles, outppf);103 else if ((act == "-1")||(act=="-1nt")) ana_data_1(infiles, outppf, fgnotrl); 104 else if ((act == "-2")||(act=="-2nt")) ana_data_2(infiles, outppf, fgnotrl); 105 else if ((act == "-fft2")||(act=="-fft2nt")) ana_data_fft_2(infiles, outppf, fgnotrl); 102 106 else cout << " mfits2spec.cc / Bad argument ACT=" << act << " -> exit" << endl; 103 107 cout << resu ; … … 177 181 178 182 /*--Nouvelle-Fonction--*/ 179 int ana_data_1(vector<string>& infiles, string& outfile )183 int ana_data_1(vector<string>& infiles, string& outfile, bool fgnotrl) 180 184 // Calcul spectre moyen 1 voie, donnees brutes 181 185 { … … 202 206 continue; 203 207 } 204 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ... 208 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true 209 int incpaqsz=0; 210 if (fgnotrl) { 211 incpaqsz=16; 212 cout << " Warning : FITS files without frame trailers ..." << endl; 213 } 205 214 if (paqsz == 0) { // premier passage, on fixe la taille de paquet et on alloue le buffer 206 paqsz = mff.NAxis1()+ 16;215 paqsz = mff.NAxis1()+incpaqsz; 207 216 data = new Byte[paqsz]; 208 217 for(int ib=0; ib<paqsz; ib++) data[ib]=0; 209 218 } 210 219 else { 211 if (paqsz != mff.NAxis1()+ 16) {212 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+ 16--> skipping " << endl;220 if (paqsz != mff.NAxis1()+incpaqsz) { 221 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl; 213 222 continue; 214 223 } … … 257 266 258 267 /*--Nouvelle-Fonction--*/ 259 int ana_data_2(vector<string>& infiles, string& outfile )268 int ana_data_2(vector<string>& infiles, string& outfile, bool fgnotrl) 260 269 // Calcul spectres moyens 2 voies, donnees brutes 261 270 { … … 284 293 continue; 285 294 } 286 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ... 295 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true 296 int incpaqsz=0; 297 if (fgnotrl) { 298 incpaqsz=16; 299 cout << " Warning : FITS files without frame trailers ..." << endl; 300 } 287 301 if (paqsz == 0) { // premier passage, on fixe la taille de paquet et on alloue le buffer 288 paqsz = mff.NAxis1()+ 16;302 paqsz = mff.NAxis1()+incpaqsz; 289 303 cout << " ana_data_2/ Allocating data , PaqSz=" << paqsz << endl; 290 304 data = new Byte[paqsz]; … … 292 306 } 293 307 else { 294 if (paqsz != mff.NAxis1()+ 16) {295 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+ 16--> skipping " << endl;308 if (paqsz != mff.NAxis1()+incpaqsz) { 309 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl; 296 310 continue; 297 311 } … … 359 373 360 374 /*--Nouvelle-Fonction--*/ 361 int ana_data_fft_2(vector<string>& infiles, string& outfile )375 int ana_data_fft_2(vector<string>& infiles, string& outfile, bool fgnotrl) 362 376 // Calcul spectres moyens 2 voies, donnees brutes 363 377 { … … 385 399 continue; 386 400 } 387 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) ... 401 // Les fichier FITS contiennent l'entet (24 bytes), mais pas le trailer (16 bytes) si fgnotrl=true 402 int incpaqsz=0; 403 if (fgnotrl) { 404 incpaqsz=16; 405 cout << " Warning : FITS files without frame trailers ..." << endl; 406 } 388 407 if (paqsz == 0) { // premier passage, on fixe la taille de paquet et on alloue le buffer 389 paqsz = mff.NAxis1()+ 16;408 paqsz = mff.NAxis1()+incpaqsz; 390 409 cout << " ana_data_fft_2/ Allocating data , PaqSz=" << paqsz << endl; 391 410 data = new Byte[paqsz]; … … 393 412 } 394 413 else { 395 if (paqsz != mff.NAxis1()+ 16) {396 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+ 16--> skipping " << endl;414 if (paqsz != mff.NAxis1()+incpaqsz) { 415 cout << " PB : paqsz=" << paqsz << " != mff.NAxis1()+" << incpaqsz << " --> skipping " << endl; 397 416 continue; 398 417 } -
trunk/AddOn/TAcq/racqumem.cc
r3626 r3635 7 7 8 8 /* --Methode-- */ 9 RAcqMemZoneMgr::RAcqMemZoneMgr(uint_4 nz, uint_4 np, uint_4 psz )10 : mex(true), nzones(nz), npaq(np), paqsz(psz), stop_(false)9 RAcqMemZoneMgr::RAcqMemZoneMgr(uint_4 nz, uint_4 np, uint_4 psz, uint_4 procpsz) 10 : mex(true), nzones(nz), npaq(np), paqsz(psz), procpaqsz(procpsz),stop_(false) 11 11 { 12 12 St_MemZ st; … … 17 17 for(int k=0; k<6; k++) st.nbact[k] = 0; 18 18 uint_8 mzsz = npaq*paqsz; 19 uint_8 procmzsz = npaq*procpaqsz; 19 20 20 21 for(int k=0; k<NbZones(); k++) { 21 22 memzones.push_back(new Byte[mzsz] ); 22 23 states.push_back(st); 24 if (procmzsz > 0) procmemzones.push_back(new Byte[procmzsz] ); 23 25 } 24 26 serial_ = 0; … … 43 45 int rid = -1; 44 46 if (stop_) return rid; 45 if ((act != MemZA_Fill) && (act != MemZA_Save) && (act != MemZA_Proc)) return rid; 47 if ((act != MemZA_Fill) && (act != MemZA_Save) && (act != MemZA_Proc) && 48 (act != MemZA_ProcA) && (act != MemZA_ProcB) && (act != MemZA_ProcC)) return rid; 46 49 mex.lock(); 47 50 uint_8 bestserial = serial_ + 5; … … 184 187 os << "RAcqMemZoneMgr::Print() NbZones=" << NbZones() << " PaqSize()=" << PaqSize() 185 188 << " NbPaquets()=" << NbPaquets() << " ZoneSize()=" << ZoneSize() << endl; 189 if (ProcPaqSize() > 0) 190 cout << " ... With Processed Data Zones ProcPaqSize()=" << ProcPaqSize() 191 << " ProcZoneSize()=" << ProcZoneSize() << endl; 192 else cout << " ... NO Processed Data Zones" << endl; 186 193 for(uint_4 k=0; k<states.size(); k++) 187 194 os << " [" << k << "] Act=" << states[k].act << " Stat=" << states[k].stat -
trunk/AddOn/TAcq/racqumem.h
r3629 r3635 47 47 public: 48 48 // Constructeur, nz=Nb de zones, np=Nb de paquets/zone , psz=taille de paquet 49 RAcqMemZoneMgr(uint_4 nz, uint_4 np=256, uint_4 psz=4096); 49 // Si procpsz>0 , on alloue aussi des zones memoire pour donnees traitees 50 // dans ce cas, procpsz à la taille memoire des donnees traites pour chaque paquet 51 RAcqMemZoneMgr(uint_4 nz, uint_4 np=256, uint_4 psz=4096, uint_4 procpsz=0); 50 52 ~RAcqMemZoneMgr(); 51 53 … … 58 60 // Retourne la taille totale d'une zone 59 61 inline uint_4 ZoneSize() { return npaq*paqsz; } 62 63 // Retourne la taille de la zone memoire correspondant aux donnees traitees d'un paquet 64 inline uint_4 ProcPaqSize() { return procpaqsz; } 65 // Retourne la taille totale d'une zone de donnees traitees 66 inline uint_4 ProcZoneSize() { return npaq*procpaqsz; } 60 67 61 68 // Definit l'etat des operations obligatoires avant qu'une zone … … 74 81 return memzones[id]; 75 82 } 83 inline Byte* GetProcMemZone(int id) { 84 if ((id < 0) || (id >=(int) procmemzones.size())) return NULL; 85 return procmemzones[id]; 86 } 76 87 77 88 ostream& Print(ostream& os); … … 81 92 // ... variables membres 82 93 ZMutex mex; 83 uint_4 nzones, npaq, paqsz ;94 uint_4 nzones, npaq, paqsz, procpaqsz; 84 95 // DMAMgrInterface &dma_; 85 96 vector< Byte* > memzones; 86 97 vector< St_MemZ > states; 98 vector< Byte* > procmemzones; 87 99 bool stop_; 88 100 uint_4 mask_finalized_; -
trunk/AddOn/TAcq/racquproc.cc
r3634 r3635 42 42 } 43 43 44 inline r_4 Zmod2(complex<r_4> z)44 static inline r_4 Zmod2(complex<r_4> z) 45 45 { return (z.real()*z.real()+z.imag()*z.imag()); } 46 46 -
trunk/AddOn/TAcq/racqurw.cc
r3628 r3635 274 274 275 275 if (savesig_) // Reza - Ecriture conditionnel fichier fits signal 276 mff.WriteB(paq.Header(),paq.PaquetSize()); // ecriture tout le paquet (modif Mai 2009 276 277 // mff.WriteB(paq.Data1(), paq.DataSize()); 277 278 mff.WriteB(paq.Header(),paq.DataSize()+paq.HeaderSize()); // ecriture datas + header
Note:
See TracChangeset
for help on using the changeset viewer.