- Timestamp:
- Jun 16, 2011, 6:44:45 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AddOn/TAcq/corrcrtadc.cc
r4003 r4005 1 // Utilisation de SOPHYA pour faciliter les tests...1 // Utilisation de SOPHYA ... 2 2 #include "sopnamsp.h" 3 3 #include "machdefs.h" 4 4 5 /* ---------------------------------------------------------- 6 Projet BAORadio - (C) LAL/IRFU 2008-20117 8 Programme de lecture des fichiers DUMP ADC du CRT (Pittsburgh)9 pour calcul de spectres / correlations5 /* --------------------------------------------------------------- 6 Projet BAORadio-21cm intensity mapping - (C) LAL/IRFU 2008-2011 7 8 CRT (Pittsburgh-CMU) DUMP ADC read/processing program to compute 9 spectra and correlations du CRT 10 10 R. Ansari, C. Magneville - LAL/Irfu - Juin 2011 11 ---------------------------------------------------------- */11 --------------------------------------------------------------- */ 12 12 13 13 // include standard c/c++ … … 20 20 #include <string> 21 21 22 // SOPHYA include files 22 23 #include "pexceptions.h" 23 24 #include "tvector.h" … … 40 41 41 42 42 //--------------------------- F onctions de ce fichier-------------------43 //--------------------------- Functions in this file ------------------- 43 44 int Usage(bool fgshort=true); 44 45 int DecodeProc(int narg, char* arg[]); 45 int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, int imin, int imax, int istep, int jf1, int jf2, int nfreq); 46 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel); 46 int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, bool fgcombiq, 47 int imin, int imax, int istep, int jf1, int jf2, int nfreq); 48 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, bool fgcombiq, 49 TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel); 47 50 int ADCFiles2Histo(string& inoutpath, vector<int>& adcids, string& outname, int imin, int imax, int istep); 48 51 int CombineIQPairs(TMatrix< complex<r_4> >& cfour); 49 52 //------------------------------------------------------------------------------------------------------------ 50 53 … … 53 56 { 54 57 cout << " --- corrcrtadc.cc : Read CRT-ADC dump files and process to produce correlation matrices \n" 55 << " Usage: corrcrtadc -corr/- hval InOutPath OutFile [AdcIds] [Imin,Imax,step]\n" << endl;58 << " Usage: corrcrtadc -corr/-corciq/-hval InOutPath OutFile [AdcIds] [Imin,Imax,step]\n" << endl; 56 59 if (fgshort) { 57 60 cout << " corrcrtadc -h for detailed instructions" << endl; 58 61 return 1; 59 62 } 60 cout << " -corr/-hval : Compute correlations or Fill histograms for ADC sample values \n" 63 cout << " -corr/-corciq/-hval : Compute correlations or Fill histograms for ADC sample values \n" 64 << " -corciq : combine IQ pairs to separate side-bands ... \n" 61 65 << " InOutPath : Input/Output directory name \n" 62 66 << " ADCIds : ADC Id's to be processed (Example: 1,2,3,4, default=0,1) \n" … … 113 117 string popt = arg[0]; 114 118 bool fillhis=false; 119 bool fgcomiq=false; 115 120 if (popt=="-hval") fillhis=true; 121 else if (popt=="-corciq") fgcomiq=true; 116 122 string inoutpath = arg[1]; 117 123 string outname = arg[2]; 118 int aids[ 4]={0,1,-1,-1};119 if (narg>3) sscanf(arg[3],"%d,%d,%d,%d ",aids,aids+1,aids+2,aids+3);124 int aids[8]={0,1,-1,-1,-1,-1,-1,-1}; 125 if (narg>3) sscanf(arg[3],"%d,%d,%d,%d,%d,%d,%d,%d",aids,aids+1,aids+2,aids+3,aids+4,aids+5,aids+6,aids+7); 120 126 vector<int> adcids; 121 for(int ii=0;ii< 4;ii++)127 for(int ii=0;ii<8;ii++) 122 128 if((aids[ii]>=0)&&(aids[ii]<16)) adcids.push_back(aids[ii]); 123 129 int imin=0; … … 139 145 int rc=0; 140 146 if (fillhis) rc = ADCFiles2Histo(inoutpath, adcids, outname, imin, imax, istep); 141 else rc=ProcessADCFiles(inoutpath, adcids, outname, imin, imax, istep, jf1, jf2, nfreq);147 else rc=ProcessADCFiles(inoutpath, adcids, outname, fgcomiq, imin, imax, istep, jf1, jf2, nfreq); 142 148 143 149 return rc; … … 154 160 // Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW) 155 161 /* --Fonction-- */ 156 int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, int imin, int imax, int istep, int jf1, int jf2, int nfreq)162 int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, bool fgcombiq, int imin, int imax, int istep, int jf1, int jf2, int nfreq) 157 163 { 158 164 Timer tm("ProcessADCFiles"); … … 210 216 } 211 217 } 212 ComputeCorrel(cfour, correl, autocorrel);218 ComputeCorrel(cfour, fgcombiq, correl, autocorrel); 213 219 nsumcor++; 214 220 if (m%PRTMODULO==0) cout << " ProcessADCFiles/Info Done read+FFT+correl m=" << m << " / Max=" << ADCNREAD << endl; … … 255 261 256 262 /* --Fonction-- */ 257 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel) 258 { 263 int ComputeCorrel(TMatrix< complex<r_4> >& cfour, bool fgcombiq, 264 TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel) 265 { 266 if (fgcombiq) CombineIQPairs(cfour); 259 267 sa_size_t jcr=0; 260 268 for(sa_size_t j1=0; j1<cfour.NRows(); j1++) { … … 266 274 } 267 275 } 276 return 0; 277 } 278 279 int CombineIQPairs(TMatrix< complex<r_4> >& cfour) 280 { 281 // to be coded ... 268 282 return 0; 269 283 }
Note:
See TracChangeset
for help on using the changeset viewer.