Changeset 1500 in Sophya for trunk/ArchTOIPipe/TestPipes


Ignore:
Timestamp:
May 18, 2001, 10:22:27 AM (24 years ago)
Author:
ansari
Message:

Rajout d'options ds simtst.cc - Reza 18/5/2001

File:
1 edited

Legend:

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

    r1491 r1500  
    3131#include "toimanager.h"
    3232#include "simtoipr.h"
     33#include "nooppr.h"
    3334#include "toiseqbuff.h"
    3435#include "timing.h"
     
    4546    cout << "\n Usage : simtst [-intoi toiname] [-start snb] [-end sne] \n"
    4647         << "         [-dbg] [-wtoi sz] [-wdegli sz] [-range min,max] \n"
    47          <<"          [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf \n"
     48         << "         [-degli ns,ns2,mxpt,mnpt,wrec] [-gfilt wsz,sigma] \n"
     49         << "         [-wfft sz] [-keepfft n] [-killfreq bf,nharm,sigf] \n"
     50         << "         [-nooutflg] [-nowrtms] [-nowrticd] \n"
    4851         << "         inFitsName outFitsName  outPPFName \n"
    4952         << "   -dbg : sets TOISeqBuffered debug level to 1 \n"
     
    5558         << "   -wtoi sz : sets TOISeqBuff buffer size (def= 8192)\n"
    5659         << "   -wdegli sz : sets deglitcher window size (def= 512) \n"
     60         << "   -degli ns,ns2,maxnpt,minnpt,wrec : sets deglitcher parameters\n"
     61         << "   -gfilt wsz,sigma : Gaussian filter window size and sigma\n"
    5762         << "   -wfft sz : Activate Fourier filter and sets its width \n"
    5863         << "   -keepfft n : Keeps n spectra (if Fourier filter activated) \n"
    5964         << "   -killfreq bf,nharm,sigf : kills nharm frequency, basefreq=bf \n"
    60             "              with a gaussian with width=sigf \n"
     65         << "              with a gaussian with width=sigf \n"
     66         << "   -nooutflg : Don't write flags to output FITS \n"
     67         << "   -nowrtms : Don't write mean/sigma TOI's \n"
     68         << "   -nowrticd : Don't write incopie,degli,deglioffset TOI's \n"
    6169         << endl;
    62     exit(0);
    6370  }
    6471}
     
    7481  int wtoi = 8192;
    7582  int wdegli = 512;
     83 
    7684  int wfft = 4096;
    7785  int keepfft = 0;
     
    8189  double range_min = -16000;
    8290  double range_max = 16000.;
     91
     92  // Deglitcher parameters
     93  double degli_ns1 = 3.;
     94  double degli_ns2 = 1.5;
     95  int degli_minnpt = 2;
     96  int degli_maxnpt = 4;
     97  int degli_wrec = 10;
     98
     99  // Gaussian filter parameters
     100  int gfilt_wsz = 16;
     101  double gfilt_sigma = 2.;
     102
     103  // File names
    83104  string infile;
    84105  string outfile;
    85106  string outppfname;
    86107  string intoi = "boloMuV_27";
     108
     109  bool fg_wrtflag = true;
     110  bool fg_nowrtms = false;
     111  bool fg_nowrticd = false;
     112
     113
    87114  bool fg_f_filt = false;
    88115  bool fg_killfreq = false;
     
    112139      wdegli = atoi(arg[ia+1]); ia++;
    113140    }   
     141    else if (strcmp(arg[ia],"-degli") == 0) {
     142      if (ia == narg-1) Usage(true);
     143      sscanf(arg[ia+1],"%lf,%lf,%d,%d,%d",  &degli_ns1, &degli_ns2,
     144             &degli_maxnpt, &degli_minnpt, &degli_wrec);
     145      ia++;
     146    }   
     147    else if (strcmp(arg[ia],"-gfilt") == 0) {
     148      if (ia == narg-1) Usage(true);
     149      sscanf(arg[ia+1],"%d,%lf", &gfilt_wsz, &gfilt_sigma);
     150      ia++;
     151    }   
    114152    else if (strcmp(arg[ia],"-wfft") == 0) {
    115153      if (ia == narg-1) Usage(true); 
     
    137175    }   
    138176    else if (strcmp(arg[ia],"-dbg") == 0)  fgdbg = true;
     177    else if (strcmp(arg[ia],"-nooutflg") == 0)  fg_wrtflag = false;
     178    else if (strcmp(arg[ia],"-nowrtms") == 0)  fg_nowrtms = true;
     179    else if (strcmp(arg[ia],"-nowrticd") == 0)  fg_nowrticd = true;
    139180
    140181    else { ko = ia; break; }  // Debut des noms
     
    177218
    178219    //    char * colname[5] = {"MJD", "UTC","boloMuV_11","magnFlux","pivot"};
    179     //    char * toiname[5] = {"MJD", "UTC","bolo11","magneto","pivot"};
    180220    TOISeqBuffered * toiin = new TOISeqBuffered("f2in", w1);
    181221    if (fgdbg) toiin->setDebugLevel(1);
     
    206246    cout << " Creating SimpleDeglitcher() " << endl;
    207247    SimpleDeglitcher degl(wdegli);
    208     degl.SetDetectionParam(3.,1.5, 4, 2, 10);
     248    degl.SetDetectionParam(degli_ns1, degli_ns2, degli_maxnpt,
     249                           degli_minnpt, degli_wrec);
     250
    209251    cout << " Setting Range for deglitcher: " << range_min
    210252         << " - " << range_max << endl;
     
    288330    cout << " Connecting to output (FitsWriter) " << endl;
    289331   
    290     w.setOutFlags(true);
    291     w.addInput("in", toiincopie);
     332    w.setOutFlags(fg_wrtflag);
     333
     334    // Pour connecter les lignes non connectees au FitsWriter
     335    NoOpProcessor noop[3];
     336
     337    if (fg_nowrticd) noop[0].addInput("in", toiincopie);
     338    else w.addInput("in", toiincopie);
     339
    292340    if (fg_f_filt) {
    293341      w.addInput("filtout", toifiltcopie);
     
    295343    }
    296344    else   w.addInput("filtout", toiout);
    297     w.addInput("degli", toidegli1);
    298     w.addInput("deglioff", toideglioffcopie);
    299     w.addInput("mean", toimean1);
    300     w.addInput("sigma", toisig);
     345
     346    if (fg_nowrticd) {
     347      noop[1].addInput("in", toidegli1);
     348      noop[1].addInput("in2", toideglioffcopie);
     349    }
     350    else {
     351      w.addInput("degli", toidegli1);
     352      w.addInput("deglioff", toideglioffcopie);
     353    }
     354    if (fg_nowrtms) {
     355      noop[2].addInput("in", toimean1);
     356      noop[2].addInput("in2", toisig);
     357    }
     358    else {
     359      w.addInput("mean", toimean1);
     360      w.addInput("sigma", toisig);
     361    }
    301362
    302363    cout << " ------ FITSReaderTOI::PrintStatus() : ----- " << endl;
     
    319380    if (fg_f_filt) sfft.start();
    320381    w.start();
     382    if (fg_nowrticd) {
     383      noop[0].start();
     384      noop[1].start();
     385    }
     386    if (fg_nowrtms)
     387      noop[2].start();
    321388
    322389    /*
     
    354421  }
    355422  catch (PThrowable & exc) {
    356     cerr << "\nrztsttoi: Catched Exception \n" << (string)typeid(exc).name()
     423    cerr << "\n simtst: Catched Exception \n" << (string)typeid(exc).name()
    357424         << " - Msg= " << exc.Msg() << endl;
    358425  }
    359426  catch (const std::exception & sex) {
    360     cerr << "\nrztsttoi: Catched std::exception \n"
     427    cerr << "\n simtst: Catched std::exception \n"
    361428         << (string)typeid(sex).name() << endl;
    362429  }
    363430  catch (...) {
    364     cerr << "\nrztsttoi: some other exception was caught ! " << endl;
     431    cerr << "\n simtst: some other exception was caught ! " << endl;
    365432  }
    366433
Note: See TracChangeset for help on using the changeset viewer.