Changeset 2187 in Sophya


Ignore:
Timestamp:
Sep 9, 2002, 5:33:16 PM (23 years ago)
Author:
aubourg
Message:

Vivien, limites processors et connect

Location:
trunk/ArchTOIPipe
Files:
3 added
16 edited

Legend:

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

    r2049 r2187  
    6565}
    6666
    67 TOI& CGT::Connect(TOIProcessor& prout, string& out,
    68                   TOIProcessor& prin, string& in, string nom, int wbsz, bool withFlag)
     67TOI& CGT::Connect(TOIProcessor& prout, string out,
     68                  TOIProcessor& prin, string in, string nom, int wbsz, bool withFlag)
    6969{
    7070  int id1 = findProcId(&prout);
  • trunk/ArchTOIPipe/Kernel/cgt.h

    r2000 r2187  
    2929  inline void  SetDebugLevel(int lev=0) {dbgLevel = lev; }
    3030 
    31   virtual TOI& Connect(TOIProcessor& prout, string& out,
    32                        TOIProcessor& prin, string& in, string nom="",
     31  virtual TOI& Connect(TOIProcessor& prout, string out,
     32                       TOIProcessor& prin, string in, string nom="",
    3333                       int wbsz=0, bool withFlag=false);
    3434  virtual TOI& Connect(TOIProcessor& prout, const char* out,
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.cc

    r2073 r2187  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: fitstoirdr.cc,v 1.40 2002-06-18 20:36:00 ansari Exp $
     5// $Id: fitstoirdr.cc,v 1.41 2002-09-09 15:33:14 aubourg Exp $
    66
    77#include "fitstoirdr.h"
     
    172172    snEnd = forcedMaxIn;
    173173  }
     174  /* init */
     175  //  snMin=snBegin;     NNNNNOOOOOONNNNNN !!!!
     176  //  snMax=snEnd;
    174177  cout << "FITSTOIReader range " << snBegin << " -> " << snEnd << endl;
    175178}
     
    188191  return snEnd < lastReq ? snEnd : lastReq;
    189192}
     193
     194
     195// ajout vf 31/07/2002
     196bool FITSTOIReader::checkSampleLimits(long& min, long& max, int pass)
     197{
     198  bool sample_ok=true;
     199  chkinit();
     200  return TOIProcessor::checkSampleLimits(min, max, pass);
     201  /* 
     202  cout << "check " << name << " in  " << min << " - " << max << " ; " << snMin << " - " << snMax << endl;
     203
     204  // on verifie qu'on peut effectivement produire
     205
     206  if (min < snBegin) {
     207    min = snBegin;
     208  }
     209
     210  if (max > snEnd) {
     211    max = snEnd;
     212  }
     213
     214
     215  // si intersection des intervals vide on leve une exception
     216  //if (min >= snEnd || max <= snBegin) {
     217  //cerr << " FITSTOIReader::checkSampleLimits(long& min long& max)/Error Sample out of bounds" << endl;
     218  //throw ParmError("  FITSTOIReader::checkSampleLimits(long& min long& max) min >= snEnd || max <= snBegin");
     219  //}
     220 
     221  // ajustements si necessaires
     222  if (min < snMin) {
     223    snMin = min;
     224  }
     225  if (max > snMax) {
     226    snMax = max;
     227  }
     228
     229
     230  min=min<snMin?snMin:min;
     231  max=max>snMax?snMax:max;
     232
     233  // cas sans contraintes, on retourne nos bornes
     234  if (min>max) {
     235    min = snBegin;
     236    max = snEnd;
     237  }
     238
     239  cout << "check " << name << " out " << min << " - " << max << " ; " << snMin << " - " << snMax << endl;
     240  //cout << "fitstoirdr : limites verifiees : " << snBegin << " , " << snEnd << " : " << sample_ok << endl;
     241  return sample_ok;
     242*/
     243}
     244
     245void FITSTOIReader::calcSampleLimits(long& min, long& max)
     246{
     247  chkinit();
     248  cout << "calc  " << name << " in  " << min << " - " << max << " ; " << snBegin << " - " << snEnd << endl;
     249 
     250  min=min<snMin?snMin:min;
     251  max=max>snMax?snMax:max;
     252  snBegin=snMin;
     253  snEnd=snMax;
     254  cout << "calc  " << name << " out " << min << " - " << max << " ; " << snBegin << " - " << snEnd << endl;
     255  //cout << "fitstoirdr : limites temporaires calculees : " << snBegin << " , " << snEnd << endl;
     256
     257}
     258// fin ajout vf
     259
     260
    190261
    191262void FITSTOIReader::addFile(string fn) {
     
    431502
    432503}
     504
     505
     506// affichage des limites
     507void FITSTOIReader::printLimits()
     508{
     509  cout << "fitstoirdr " << name <<" : limites calculees : " << snBegin << " , " << snEnd << endl;
     510}
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
  • trunk/ArchTOIPipe/Kernel/fitstoirdr.h

    r2058 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: fitstoirdr.h,v 1.12 2002-06-18 12:21:08 ansari Exp $
     7// $Id: fitstoirdr.h,v 1.13 2002-09-09 15:33:14 aubourg Exp $
    88
    99
     
    4242 
    4343  inline int_8  ProcessedSampleCount() const { return totnscount; }
     44  virtual void printLimits();
    4445
    4546protected:
    4647  virtual int   calcMinOut();
    4748  virtual int   calcMaxOut();
     49 
     50  // ajout vf 31/07/2002
     51  virtual bool checkSampleLimits(long& min, long& max, int pass);
     52  virtual void calcSampleLimits(long& min, long& max);
    4853
    4954  virtual void run1();
     
    6065
    6166  int       ncols;   // including flags. getNOut() is # of tois.
    62   int       snBegin; // first file
    63   int       snEnd;   // last file
     67 
     68  // supression de la redefinition vf 23/08/2002
     69  //int       snBegin; // first file
     70  //int       snEnd;   // last file
    6471
    6572  bool      implicitSN;
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.cc

    r2041 r2187  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: fitstoiwtr.cc,v 1.21 2002-06-03 14:23:39 ansari Exp $
     5// $Id: fitstoiwtr.cc,v 1.22 2002-09-09 15:33:14 aubourg Exp $
    66
    77#include "fitstoiwtr.h"
     
    6161  cout << "fitstoiwriter running" << endl;
    6262  // init done here
    63   afterinit();
    64   inited=true;
     63  if (!inited) {
     64    afterinit();
     65    inited=true;
     66  }
    6567
    6668  int ndata = inIx.size();
     
    194196
    195197
    196 
    197 
    198 
    199 
    200 
     198bool FITSTOIWriter::checkSampleLimits(long &min, long &max, int pass)
     199{
     200  if (!inited) {
     201    afterinit();
     202    inited=true;
     203  }
     204  return TOIProcessor::checkSampleLimits(min, max, pass);
     205}
     206
     207
  • trunk/ArchTOIPipe/Kernel/fitstoiwtr.h

    r2041 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: fitstoiwtr.h,v 1.12 2002-06-03 14:23:39 ansari Exp $
     7// $Id: fitstoiwtr.h,v 1.13 2002-09-09 15:33:14 aubourg Exp $
    88
    99
     
    3434  inline void   setLongFlagPrefix(bool fg = true) { longfgprefix = fg; }
    3535  inline int_8  ProcessedSampleCount() const { return totnscount; }
     36
     37protected:
     38  virtual bool checkSampleLimits(long &min, long &max, int pass);
     39
    3640 
    3741private:
  • trunk/ArchTOIPipe/Kernel/toi.cc

    r1762 r2187  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toi.cc,v 1.11 2001-11-13 16:22:47 aubourg Exp $
     5// $Id: toi.cc,v 1.12 2002-09-09 15:33:14 aubourg Exp $
    66
    77#include "toiprocessor.h"
     
    7676}
    7777
     78
     79// ajout vf 31/07/2002
     80bool TOI::checkSampleLimits(long& Min, long& Max, int pass)
     81{
     82  // propagation de la sortie du TOI vers son entree pour test des limites
     83  return producer->checkSampleLimits(Min, Max, pass);
     84}
     85
     86
     87// fin ajout vf
     88
     89
     90
     91
     92
     93
     94
     95
    7896/*
    7997 RZCMV   ----- l'interface va etre modifiee, NE PAS UTILISER
     
    216234
    217235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
  • trunk/ArchTOIPipe/Kernel/toi.h

    r1993 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: toi.h,v 1.16 2002-05-09 20:22:37 ansari Exp $
     7// $Id: toi.h,v 1.17 2002-09-09 15:33:15 aubourg Exp $
    88
    99#ifndef TOI_H
     
    9090  //  Fin rajouts Reza 12/3/2001 ------
    9191
    92   TOIProcessor*         producer;
    93   vector<TOIProcessor*> consumers;
     92  // variables pour propagation
     93  TOIProcessor*         producer;       //producteur du toi
     94  vector<TOIProcessor*> consumers;      //consomateurs du toi
     95 
    9496  double                defaultValue;
    9597  bool  syncOldWay;
     
    141143  inline void cleanWaitGet() { fgsigget = fgwaitget = false; }
    142144
     145
     146  // ajout vf 31/07/2002
     147  bool checkSampleLimits(long &Min, long &Max, int pass);
     148
     149
     150
     151
     152
    143153public:
    144154  inline int  getCountWaitPut() const { return countwaitput; }
     
    156166
    157167#endif
     168
     169
     170
     171
     172
     173
  • trunk/ArchTOIPipe/Kernel/toimanager.cc

    r2133 r2187  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toimanager.cc,v 1.16 2002-07-26 08:52:43 vfebvre Exp $
     5// $Id: toimanager.cc,v 1.17 2002-09-09 15:33:15 aubourg Exp $
    66
    77#include "toimanager.h"
     
    1010#include <iostream.h>
    1111#include <unistd.h>
     12#include <map>
    1213
    1314#ifndef MAXINT
     
    1819  reqBegin = 0;
    1920  reqEnd = MAXINT;
     21
     22  // -----------ajout cgt vf 19/08/2002
     23  // par defaut TOISegmented
     24  selectTOISegmented(1024, 20);
     25  // ----------- fin ajout cgt
     26
    2027}
    2128
     
    2734}
    2835
     36// ajout vf 26/07/2002
     37
    2938// enregistrement d'un processeur dans la liste des processeurs pour une execution en groupe
    3039
     
    3746
    3847
    39 // demarrage de tous les processeurs
     48// demarrage de tous les processeurs et verification auto des samplenum pour chaque processeur parametre
    4049
    4150void TOIManager::startAll() {
     51  // verification des samplenum
     52  bool samples_ok=checkSamplesLimits(1);
     53  if (samples_ok) {
     54    cout << "All limits ok" << endl << "Starting processors" << endl;
     55  } else {
     56    cout << "One or more limits ajusted for execution" << endl << "Starting processors" << endl;
     57  }
     58
     59  // mise a jour des limites apres verification
     60  checkSamplesLimits(2);
     61  checkSamplesLimits(3);
     62   
     63  // debogage affichage des limites apres calcul
    4264  for (vector<TOIProcessor*>::iterator i = processors.begin();
    4365       i != processors.end(); i++) {
    4466    TOIProcessor* proc = *i;
    45     cout << "******************" <<  endl;
    46     cout << "starting processor  " <<  endl;
    47     cout << "******************" << endl;
     67    proc->printLimits();
     68  }
     69
     70  // demarrage
     71  for (vector<TOIProcessor*>::iterator i = processors.begin();
     72       i != processors.end(); i++) {
     73    TOIProcessor* proc = *i;
     74    cout << "**********************" <<  endl;
     75    cout << "starting processor " <<  endl;
    4876    proc->start();
    4977    cout << "processor started " << endl;
    50     cout << "******************" << endl;
    51   }
    52 }
    53 
    54 
     78  }
     79  cout << "**********************" << endl;
     80}
     81
     82bool TOIManager::checkSamplesLimits(int pass)
     83{
     84  bool processor_ok=true;
     85  bool samples_ok=true;
     86  for (vector<TOIProcessor*>::iterator i = processors.begin();
     87       i != processors.end(); i++) {
     88    TOIProcessor* proc = *i;
     89    cout << "testing processor limits  " <<  endl;
     90    // test du processeur
     91   
     92    // test seulement pour les processor cle
     93    //if (proc->getRequested()) {
     94      processor_ok = proc->checkSampleLimits(pass);
     95    //}
     96   
     97    if (processor_ok) {
     98      cout << "processor limits ok " << endl;
     99    } else {
     100      cout << "processor limits ajusted" << endl;
     101      samples_ok = false;
     102    }
     103  }
     104  return samples_ok;
     105}
     106
     107// fin ajout vf
    55108
    56109void TOIManager::setRequestedSample(int begin, int end) {
     
    85138  }
    86139}
     140
     141
     142// -----------ajout cgt vf 19/08/2002
     143
     144
     145void TOIManager::selectTOISegmented(int bufsz, int maxseg)
     146{
     147  fgSegmented = true;
     148  segBuffsz = bufsz;
     149  segMaxseg = maxseg;
     150}
     151
     152void TOIManager::selectTOISeqBuffered(int wsz)
     153{
     154  fgSegmented = false;
     155  segBuffsz = wsz;
     156}
     157
     158// methode connect de cgt simplifiee et corrigee
     159TOI& TOIManager::connect(TOIProcessor& prout, string& out,
     160                  TOIProcessor& prin, string& in, string nom, int wbsz, bool withFlag)
     161{
     162  TOI* toi;
     163  if (nom.length() < 1) {
     164    char buff[128];
     165    sprintf(buff, "TOI%s_[%s-%s]", nom, in, out);
     166    nom = buff;
     167  }
     168  if (wbsz < 16)   wbsz = segBuffsz;
     169 
     170  // ajout test pour eviter de creer 2 tois en sortie
     171  if ((toi=prout.getOutToi(out)) == NULL) {
     172    //cout << "toi cree" << endl;
     173    if (fgSegmented) toi = new TOISegmented(nom, wbsz, segMaxseg);
     174    else toi = new TOISeqBuffered(nom, wbsz);
     175    // on ajoute le toi de sortie
     176    prout.addOutput(out, toi);
     177  } else {
     178    //cout << "toi deja cree stop" << endl;
     179  }
     180
     181  if (withFlag) { // Si c'est un FITSTOIWriter
     182    FITSTOIWriter* ftw = dynamic_cast< FITSTOIWriter* >(&prin);
     183    if (ftw) ftw->addInput(in, toi, withFlag);
     184    else prin.addInput(in, toi);
     185  }
     186  else prin.addInput(in, toi);
     187  return(*toi);
     188}
     189
     190
     191TOI& TOIManager::connect(TOIProcessor& prout, const char* out,
     192                  TOIProcessor& prin, const char* in, string nom, int wbsz, bool withFlag)
     193{
     194  string outs = out; 
     195  string ins = in;
     196  return connect(prout, outs, prin, ins, nom, wbsz, withFlag);
     197}
     198
     199// ----------- fin ajout cgt
     200
    87201
    88202
     
    164278
    165279}
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
  • trunk/ArchTOIPipe/Kernel/toimanager.h

    r2133 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: toimanager.h,v 1.14 2002-07-26 08:52:43 vfebvre Exp $
     7// $Id: toimanager.h,v 1.15 2002-09-09 15:33:15 aubourg Exp $
    88
    99
     
    1717#include "toiprocessor.h"
    1818
     19
     20// -----------ajout cgt vf 19/08/2002
     21
     22#include "toi.h"
     23
     24#include <typeinfo>
     25#include "toiseqbuff.h"
     26#include "toisegment.h"
     27#include "fitstoiwtr.h"
     28
     29#ifdef WITH_SOPHYA
     30#include "pexceptions.h"
     31#else
     32#include "apexceptions.h"
     33#endif
     34
     35#include <pthread.h>
     36// ----------fin ajout cgt
     37
     38
     39
    1940using namespace std;
    2041
     
    2647  int getRequestedEnd();
    2748 
     49  // ajout vf 25/07/2002
    2850  void startAll();
     51  bool checkSamplesLimits(int pass);
     52
    2953  void waitForAll();
    3054
    3155  void joinAll();  // deprecated. Use waitForAll();
    3256   
     57 
     58  // ajout cgt vf 19/08/2002
     59 
     60  void    selectTOISegmented(int bufsz=1024, int maxseg=20);
     61  void    selectTOISeqBuffered(int wsz=8192);
     62
     63  virtual TOI& connect(TOIProcessor& prout, string& out,
     64                       TOIProcessor& prin, string& in, string nom="",
     65                       int wbsz=0, bool withFlag=false);
     66  virtual TOI& connect(TOIProcessor& prout, const char* out,
     67                       TOIProcessor& prin, const char* in, string nom="",
     68                       int wbsz=0, bool withFlag=false);
     69
     70  // fin ajout cgt
     71
     72
     73
     74
    3375protected:
    3476  TOIManager();
     
    4082  void addThread(pthread_t*);
    4183
     84  // ajout vf 25/07/2002
     85 
    4286  vector<TOIProcessor*> processors;
    4387  void registerProcessor(TOIProcessor* proc);
    4488
     89  friend class TOIProcessor;
    4590
    46   friend class TOIProcessor;
     91  // ajout cgt vf 19/08/2002
     92   
     93  bool fgSegmented;     // type de toi
     94  int segBuffsz, segMaxseg;
     95
     96  // fin ajout cgt
     97
    4798};
    4899
     
    79130};
    80131
     132
     133
     134
    81135#endif
    82136
  • trunk/ArchTOIPipe/Kernel/toiprocessor.cc

    r2133 r2187  
    33//                               Christophe Magneville
    44//                               Reza Ansari
    5 // $Id: toiprocessor.cc,v 1.25 2002-07-26 08:52:43 vfebvre Exp $
     5// $Id: toiprocessor.cc,v 1.26 2002-09-09 15:33:15 aubourg Exp $
    66
    77#include "toiprocessor.h"
     
    4646  wontNeedValue = -1;
    4747
     48 
     49  // ajout vf 23/07/2002
     50  cout << "Creating processor" << endl;
    4851  // Pour referencer un TOIProcessor, il faut recuperer le TOIManager correspondant
    4952  TOIManager::getManager()->registerProcessor(this);
     53 
     54  // initialisation des limites du sample (par defaut tout le fichier)
     55  snBegin = 0;
     56  snEnd = MAXINT;
     57  snMin=MAXINT;
     58  snMax=0;
     59  // par defaut aucune condition
     60  requestedSample = false;
    5061
    5162}
     
    8394
    8495int TOIProcessor::getMinOut() {
     96  /*
    8597  //cout << name << "minout" << endl;
    8698  if (minOut < 0)  minOut = calcMinOut();
    8799  //cout << name << "minout=" << minOut << endl;
    88100  return minOut;
     101  */
     102  return snBegin + lowExtra;
    89103}
    90104
    91105int TOIProcessor::getMaxOut() {
     106  /*
    92107  //cout << name << "maxout" << endl;
    93108  if (maxOut < 0) maxOut = calcMaxOut();
    94109  //cout << name << "maxout=" << maxOut << endl;
    95110  return maxOut;
     111  */
     112  return snEnd - upExtra;
    96113}
    97114
     
    105122
    106123int TOIProcessor::getMinIn() {
     124  /*
    107125  int nIn = inIx.size();
    108126  int minIn = 0;
     
    115133  if (forcedMinIn > 0 && forcedMinIn > minIn) minIn = forcedMinIn;
    116134  return minIn;
     135  */
     136  return snBegin;
    117137}
    118138
    119139int TOIProcessor::getMaxIn() {
     140  /*
    120141  int_4 nIn = inIx.size();
    121142  int_4 maxIn = MAXINT;
     
    128149  if (forcedMaxIn > 0 && forcedMaxIn < maxIn) maxIn = forcedMaxIn;
    129150  return maxIn;
     151  */
     152  return snEnd;
    130153}
    131154
     
    447470
    448471
    449 
    450 
    451 
    452 
    453 
    454 
    455 
     472// ajout vf 29/07/2002
     473
     474// parametrage de l'echantillon a produire (sans verification)
     475void TOIProcessor::setRequestedSample(long begin, long end) {
     476  requestedSample = true;
     477  snBegin = begin;
     478  snEnd   = end;
     479  //  snMin = snBegin;
     480  //  snMax = snEnd;
     481}
     482
     483
     484bool TOIProcessor::checkSampleLimits(int pass)
     485{
     486  long minTmp=MAXINT;
     487  long maxTmp=-1;
     488
     489  return checkSampleLimits(minTmp, maxTmp, pass);
     490 
     491  cout << "toiprocessor : limites verifiees : " << snBegin << " , " << snEnd << " : " << endl;
     492}
     493
     494
     495
     496
     497bool TOIProcessor::checkSampleLimits(long& min, long& max, int pass)
     498{
     499  bool sample_input_ok=true;
     500  bool sample_ok=true;
     501
     502  /*  cout << "check " << pass << " " << name << " in  " << min << " - " << max << " ; "
     503       << snMin << " - " << snMax << " ; "
     504       << snBegin << " - " << snEnd << endl;*/
     505
     506  if (pass == 3) {
     507    if (snMin < snMax) {
     508      snBegin = snMin;
     509      snEnd   = snMax;
     510    }
     511    return true;
     512  }
     513
     514  // on verifie qu'on peut effectivement produire
     515
     516  if (min < snBegin) {
     517    min = snBegin;
     518  }
     519
     520  if (max > snEnd) {
     521    max = snEnd;
     522  }
     523
     524  bool noConst = (min>max);
     525
     526  if (pass == 2 && noConst) {
     527    min = snBegin;
     528    max = snEnd;
     529  }
     530
     531 
     532  int n = inIx.size();
     533  // parcours de toutes les entrees et mise a jour au plus restrictif
     534  for (int i=0; i<n; i++) {
     535    TOI* toi = inTOIs[i];
     536    if (toi) {
     537      // mise a jour des limites avec les marges si definies
     538      long min_Input;
     539      long max_Input;
     540      if (min>0) {
     541        min_Input = min - lowExtra;
     542      } else {
     543        min_Input = min;
     544      }
     545      if (max<MAXINT) {
     546        max_Input = max + upExtra;
     547      } else {
     548        max_Input = max;
     549      }
     550      // propagation des limites
     551      sample_input_ok = toi->checkSampleLimits(min_Input, max_Input, pass);
     552
     553      //Ajustement des limites si plus restrictif
     554      if (min < max) {
     555        // On nous a demande des bornes ->
     556        if ((min_Input + lowExtra)  > min) {
     557          min = min_Input + lowExtra;
     558        }
     559        if ((max_Input - upExtra) < max) {
     560          max = max_Input - upExtra;
     561        }
     562      } else {
     563        // On nous demande tout ce qu'on peut faire -> MAJ snBegin
     564        if ((min_Input + lowExtra) > snBegin) {
     565          snBegin = min_Input + lowExtra;
     566        }
     567        if ((max_Input - upExtra) < snEnd) {
     568          snEnd = max_Input - upExtra;
     569        }
     570      }
     571      if (sample_input_ok == false) {
     572        sample_ok = false;
     573      }
     574    }   
     575  } 
     576
     577 
     578 
     579 
     580  //Ajustement des limites si intervalle plus large
     581  if (!noConst) {
     582    if (min < snMin) {
     583      snMin = min;
     584    }
     585    if (max > snMax) {
     586      snMax = max;
     587    }
     588  }
     589 
     590  min=min<snMin?snMin:min;
     591  max=max>snMax?snMax:max;
     592 
     593 
     594  // cas sans contraintes, on retourne nos bornes
     595  if (min>max) {
     596    min = snBegin;
     597    max = snEnd;
     598  }
     599 
     600  /*  cout << "check " << pass << " " << name << " out " << min << " - " << max << " ; "
     601       << snMin << " - " << snMax << " ; "
     602       << snBegin << " - " << snEnd << endl;*/
     603  return sample_ok;
     604}
     605
     606
     607
     608
     609// pour verification si le processeur est parametre
     610bool TOIProcessor::getRequested()
     611{
     612  return requestedSample;
     613}
     614
     615// affichage des limites
     616void TOIProcessor::printLimits()
     617{
     618  cout << "toiprocessor " << name <<" : limites calculees : " << snBegin << " , " << snEnd << endl;
     619}
     620
     621TOI* TOIProcessor::getOutToi(string sortie)
     622{
     623  // recherche du nom de la sortie et verification si le toi existe deja
     624  map<string, int>::iterator i = outIx.find(sortie);
     625  if (i == outIx.end()) {
     626    return NULL;
     627  } else {
     628    return outTOIs[(*i).second];
     629  }
     630}
     631
     632
     633
     634
     635
     636
     637
     638
     639
  • trunk/ArchTOIPipe/Kernel/toiprocessor.h

    r2000 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: toiprocessor.h,v 1.19 2002-05-14 13:06:57 ansari Exp $
     7// $Id: toiprocessor.h,v 1.20 2002-09-09 15:33:15 aubourg Exp $
    88
    99
     
    5050  virtual int   getMinOut();
    5151  virtual int   getMaxOut();
     52 
     53  // rajout vf 29/07/2002
     54  virtual void setRequestedSample(long begin, long end);
     55  virtual bool getRequested();
     56  virtual bool checkSampleLimits(int pass);
     57  virtual void printLimits();
     58
     59// rajout vf 29/07/2002
     60protected:
     61  bool requestedSample;
     62  long snBegin;
     63  long snEnd;
     64  long snMin;
     65  long snMax;
     66  virtual bool checkSampleLimits(long &min, long &max, int pass);
     67
     68
    5269  // Les methodes qui suivent peut etre appelees par run
    5370protected:
     
    120137  int           lastAWN;
    121138
     139
    122140public:
    123141  // Appele par les assembleurs de pipeline
     
    142160  void setMinSn(int n) {forcedMinIn = n;}
    143161  void setMaxSn(int n) {forcedMaxIn = n;}
     162
     163  // ajout vf 23/08/2002
     164  TOI* getOutToi(string sortie);
     165
     166  virtual void setName(string n) {name=n;}
    144167
    145168protected:
     
    184207#endif
    185208
     209
     210
     211
     212
     213
     214
     215
  • trunk/ArchTOIPipe/Processors/Makefile.in

    r1957 r2187  
    4848
    4949SRCFILES=toisqfilter.cc nooppr.cc correl.cc nrutil.c dlubksb.c dludcmp.c dtoeplz.c \
    50          wienerdecor.cc
     50         wienerdecor.cc toidelay.cc toimedfilter.cc
    5151FILES=$(patsubst %.c,%.o,$(SRCFILES:.cc=.o))
    5252
  • trunk/ArchTOIPipe/Processors/wienerdecor.cc

    r2127 r2187  
    1111  nsamples = n;
    1212  lcorr = l;
     13  doNotLookAt();
    1314}
    1415
     
    3536  double* y = new double[lcorr+1];  // corr vector
    3637  double* window = new double[lcorr];
     38  uint_8* fwind  = new uint_8[lcorr];
    3739  double* filter = new double[lcorr];
    3840  for (int i=0; i<lcorr; i++) filter[i]=0;
     
    4143  int snstartcorr = -1;
    4244 
    43   while (sn < sne) {
     45  while (sn <= sne) {
    4446    if (snstartcorr < 0 ||
    4547        (snstartcorr + nsamples < sn && sn+nsamples < sne)) {
     
    4850      corr.reset();
    4951      autocorr.reset();
    50       int i;
    51       for (i=sn; i<sn+nsamples; i++) {
    52         double sig = getData(0, i);
    53         double prb = getData(1, i);
     52      cout << "computing correl " << sn << " -> " << sn+nsamples << endl;
     53      for (int i=sn; i<sn+nsamples; i++) {
     54        uint_8 flag1, flag2;
     55        double sig, prb;
     56        getData(0, i, sig, flag1);
     57        if (flag1 & flgNotLookAt) continue;
     58        getData(1, i, prb, flag2);
     59        if (flag2 & flgNotLookAt) continue;
     60        if ((i-sn)%100 == 0) {
     61          //cout << " sig/prb : " << i << " : " << sig << " / " << prb
     62          //     << hex << " " << flag1 << " " << flag2 << dec << endl;
     63        }
    5464        corr.push(i, sig, prb);
    5565        autocorr.push(i, prb);
    5666      }
    5767      // correlation is recomputed, let's recompute the wiener filter from wiener equations
    58       for (i=0; i<lcorr; i++) {
     68      {for (int i=0; i<lcorr; i++) {
    5969        r[lcorr+i] = r[lcorr-i] = autocorr.correl(i);
    6070        y[i+1] = corr.correl(i);
    61       }
     71        //cout << "r " << lcorr+i << " " << lcorr -i << " = " << r[lcorr+i]
     72        //    << "\n"
     73        //    << "y " << i+1 << " = " << y[i+1] << endl;
     74      }}
    6275      dtoeplz(r,w,y,lcorr);
    6376      if (!isnan(w[1])) {
     
    6982      }
    7083      cout << "Wiener filter : " << sn << "\n ";
    71       for (i=0; i<lcorr; i++) {
     84      {for (int i=0; i<lcorr; i++) {
    7285        cout << filter[i] << " ";
    73       }
     86      }}
    7487     cout << endl;
    7588    }
    7689
    7790    if (sn >= snb+lcorr-1) {
    78       getData(1, sn-lcorr+1, lcorr, window);
     91      getData(1, sn-lcorr+1, lcorr, window, fwind);
     92      uint_8 flag = 0;
    7993      double outSig = 0;
    8094      for (int i=0; i<lcorr; i++) {
    8195        outSig += filter[i] * window[lcorr-1 - i];
     96        flag |= fwind[lcorr-1 -i];
    8297      }
    83       putData(0, sn, getData(0, sn) - outSig);
    84       putData(1, sn, outSig);
     98      putData(0, sn, getData(0, sn) - outSig, flag);
     99      putData(1, sn, outSig, flag);
    85100    }
    86101    sn++;
  • trunk/ArchTOIPipe/Processors/wienerdecor.h

    r1944 r2187  
    55//                               Christophe Magneville
    66//                               Reza Ansari
    7 // $Id: wienerdecor.h,v 1.1 2002-03-23 23:05:22 aubourg Exp $
     7// $Id: wienerdecor.h,v 1.2 2002-09-09 15:33:15 aubourg Exp $
    88
    99#ifndef WIENERDECOR_H
     
    2020  virtual void run();
    2121
    22   //  inline void doNotLookAt(uint_8 flag=FlgToiAll) {flgNotLookAt = flag;}
     22  inline void doNotLookAt(uint_8 flag=FlgToiAll) {flgNotLookAt = flag;}
    2323
    2424protected: 
    2525  int nsamples;
    2626  int lcorr;
    27   // uint_8 flgNotLookAt;
     27  uint_8 flgNotLookAt;
    2828};
    2929
  • trunk/ArchTOIPipe/TestPipes/Makefile.in

    r1957 r2187  
    5252
    5353ifeq ($(USE_SOPHYA),1)
    54   LDLIBS=-L.. -latsop -latkern -latproc @cfitslibdir@ -lcfitsio $(LIBS)
     54#  LDLIBS=-L.. -latsop -latkern -latproc @cfitslibdir@ -lcfitsio $(LIBS)
     55  LDLIBS=-L.. -latsop -latkern -latproc $(LIBS)
    5556  LIBDEPS=../libatsop.a ../libatkern.a ../libatproc.a
    5657else
Note: See TracChangeset for help on using the changeset viewer.