Changeset 4005 in Sophya for trunk/AddOn/TAcq


Ignore:
Timestamp:
Jun 16, 2011, 6:44:45 PM (14 years ago)
Author:
ansari
Message:

ajout logique pour combinaison IQ, Reza 16/6/2011

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 ...
    22#include "sopnamsp.h"
    33#include "machdefs.h"
    44
    5 /* ----------------------------------------------------------
    6    Projet BAORadio - (C) LAL/IRFU  2008-2011
    7 
    8    Programme de lecture des fichiers DUMP ADC du CRT (Pittsburgh)
    9    pour calcul de spectres / correlations
     5/* ---------------------------------------------------------------
     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
    1010   R. Ansari, C. Magneville   -  LAL/Irfu - Juin 2011
    11    ---------------------------------------------------------- */
     11   --------------------------------------------------------------- */
    1212
    1313// include standard c/c++
     
    2020#include <string>
    2121
     22// SOPHYA include files
    2223#include "pexceptions.h"
    2324#include "tvector.h"
     
    4041
    4142
    42 //--------------------------- Fonctions de ce fichier   -------------------
     43//--------------------------- Functions in this file  -------------------
    4344int Usage(bool fgshort=true);
    4445int 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);
     46int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, bool fgcombiq,
     47                    int imin, int imax, int istep,  int jf1, int jf2, int nfreq);
     48int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  bool fgcombiq,
     49                  TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel);
    4750int ADCFiles2Histo(string& inoutpath, vector<int>& adcids, string& outname, int imin, int imax, int istep);
    48 
     51int CombineIQPairs(TMatrix< complex<r_4> >& cfour);
    4952//------------------------------------------------------------------------------------------------------------
    5053
     
    5356{
    5457  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;
    5659  if (fgshort) {
    5760    cout << " corrcrtadc -h for detailed instructions" << endl;
    5861    return 1;
    5962  }
    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"
    6165       << " InOutPath : Input/Output directory name \n"
    6266       << " ADCIds : ADC Id's to be processed (Example: 1,2,3,4, default=0,1)  \n"
     
    113117  string popt = arg[0];
    114118  bool fillhis=false;
     119  bool fgcomiq=false;
    115120  if (popt=="-hval")  fillhis=true;
     121  else if (popt=="-corciq")  fgcomiq=true;
    116122  string inoutpath = arg[1]; 
    117123  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);
    120126  vector<int> adcids;
    121   for(int ii=0;ii<4;ii++)
     127  for(int ii=0;ii<8;ii++)
    122128    if((aids[ii]>=0)&&(aids[ii]<16))  adcids.push_back(aids[ii]);
    123129  int imin=0;
     
    139145  int rc=0;
    140146  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);
    142148 
    143149  return rc;
     
    154160// Pour traitement (calcul FFT et visibilites (ProcA) 1 fibre, 2 voies RAW)
    155161/* --Fonction-- */
    156 int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname, int imin, int imax, int istep, int jf1, int jf2, int nfreq)
     162int ProcessADCFiles(string& inoutpath, vector<int>& adcids, string& outname,  bool fgcombiq, int imin, int imax, int istep, int jf1, int jf2, int nfreq)
    157163{
    158164  Timer tm("ProcessADCFiles"); 
     
    210216        }
    211217      }
    212       ComputeCorrel(cfour, correl, autocorrel);
     218      ComputeCorrel(cfour, fgcombiq, correl, autocorrel);
    213219      nsumcor++;
    214220      if (m%PRTMODULO==0)  cout << " ProcessADCFiles/Info Done read+FFT+correl m=" << m << " / Max=" << ADCNREAD << endl;
     
    255261
    256262/* --Fonction-- */
    257 int ComputeCorrel(TMatrix< complex<r_4> >& cfour,  TMatrix< complex<r_8> >& correl, TMatrix< complex<r_8> >& autocorrel)
    258 {
     263int 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);
    259267  sa_size_t jcr=0;
    260268  for(sa_size_t j1=0; j1<cfour.NRows(); j1++) {
     
    266274    }
    267275  }
     276  return 0;
     277}
     278
     279int CombineIQPairs(TMatrix< complex<r_4> >& cfour)
     280{
     281  // to be coded ...
    268282  return 0;
    269283}
Note: See TracChangeset for help on using the changeset viewer.