Changeset 3940 in Sophya for trunk/AddOn/TAcq
- Timestamp:
- Jan 24, 2011, 5:02:54 PM (15 years ago)
- Location:
- trunk/AddOn/TAcq
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/chanum_1210.cc
r3935 r3940 32 32 <<" -f F0MHz : 1ere frequence pour cette acquisition (def=0.)"<<endl 33 33 <<" -F if0,if1,idf : selection freq de if0 a if1 moyenne par idf (def=\"0,8888,1\")"<<endl 34 <<" -T it0,it1 : selection fichier temps de it0 a it1 (def=\"0,99999 9\")"<<endl34 <<" -T it0,it1 : selection fichier temps de it0 a it1 (def=\"0,99999\")"<<endl 35 35 <<" -o fichier.csh : nom du fichier de sortie pour les commandes a lancer"<<endl; 36 36 } … … 40 40 { 41 41 string outname = "chanum_1210.csh"; 42 string selfreq = "0,8888,1", seltime = "0,99999 9";42 string selfreq = "0,8888,1", seltime = "0,99999"; 43 43 double freq0 = 0.; 44 44 … … 102 102 ofstream ftxt(outname.c_str(), ofstream::out); 103 103 cout<<"writing in "<<outname<<" (is_open="<<ftxt.is_open()<<")"<<endl; 104 if(!ftxt) {cout<<"!!!!OPENING failed "<<outname<<endl; return -3;} 104 105 ftxt << "#!/bin/csh" <<endl; 105 if(!ftxt) {cout<<"!!!!OPENING failed "<<outname<<endl; return -3;}106 106 int dupli = 0, ndupli = 0; 107 107 nvisi = 0; 108 108 for(uint_4 i=0;i<vcode.size();i++) { 109 109 char str[512]; 110 sprintf(str," ${TACQEXE}/svv2mtx2_1210 -f %.7f -T %s -F %s"110 sprintf(str,"time ${TACQEXE}/svv2mtx2_1210 -f %.7f -T %s -F %s" 111 111 ,freq0,seltime.c_str(),selfreq.c_str()); 112 112 string argu = str; … … 115 115 uint_4 vcode_suiv = (i<vcode.size()-1) ? vcode[IVcode(i+1)]: 99999999; 116 116 uint_4 v1 = vcode[ip]/1000, v2 = vcode[ip]%100; 117 sprintf(str," -v %d,%d",v1,v2); argu += str; // numero de canaux acq [1,32] 117 118 sprintf(str," -t %d",vnth[ip]); argu += str; // numero de threads 118 119 sprintf(str," -r %d",vrow[ip]); argu += str; // ligne de la matrice acq -
trunk/AddOn/TAcq/svv2mtx2_1210.cc
r3937 r3940 11 11 #include <unistd.h> 12 12 #include <sys/stat.h> 13 #include <fstream> 13 14 #include <iostream> 14 15 #include <string> … … 17 18 #include "tvector.h" 18 19 #include "fioarr.h" 20 #include "timing.h" 19 21 20 22 /* 21 23 export TACQEXE=~/Reza/TAcq/Objs 22 ./CasA02Dec.csh > CasA02Dec.log 2>&123 ./Crab03Dec.csh > Crab03Dec.log 2>&124 ./Sun03Dec.csh > Sun03Dec.log 2>&125 24 ./CasA03Dec.csh > CasA03Dec.log 2>&1 26 25 */ … … 32 31 cout<<"svv2mtx2_1012 [options] dir : lecture des fichiers acq de Pittsburgh Dec 2010"<<endl 33 32 <<" dir : repertoire ou se trouvent les fichiers d'acq"<<endl 34 <<" -C : compute and store the complexe conjugated visi"<<endl35 33 <<" -D : visi is a duplicated one"<<endl 36 34 <<" -o visi.ppf : nom du ficher ppf pour ecrire la visi temps-frequence"<<endl 35 <<" -v v1,v2 : numero de voie acq pour cette visi [1-32]"<<endl 36 <<" on calcule <v1.conj(v2)>"<<endl 37 <<" -C : compute and store the complexe conjugated visi"<<endl 38 <<" dans ce cas on calcule <v2.conj(v1)>, le but est d'avoir toujours <E.conj(W)>"<<endl 37 39 <<" -t thr : numero de la thread ayant traite cette visi [0-N]"<<endl 38 40 <<" -r row : numero de la ligne de la matrice acq pour cette visi [0-Nrow["<<endl … … 47 49 { 48 50 // --- Decodage des arguments et traitement 51 int nmiss_stop = 1000; // on s'arrete si on a "nmiss_stop" fichiers consecutifs manquants 49 52 string outname = ""; 50 53 int numthread = -1, numrow = -1; 51 54 bool dupli = false, doconj = false; 52 55 double freq0 = 0.; 56 int vacq1=-1, vacq2=-1; 53 57 int ifilmin=0, ifilmax=99999; 54 58 int jfr1=0, jfr2=-1, ngrpfreq=1; 55 char str[2048];56 59 57 60 char c; 58 while((c = getopt(narg,arg,"hDCo:t:r:f:T:F: ")) != -1) {61 while((c = getopt(narg,arg,"hDCo:t:r:f:T:F:v:")) != -1) { 59 62 switch (c) { 63 case 'v' : 64 sscanf(optarg,"%d,%d",&vacq1,&vacq2); 65 break; 60 66 case 'D' : 61 67 dupli = true; … … 92 98 string indir = arg[optind]; 93 99 100 cout<<"v1="<<vacq1<<" v2="<<vacq2<<" doconj="<<(int)doconj<<endl; 94 101 cout<<"thread="<<numthread<<endl; if(numthread<0) return -2; 95 102 cout<<"numrow="<<numrow<<endl; if(numrow<0) return -2; 96 103 cout<<"dupli="<<(int)dupli<<endl; 97 cout<<"doconj="<<(int)doconj<<endl;98 104 cout<<"outname="<<outname<<endl; if(outname.size()<=0) return -2; 99 105 cout<<"indir="<<indir<<endl; … … 102 108 cout<<"request: freq "<<jfr1<<" to "<<jfr2<<" grouped by "<<ngrpfreq<<endl; 103 109 110 InitTim(); 111 104 112 // --- recherche et comptage des fichiers de visibilites 105 113 // ATTENTION: il peut manquer des fichiers au debut ou dans la sequence 106 str uct stat buffer;114 string flistname = outname; flistname += ".filelist"; 107 115 int nfile = 0; 108 116 { 117 ofstream flistw(flistname.c_str(), ofstream::out); 118 cout<<"writing in file list in: "<<flistname<<" (is_open="<<flistw.is_open()<<")"<<endl; 119 if(!flistw) {cout<<"!!!!OPEN failed "<<flistname<<endl; return -4;} 120 121 char str[4096]; 122 struct stat buffer; 109 123 int ifmin2 = ifilmin, ifmax2 = ifilmax; ifilmax = -1; 110 124 bool foundfirst = false; 125 int nmiss = 0; 111 126 for(int ifile=ifmin2; ifile<=ifmax2; ifile++) { 112 127 sprintf(str, "%s/vismtx_%d_%d.ppf",indir.c_str(),numthread,ifile); … … 119 134 if(!foundfirst) continue; 120 135 if(ifile<ifilmin) continue; 121 if(foundfirst && status!=0) continue; 136 if(foundfirst && status!=0) { 137 // On fait ca car "stst()" est extremement long si le fichier n'existe pas! 138 if(nmiss>nmiss_stop) break; 139 nmiss++; 140 continue; 141 } 122 142 nfile++; 123 143 ifilmax = ifile; 124 } 144 nmiss = 0; 145 flistw << string(str) <<endl; 146 } 147 148 flistw.close(); 125 149 cout<<"Found "<<nfile<<" files from "<<ifilmin<<" to "<<ifilmax<<endl; 126 if(nfile==0 || ifilmax<ifilmin) return -4; 127 } 128 150 if(nfile==0 || ifilmax<ifilmin) return -5; 151 } 152 153 PrtTim("--- End of file number search"); 129 154 130 155 //-------------------------------------------------------------------- 131 156 int rc = 0; 132 157 try { 158 159 ifstream flistr(flistname.c_str(), ofstream::in); 160 if(!flistr) {cout<<"!!!!OPEN failed "<<flistname<<endl; return -6;} 133 161 134 162 // --- read visibility files … … 140 168 double tudeb_day, tufin_day; 141 169 int nfreq = 0; 142 int lpmod = nfile/ 10; if(lpmod<=0) lpmod=1;170 int lpmod = nfile/25; if(lpmod<=0) lpmod=1; 143 171 144 172 int_4 ntimefill = 0, ntimebad = 0; 145 for(int ifile=ifilmin; ifile<=ifilmax; ifile++) {146 173 bool foundfirst = true; 174 while(!flistr.eof()) { 147 175 // --- Lecture d'une visi elementaire (fichier acq) 148 sprintf(str, "%s/vismtx_%d_%d.ppf",indir.c_str(),numthread,ifile); 149 int status = stat(str,&buffer); 150 if(status) continue; // fichier inexistant 151 if(ifile==ifilmin || ifile==ifilmax || (ifile-ifilmin)%lpmod==0) 152 cout<<ntimefill<<" "<<ifile<<" opening: "<<str<<endl; 176 string fname; 177 getline(flistr,fname); 178 if(fname.size()==0) continue; 179 if(ntimefill%lpmod==0) cout<<ntimefill<<" "<<" : "<<fname<<endl; 153 180 TMatrix< complex<r_4> > vismtx; 154 181 try { 155 PInPersist pin( str);182 PInPersist pin(fname); 156 183 pin >> vismtx; 157 184 } catch(...) { 158 cout<<"ERROR: bad file "<< str<<endl;185 cout<<"ERROR: bad file "<<fname<<endl; 159 186 ntimebad++; 160 187 continue; … … 167 194 168 195 // --- Initialisation purposes for the first read file 169 if (ifile==ifilmin) {170 196 if(foundfirst) { 197 foundfirst = false; 171 198 tudeb = tufin; 172 199 printf("Reference Time: tt = %.5f sec, TU = %s\n",MeanTT(0),tudeb.c_str()); … … 223 250 } // fin boucle sur le fichiers d'acq 224 251 cout<<"ntimefill = "<<ntimefill<<" / "<<nfile<<" , ntimebad="<<ntimebad<<" bad files"<<endl; 252 flistr.close(); 253 string order = "rm -f "; order += flistname; 254 system(order.c_str()); 225 255 226 256 // --- keeping info with visi … … 233 263 tufin_day = (double)d + ((double)h + mn/60. + s/3600.)/24.; 234 264 } 235 MVisi.Info()["nth"] = numthread; 236 MVisi.Info()["row"] = numrow; 237 MVisi.Info()["dir"] = indir; 238 MVisi.Info()["dupli"] = (dupli) ? 1: 0; 239 MVisi.Info()["isconj"] = (doconj) ? 1: 0; 240 MVisi.Info()["TUobs_0"] = tudeb; 241 MVisi.Info()["TUobs_N"] = tufin; 242 MVisi.Info()["TUday_0"] = tudeb_day; 243 MVisi.Info()["TUday_N"] = tufin_day; 244 MVisi.Info()["TTag_0"] = MeanTT(0); 245 if(ntimefill>0) MVisi.Info()["TTag_N"] = MeanTT(ntimefill-1); 246 MVisi.Info()["freq0"] = freq0; 247 MVisi.Info()["dfreq0"] = 500./8192.; 248 MVisi.Info()["jfr1"] = jfr1; 249 MVisi.Info()["jfr2"] = jfr2; 250 MVisi.Info()["ngrpfreq"] = ngrpfreq; 251 MVisi.Info()["ifilmin"] = ifilmin; 252 MVisi.Info()["ifilmax"] = ifilmax; 253 MVisi.Info()["ntimefill"] = ntimefill; 254 MVisi.Info()["ntimebad"] = ntimebad; 265 DVList dvl; 266 dvl["vacq1"] = vacq1; 267 dvl["vacq2"] = vacq2; 268 dvl["nth"] = numthread; 269 dvl["row"] = numrow; 270 dvl["dir"] = indir; 271 dvl["dupli"] = (dupli) ? 1: 0; 272 dvl["isconj"] = (doconj) ? 1: 0; 273 dvl["TUobs_0"] = tudeb; 274 dvl["TUobs_N"] = tufin; 275 dvl["TUday_0"] = tudeb_day; 276 dvl["TUday_N"] = tufin_day; 277 dvl["TTag_0"] = MeanTT(0); 278 if(ntimefill>0) dvl["TTag_N"] = MeanTT(ntimefill-1); 279 dvl["freq0"] = freq0; 280 dvl["dfreq0"] = 500./8192.; 281 dvl["jfr1"] = jfr1; 282 dvl["jfr2"] = jfr2; 283 dvl["ngrpfreq"] = ngrpfreq; 284 dvl["ifilmin"] = ifilmin; 285 dvl["ifilmax"] = ifilmax; 286 dvl["ntimefill"] = ntimefill; 287 dvl["ntimebad"] = ntimebad; 255 288 256 289 // --- writing visibility matrix to file 257 sprintf(str,"%s",outname.c_str()); 258 cout<<"writing visibility matrix to file "<<str<<endl; 259 POutPersist pos(str); 260 pos.PutObject(MeanTT,"meantt"); 261 pos.PutObject(Npaqsum,"npaqsum"); 290 cout<<"writing visibility matrix to file "<<outname<<endl; 291 POutPersist pos(outname); 292 if(ntimefill>0) { 293 TVector<r_8> dum1(MeanTT(Range(0,ntimefill-1))); 294 pos.PutObject(dum1,"meantt"); 295 TVector<int_4> dum2(Npaqsum(Range(0,ntimefill-1))); 296 pos.PutObject(dum2,"npaqsum"); 297 TMatrix< complex<r_4> > dum3(MVisi(Range(0,ntimefill-1),Range(0,MVisi.NCols()-1))); 298 dum3.Info() = dvl; 299 pos.PutObject(dum3,"visi"); 300 } 262 301 pos.PutObject(Freq,"ifreq"); 263 pos.PutObject(MVisi,"visi"); 302 264 303 } 265 304 … … 279 318 } 280 319 cout<<">>>> svv2mtx2_1210.cc ------- END ----------- RC="<<rc<<endl; 320 PrtTim("--- End of job"); 281 321 return rc; 282 322 }
Note:
See TracChangeset
for help on using the changeset viewer.