Changeset 3647 in Sophya for trunk/AddOn/TAcq/svv2mtx.cc
- Timestamp:
- Jun 12, 2009, 4:49:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.