Changeset 1442 in Sophya


Ignore:
Timestamp:
Mar 15, 2001, 1:09:31 PM (25 years ago)
Author:
ansari
Message:

Ajout de processeurs simples - Deglitcher + Filtre, + programme test - Reza 15/3/2001

Location:
trunk/ArchTOIPipe
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.cc

    r1439 r1442  
    101101  int sne = getMaxIn();
    102102
     103  double* tabdata = new double[ndata];
     104  double* tabflag = new double[ndata]; // ? pas integer ?? $CHECK$ - Reza
     105  bool* tabck = new bool[ndata];
     106  int i;
     107  for(i=0; i<ndata; i++) {
     108    tabdata[i] = -9.e19;  // $CHECK$ - Reza valeur par defaut !
     109    tabflag[i] = -9.e19;  // $CHECK$ - Reza valeur par defaut !
     110    tabck[i] = checkInputTOIIndex(i);
     111  }
     112
    103113  for (int sn = snb; sn <= sne; sn++) {
     114    //    if ((sn%2000 == 0) || (sn<snb+5))
     115    //  cout << " DBG-A-FitsWriter::run()" << sn << endl;
    104116    try {
     117      for (i=0; i<ndata; i++) {
     118        if (tabck[i]) {
     119          tabdata[i] = getData(i, sn);
     120          if (outFlags) tabflag[i] = getFlag(i, sn);
     121        }
     122      }
    105123      fits_lock();
     124      //      if ((sn%2000 == 0) || (sn<snb+5))
     125      //cout << " DBG-B-FitsWriter::run()" << sn << endl;
    106126      double xx = sn;
    107127      fits_write_col_dbl(fptr, 1, fitsLine, 1, 1, &xx, &fstatus);
    108       fits_unlock();
    109       for (int i=0; i<ndata; i++) {
    110         double x = -9.e19;  // $CHECK$ - Reza valeur par defaut !
    111         if (checkInputTOIIndex(i)) x = getData(i, sn);
    112         fits_lock();
     128     
     129      for (i=0; i<ndata; i++) {
    113130        if (outFlags) {
    114           fits_write_col_dbl(fptr, 2*i+2, fitsLine, 1, 1, &x, &fstatus);
    115           if (checkInputTOIIndex(i))   x = getFlag(i, sn);
    116           else x = -9.e19;  // $CHECK$ - Reza valeur par defaut !
    117           fits_write_col_dbl(fptr, 2*i+3, fitsLine, 1, 1, &x, &fstatus);
     131          fits_write_col_dbl(fptr, 2*i+2, fitsLine, 1, 1, tabdata+i, &fstatus);
     132          fits_write_col_dbl(fptr, 2*i+3, fitsLine, 1, 1, tabflag+i, &fstatus);
    118133        } else {
    119           fits_write_col_dbl(fptr, i+2, fitsLine, 1, 1, &x, &fstatus);
     134          fits_write_col_dbl(fptr, i+2, fitsLine, 1, 1, tabdata+i, &fstatus);
    120135        }
    121136        if (fstatus != 0) {
     
    124139          abort();
    125140        }
    126         fits_unlock();
    127141      }
     142      fits_unlock();
     143      //           if ((sn%2000 == 0) || (sn<snb+5))
     144      //        cout << " DBG-C-FitsWriter::run()" << sn << " line=" << fitsLine << endl;
     145      fitsLine++;
    128146    } catch (PException e) {
    129       cout << "fitstoiwtr exception " << e.Msg() << endl;
    130       continue;
     147    cout << "fitstoiwtr exception " << e.Msg() << endl;
     148    continue;
    131149    }
    132     fitsLine++;
    133150  }
     151
     152  delete[] tabdata;
     153  delete[] tabflag;
     154  delete[] tabck;
    134155
    135156  fits_lock();
     
    137158  fits_report_error(stderr, fstatus);
    138159  fits_unlock();
    139   cout << "fitstoiwriter done" << endl;
     160  cout << "fitstoiwriter done fitsLine= " << fitsLine << endl;
    140161}
    141162
  • trunk/ArchTOIPipe/Kernel/toiseqbuff.cc

    r1437 r1442  
    6363  if (!started) return DATA_NOT_YET;
    6464  if (iEnd >= next_in) return DATA_NOT_YET;
    65   if (iStart < (next_in-buffsize)) return DATA_DELETED;
     65  if (isDataDeleted(iStart)) return DATA_DELETED;
    6666  return DATA_OK;
    6767}
     
    102102  }
    103103  cleanWaitGet();
    104   if (isDataDeleted(i))
     104  if (isDataDeleted(i)) {
     105    if (dbglev > 0)
     106      cout << " TOISeqBuffered::doGetData() - DataDeleted() name=" << getName() 
     107           << " i=" << i << " next_in= " << next_in
     108           << " next_out=" << next_out << endl;
    105109    throw RangeCheckError("TOISeqBuffered::doGetData(i) : data deleted");
     110  }
    106111  while (i >= next_in) {
    107112    if (i>next_out) next_out = i;
     
    163168  else {
    164169    if (i != next_in) {
     170      if (dbglev > 0)
     171        cout << " TOISeqBuffered::doPutData() - i!=next_in() name=" << getName() 
     172             << " i=" << i << " next_in= " << next_in
     173             << " next_out=" << next_out << endl;
    165174      string msg = "TOISeqBuffered::doPutData() : i!=next_in TOIname="  + getName();
    166175      throw RangeCheckError(msg);
  • trunk/ArchTOIPipe/Kernel/toiseqbuff.h

    r1437 r1442  
    5959  inline int_4 &        flagRef(int i) { return flags[i%buffsize]; }
    6060  inline bool           isDataDeleted(int i)
    61     { return((i < next_in-wsize-1) ? true : false); }
     61    { return((i < next_in-buffsize-1) ? true : false); }
    6262};
    6363
  • trunk/ArchTOIPipe/ProcWSophya/rztoi.cc

    r1439 r1442  
    33#include "pexceptions.h"
    44#include "fftpserver.h"
    5 #include "timing.h"
     5#include "ctimer.h"
    66
    77RzTOIProc::RzTOIProc(int w1, int w2, int nmax)
     
    1515void RzTOIProc::init() {
    1616  cout << "RzTOIProc::init" << endl;
    17   declareInput("signal");
    18   declareOutput("sfout");
     17  declareInput("in");
     18  declareOutput("out");
    1919  name = "rzproc";
    2020  upExtra = 1;
     
    3333
    3434  try {
     35    Timer tm("RzTOIProc::run()");
    3536
    3637    FFTPackServer ffts;
     
    116117        nkv++;
    117118      }
    118       PrtTim("End of bloc");
     119
     120      tm.Split("End of bloc");
    119121    }
    120122
     
    150152  }
    151153  catch (PException & e) {
    152     cout << "RzTOIProc exception Msg= " << e.Msg() << endl;
    153   }
    154 }
    155 
    156 
    157 
    158 RzSimpleTOIProc::RzSimpleTOIProc(double fact, int npr)
     154    cout << "RzTOIProc: Catched exception " << (string)typeid(e).name()
     155         << "\n Msg= " << e.Msg() << endl;
     156  }
     157}
     158
     159
     160
     161RzSimpleTOIProc::RzSimpleTOIProc(int wsz, double fact)
    159162{
     163  if (wsz < 4) wsz = 4;
    160164  cout << "RzSimpleTOIProc::RzSimpleTOIProc() factor= " << fact
    161        << " npr=" << npr << endl;
     165       << " WSize=" << wsz << endl;
    162166  _fact = fact;
    163   _nprt = npr;
     167  _wsz = wsz;
    164168}
    165169
    166170void RzSimpleTOIProc::init() {
    167171  cout << "RzSimpleTOIProc::init" << endl;
    168   declareInput("signal");
    169   declareOutput("sfout");
     172  declareInput("in");
     173  declareOutput("out");
    170174  name = "rzsimpleproc";
    171175  upExtra = 1;
     
    177181  int sne = getMaxIn();
    178182
    179   cout << " RzSimpleTOIProc::run(): snb=" << snb << " sne=" << sne << endl;
     183  int nstot = sne-snb;
     184  int nbloc = nstot/_wsz;
     185  cout << " RzSimpleTOIProc::run(): snb=" << snb << " sne="
     186       << sne << " NBloc=" << nbloc << endl;
    180187
    181188  double val;
     189  int snlast = snb;
     190  int istart,ii,kb;
    182191  try {
    183     for (int k=snb; k<sne; k++) {
    184       if ((k-snb)%_nprt == 0)
    185         cout << " RzSimpleTOIProc::run() - Processing sample k= " << k
    186              << endl;
    187 
    188       val = getData(0, k);
    189       putData(0, k, val*_fact);
    190     }
     192    Timer tm("RzSimpleTOIProc::run()");
     193    Vector vin(_wsz);
     194    for (kb=0; kb<nbloc; kb++) {
     195      istart = kb*_wsz+snb;
     196      if (kb%2 == 0) {  // On parcourt a l'envers
     197        cout << " ... Processing bloc[" << kb << "] (Reverse) SampleNum="
     198             << istart+_wsz << " ->" << istart << endl;
     199        for(ii=_wsz-1; ii>=0; ii--)
     200          vin(ii) = getData(0, ii+istart);
     201      }
     202      else {  // On parcourt vers l'avant
     203        cout << " ... Processing bloc[" << kb << "] SampleNum="
     204             << istart << " ->" << istart+_wsz << endl;
     205        for(ii=0; ii<_wsz; ii++)
     206          vin(ii) = getData(0, ii+istart);     
     207      }
     208      for(ii=0; ii<_wsz; ii++)
     209        putData(0, ii+istart, vin(ii)*_fact);
     210      snlast = istart+_wsz;
     211    }
     212    cout << " ... Processing remaining Samples - SN="
     213         << snlast << " ->" << sne << endl;
     214    for(ii=snlast; ii<sne; ii++) {
     215      val = getData(0, ii);
     216      putData(0, ii, val*_fact);
     217    }
     218   
     219   
    191220  }
    192221  catch (PException & e) {
    193     cout << "RzSimpleTOIProc exception Msg= " << e.Msg() << endl;
    194   }
    195 }
     222    cout << "RzSimpleTOIProc exception " << (string)typeid(e).name()
     223         << "\n  Msg= " << e.Msg() << endl;
     224  }
     225}
  • trunk/ArchTOIPipe/ProcWSophya/rztoi.h

    r1437 r1442  
    2323class RzSimpleTOIProc : public TOIProcessor {
    2424public:
    25   RzSimpleTOIProc(double fact=1.0, int npr=1000);
     25  RzSimpleTOIProc(int wsz=1024, double fact=1.0);
    2626  virtual void init(); 
    2727  virtual void run();
     
    2929protected:
    3030  double _fact;
    31   int _nprt;
     31  int _wsz;
    3232};
    3333
  • trunk/ArchTOIPipe/SMakefile

    r1437 r1442  
    1111
    1212LIBOLIST := $(AOBJ)asciitoiwtr.o $(AOBJ)fitstoirdr.o $(AOBJ)fitstoiwtr.o $(AOBJ)toi.o $(AOBJ)toimanager.o $(AOBJ)toiprocessor.o $(AOBJ)toisqfilter.o \
    13 $(AOBJ)toiseqbuff.o
     13$(AOBJ)toiseqbuff.o $(AOBJ)simtoipr.o
    1414EXEOLIST := $(AOBJ)fits2asc.o $(AOBJ)tsttoi.o $(AOBJ)tsttoi2.o
    15 EXELIST := $(AOBJ)tstrztoi $(AOBJ)fits2asc $(AOBJ)tsttoi $(AOBJ)tsttoi2
     15EXELIST := $(AOBJ)simtst $(AOBJ)tstrztoi $(AOBJ)fits2asc $(AOBJ)tsttoi $(AOBJ)tsttoi2
    1616
    1717INCLIST := asciitoiwtr.h fitstoirdr.h fitstoiwtr.h toi.h config.h conf.h \
    18  toiprocessor.h toimanager.h toiseqbuff.h
     18 toiprocessor.h toimanager.h toiseqbuff.h simtoipr.h
    1919
    2020
     
    3535
    3636$(AOBJ)tstrztoi: $(AOBJ)tstrztoi.o $(AOBJ)rztoi.o $(LIBOLIST)
     37        $(LINK.cc)  -o $@ $^ $(LIBS)
     38$(AOBJ)simtst: $(AOBJ)simtst.o $(AOBJ)simtoipr.o $(LIBOLIST)
    3739        $(LINK.cc)  -o $@ $^ $(LIBS)
    3840$(AOBJ)fits2asc: $(AOBJ)fits2asc.o $(LIBOLIST)
     
    6264$(AOBJ)toiseqbuff.o: toiseqbuff.cc toiprocessor.h config.h conf.h toi.h \
    6365toiseqbuff.h
     66$(AOBJ)simtoipr.o: simtoipr.cc toiprocessor.h config.h conf.h toi.h \
     67simtoipr.h
  • trunk/ArchTOIPipe/TestPipes/tstrztoi.cc

    r1439 r1442  
    148148
    149149    cout << " Creating Rz TOIProcessors: RzTOIProc () " << endl;
    150     RzSimpleTOIProc rzs(2., 1000);
     150    RzSimpleTOIProc rzs(w2, 3.);
    151151    RzTOIProc rzp(w1, w2, nmax);
    152152    if (fgsimple) {
    153153      cout << " Using Simple TOIProcessor: RzSimpleTOIProc () " << endl;
    154       rzs.addInput("signal", toi);
    155       rzs.addOutput("sfout", toi2);
     154      rzs.addInput("in", toi);
     155      rzs.addOutput("out", toi2);
    156156      }
    157157    else {
     
    159159      //      rzp.setOutPPF("/data/Archeops/toto.ppf");
    160160      rzp.setOutPPF(ppffile);
    161       rzp.addInput("signal", toi);
    162       rzp.addOutput("sfout", toi2);
     161      rzp.addInput("in", toi);
     162      rzp.addOutput("out", toi2);
    163163    }
    164164
Note: See TracChangeset for help on using the changeset viewer.