Ignore:
Timestamp:
Apr 27, 2001, 2:52:15 AM (24 years ago)
Author:
ansari
Message:

debug deglitcher - Ajout Filtre Fourier (SimpleFourierFilter) - Reza 27/4/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/TestPipes/simtst.cc

    r1478 r1479  
    3333  else {
    3434    cout << "\n Usage : simtst [-dbg] [-start snb] [-end sne] \n"
    35          << "         [-wtoi sz] [-w2 sz] inFitsName outFitsName ppfFileName \n"
     35         << "         [-wtoi sz] [-wdegli sz] [-wfft sz] [-keepfft n] \n"
     36         << "         inFitsName outFitsName  \n"
    3637         << "   -dbg : sets TOISeqBuffered debug level to 1 \n"
    3738         << "   -start snb : sets the start sample num \n"
     
    4243         << "   -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
    4344         << "   -wdegli sz : sets deglitcher window size (def= 512) \n"
     45         << "   -wfft sz : Activate Fourier filter and sets its width \n"
     46         << "   -keepfft n : Keeps n spectra (if Fourier filter activated) \n"
    4447         << endl;
    4548    exit(0);
     
    5457
    5558  bool fgdbg = false;
    56   int w1 = 8192;
    57   int w2 = 512;
     59  int wtoi = 8192;
     60  int wdegli = 512;
     61  int wfft = 4096;
     62  int keepfft = 0;
    5863  int nmax = 10;
    59   int istart = 104121000+w1*5;
     64  int istart = 104121000+wtoi*5;
    6065  int iend = 0;
    6166  double range_min = -16000;
     
    6368  string infile;
    6469  string outfile;
    65   string ppffile;
    6670  string intoi = "boloMuV_27";
     71  bool fg_f_filt = false;
    6772
    6873  if (narg < 4) Usage(true);
     
    8085    else if (strcmp(arg[ia],"-wtoi") == 0) {
    8186      if (ia == narg-1) Usage(true); 
    82       w1 = atoi(arg[ia+1]); ia++;
     87      wtoi = atoi(arg[ia+1]); ia++;
    8388    }   
    8489    else if (strcmp(arg[ia],"-wdegli") == 0) {
    8590      if (ia == narg-1) Usage(true); 
    86       w2 = atoi(arg[ia+1]); ia++;
     91      wdegli = atoi(arg[ia+1]); ia++;
     92    }   
     93    else if (strcmp(arg[ia],"-wfft") == 0) {
     94      if (ia == narg-1) Usage(true); 
     95      wfft = atoi(arg[ia+1]); ia++;
     96      fg_f_filt = true;
     97    }   
     98    else if (strcmp(arg[ia],"-keepfft") == 0) {
     99      if (ia == narg-1) Usage(true); 
     100      keepfft = atoi(arg[ia+1]); ia++;
    87101    }   
    88102    else if (strcmp(arg[ia],"-range") == 0) {
     
    100114  }
    101115
    102   if (iend < istart) iend = istart+w1*(nmax+5);
    103   if ((narg-ko) < 3)  Usage(true);
     116  if (iend < istart) iend = istart+wtoi*(nmax+5);
     117  if ((narg-ko) < 2)  Usage(true);
    104118  infile = arg[ko];
    105119  outfile = arg[ko+1];
    106   ppffile = arg[ko+2];
    107120
    108121  cout << " Initializing SOPHYA ... " << endl;
     
    110123  InitTim();
    111124
    112   cout << ">>>> tstrztoi: Infile= " << infile << " outFile=" << outfile
    113        << " ppfFile= " << ppffile << endl;
    114   cout << ">>>> Window Size W1= " << w1 << " W2= " << w2
     125  cout << ">>>> tstrztoi: Infile= " << infile << " outFile="
     126       << outfile << endl;
     127  cout << ">>>> Window Size WTOI= " << wtoi << " WDEGLI= " << wdegli
    115128       << "  iStart= " << istart << " iEnd= " << iend << endl;
    116129  cout << ">>>> InTOIName= " << intoi << endl;
     130
    117131  try {
    118132    TOIManager* mgr = TOIManager::getManager();
     
    131145
    132146
     147    int w1 = wtoi;
     148    int w2 = (fg_f_filt && (wfft > w1)) ? wfft : w1;
     149
    133150    //    char * colname[5] = {"MJD", "UTC","boloMuV_11","magnFlux","pivot"};
    134151    //    char * toiname[5] = {"MJD", "UTC","bolo11","magneto","pivot"};
     
    139156    TOISeqBuffered * toimean = new TOISeqBuffered("mean", w1);
    140157    if (fgdbg) toimean->setDebugLevel(1);
    141     TOISeqBuffered * toisig = new TOISeqBuffered("sigma", w1);
     158    TOISeqBuffered * toisig = new TOISeqBuffered("sigma", w2);
    142159    if (fgdbg) toisig->setDebugLevel(1);
    143160    TOISeqBuffered * toiincopie = new TOISeqBuffered("incopie", w1);
     
    160177
    161178    cout << " Creating SimpleDeglitcher() " << endl;
    162     SimpleDeglitcher degl(w2);
     179    SimpleDeglitcher degl(wdegli);
     180    degl.SetDetectionParam(3.,1.5, 4, 2, 10);
    163181    cout << " Setting Range for deglitcher: " << range_min
    164182         << " - " << range_max << endl;
     183
    165184    degl.SetRange(range_min, range_max);
    166185    degl.addInput("in", toiin);
     
    174193    TOISeqBuffered * toidegli0 = new TOISeqBuffered("degli0", w1);
    175194    if (fgdbg) toidegli0->setDebugLevel(1);
    176     TOISeqBuffered * toidegli1 = new TOISeqBuffered("degli1", w1);
     195    TOISeqBuffered * toidegli1 = new TOISeqBuffered("degli1", w2);
    177196
    178197    TOISeqBuffered * toimean0 = new TOISeqBuffered("mean0", w1);
    179198    if (fgdbg) toimean0->setDebugLevel(1);
    180     TOISeqBuffered * toimean1 = new TOISeqBuffered("mean1", w1);
     199    TOISeqBuffered * toimean1 = new TOISeqBuffered("mean1", w2);
    181200    if (fgdbg) toimean1->setDebugLevel(1);
    182201   
     
    206225    TOISeqBuffered * toiout = new TOISeqBuffered("out", w1);
    207226    if (fgdbg) toiout->setDebugLevel(1);
    208     TOISeqBuffered * toideglioffcopie = new TOISeqBuffered("deglioffcopie", w1);
     227    TOISeqBuffered * toideglioffcopie = new TOISeqBuffered("deglioffcopie", w2);
    209228    if (fgdbg) toideglioffcopie->setDebugLevel(1);
    210229    filt.addOutput("out", toiout);
    211230    filt.addOutput("incopie", toideglioffcopie);
    212    
     231
     232    Vector fcoef(wfft/2);
     233    fcoef = RegularSequence(1., -2./wfft);
     234    cout << " Creating Fourier Filter ... " << endl;
     235    SimpleFourierFilter sfft(fcoef);
     236    sfft.KeepSpectra(keepfft);
     237    TOISeqBuffered * toifft = NULL;
     238    TOISeqBuffered * toifiltcopie = NULL;
     239
     240    if (fg_f_filt) {
     241      cout << " Connecting Fourier Filter ... " << endl;
     242      toifft = new TOISeqBuffered("fftout", w1);
     243      toifiltcopie = new TOISeqBuffered("filtcopie", w1);
     244      sfft.addInput("in",toiout);
     245      sfft.addOutput("out", toifft);
     246      sfft.addOutput("incopie", toifiltcopie);
     247    }
    213248
    214249    cout << " Connecting to output (FitsWriter) " << endl;
     
    216251    w.setOutFlags(true);
    217252    w.addInput("in", toiincopie);
    218     w.addInput("out", toiout);
     253    if (fg_f_filt) {
     254      w.addInput("filtout", toifiltcopie);
     255      w.addInput("fftout", toifft);
     256    }
     257    else   w.addInput("out", toiout);
    219258    w.addInput("degli", toidegli1);
    220259    w.addInput("deglioff", toideglioffcopie);
     
    239278    adder.start();
    240279    filt.start();
     280    if (fg_f_filt) sfft.start();
    241281    w.start();
    242282
     
    268308    cout << filt;
    269309    cout << adder;
     310    if (fg_f_filt) cout << sfft ;
    270311
    271312  }
Note: See TracChangeset for help on using the changeset viewer.