Changeset 3962 in Sophya
- Timestamp:
- Mar 4, 2011, 4:37:56 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/visfits2dt.cc
r3961 r3962 57 57 cout << " --- visfits2dt : Read fits visibility matrices produced by visfmib to make \n" 58 58 << " time-frequency matrices and Visibilites=f(time) datatable " << endl; 59 cout << " Usage: visfits2dt InOutPath Imin,Imax,step NumFreq1,NumFreq2,NBinFreq [VisMtxRowList] \n" << endl;59 cout << " Usage: visfits2dt InOutPath Imin,Imax,step NumFreq1,NumFreq2,NBinFreq VisMtxRowList [DT] \n" << endl; 60 60 if (fgshort) { 61 61 cout << " svv2mtx -h for detailed instructions" << endl; … … 66 66 << " FileNames=InOutPath/vismtxII.fits Imin<=II<=Imax II+=IStep \n" 67 67 << " NumFreq1,NumFreq2,NBinFreq: Freq Zone and number of frequency bins for DataTable\n" 68 << " VisMtxRowList : List of visibiliy matrix rows (0,2,...) -> time-freq map \n" << endl; 68 << " VisMtxRowList : List of visibiliy matrix rows (0,2,...) -> time-freq map \n" 69 << " DT : Fill datatable if DT arg specified " << endl; 69 70 return 1; 70 71 } … … 75 76 { 76 77 if ((narg>1)&&(strcmp(arg[1],"-h")==0)) return Usage(false); 77 if (narg< 4) return Usage(true);78 if (narg<5) return Usage(true); 78 79 HiStatsInitiator _inia; 79 80 // TArrayInitiator _inia; … … 110 111 // Traitement fichiers produits par vismfib (V Nov09) 111 112 /* --Fonction-- */ 113 static bool fgfilldt=false; 114 112 115 int DecodeProc(int narg, char* arg[]) 113 116 { … … 124 127 int card=1; 125 128 vector<sa_size_t> rowlist; 126 if (narg>3) {127 EnumeratedSequence es;128 int nbad;129 es.Append(arg[3], nbad, ",");130 for(int j=0; j<es.Size(); j++) rowlist.push_back((int)es.Value(j));131 }129 EnumeratedSequence es; 130 int nbad; 131 es.Append(arg[3], nbad, ","); 132 for(int j=0; j<es.Size(); j++) rowlist.push_back((int)es.Value(j)); 133 fgfilldt=false; 134 if ((narg>4)&&(strcmp(arg[4],"DT")==0)) fgfilldt=true; 132 135 // if (rowlist.size()<1) rowlist.push_back(0); 133 136 … … 165 168 if (djf<1) djf=1; 166 169 167 cout << " --- ProcVisMtxFiles jf1=" << jf1 << " jf2= " << jf2 << " djf=" << djf<< endl;170 cout << " --- ProcVisMtxFiles Frequency binng Start=" << jf1 << " End= " << jf2 << " DFreq=" << djf << " NBinFreq=" << nfreq << endl; 168 171 char fname[1024]; 169 172 … … 179 182 cout << " ---- ProcVisMtxFiles()-Read chanum done " << endl; 180 183 sa_size_t nrows = (imax-imin+1)/istep; 181 sa_size_t k r=0;182 183 sa_size_t mtf_binfreq=25;184 sa_size_t mtf_bintime= 5;184 sa_size_t ktime=0; 185 186 // sa_size_t mtf_binfreq=25; 187 sa_size_t mtf_bintime=1; 185 188 186 189 sa_size_t ncols=1; … … 197 200 ncols = vismtx.NCols(); 198 201 cout << " ProcVisMtxFiles/Info: Output Time-Frequency matrices NRows(time) " 199 << nrows/mtf_bintime+1 << " NCols(freq) =" << n cols/mtf_binfreq+1<< endl;202 << nrows/mtf_bintime+1 << " NCols(freq) =" << nfreq << endl; 200 203 for(size_t j=0; j<rowlist.size(); j++) 201 vmtf.push_back(TMatrix< r_4 >(nrows/mtf_bintime+1, n cols/mtf_binfreq+1));204 vmtf.push_back(TMatrix< r_4 >(nrows/mtf_bintime+1, nfreq)); 202 205 } 203 206 204 207 if (rowlist.size()>0) { 205 for(size_t j=0; j<rowlist.size(); j++) 206 for(sa_size_t icf=0; icf<ncols; icf++) { 207 vmtf[j](kr/mtf_bintime,icf/mtf_binfreq)+=vismtx(rowlist[j],icf); 208 for(size_t j=0; j<rowlist.size(); j++) { 209 sa_size_t jfreb=0; 210 for(sa_size_t jf=jf1; jf<jf2; jf+=djf) { 211 sa_size_t jfreb=(jf-jf1)/djf; 212 if (jfreb>=nfreq) break; 213 vmtf[j](ktime/mtf_bintime,jfreb)+=vismtx(rowlist[j],jf); 208 214 } 215 } 209 216 } 210 217 // cout << " DBG* kr=" << kr << " kr/mtf_bintime=" << kr/mtf_bintime 211 218 // << " ncols/2/mtf_binfreq=" << ncols/2/mtf_binfreq << endl; 212 k r++;219 ktime++; 213 220 214 221 215 222 // Calcul moyenne dans des bandes en frequence 216 FillVisDTable(visdt, vismtx, chanum, jf1, jf2, djf);223 if (fgfilldt) FillVisDTable(visdt, vismtx, chanum, jf1, jf2, djf); 217 224 } 218 225 … … 221 228 cout << "ProcVisMtxFiles: Opening file " << fname << " for writing Visi(Freq,Time) matrices" << endl; 222 229 FitsInOutFile fo(fname, FitsInOutFile::Fits_Create); 223 for(size_t j=0; j<rowlist.size(); j++) 230 for(size_t j=0; j<rowlist.size(); j++) { 231 cout << " Writing Time-Freq visibility matrix for " << chanum(rowlist[j]) << endl; 224 232 fo << vmtf[j]; 225 } 226 cout << visdt; 227 sprintf(fname, "!%s/visidt.ppf",inoutpath.c_str()); 228 cout << "ProcVisMtxFiles: writing visibility datatable to file " << fname << endl; 229 FitsInOutFile fod(fname, FitsInOutFile::Fits_Create); 230 fod << visdt; 231 233 } 234 } 235 if (fgfilldt) { 236 cout << visdt; 237 sprintf(fname, "!%s/visidt.fits",inoutpath.c_str()); 238 cout << "ProcVisMtxFiles: writing visibility datatable to file " << fname << endl; 239 FitsInOutFile fod(fname, FitsInOutFile::Fits_Create); 240 fod << visdt; 241 } 232 242 return 0; 233 243 }
Note:
See TracChangeset
for help on using the changeset viewer.