Changeset 1735 in Sophya


Ignore:
Timestamp:
Nov 6, 2001, 7:01:46 PM (24 years ago)
Author:
cmv
Message:

add FlagAround + enum FlagToiAll cmv 6/11/2001

Location:
trunk/ArchTOIPipe
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ArchTOIPipe/Kernel/flagtoidef.h

    r1516 r1735  
    1515// Sample Value has been interpolated/Replaced ...
    1616  FlgToiInterp  =  (unsigned long long)1 << 5,
     17// Sample killed because near a "flaggued" one ...
     18  FlgToiAround  =  (unsigned long long)1 << 6,
     19// All bit to one ...
     20  FlgToiAll     =  (unsigned long long)~0
    1721};
    1822
  • trunk/ArchTOIPipe/ProcWSophya/ktoibad.cc

    r1733 r1735  
    104104
    105105  getData(0,sn,bolog,fgbolog);
    106   if(fgbolog && flgNotLookAt) {
     106  if(fgbolog & flgNotLookAt) {
    107107    putData(0,sn,bolog,fgbolog);
    108108    continue;
     
    218218return;                                                                           
    219219}
     220
     221
     222
     223
     224
     225
     226
     227////////////////////////////////////////////////////////////////////////
     228// Flag des sample autour d'un sample deja flaggue :
     229// INPUT:
     230// lm : longueur a flagguer de part et d'autre du mauvais sample
     231//      <---lm---><bad_sample><---lm--->
     232////////////////////////////////////////////////////////////////////////
     233
     234////////////////////////////////////////////////////////////////////////
     235FlagAround::FlagAround(uint_4 lm,uint_8 flgs)
     236{
     237 // Mise en forme des arguments
     238 LSide = lm;
     239
     240 SetFlag();
     241 SetFlagAroundFlag(flgs);
     242}
     243
     244FlagAround::~FlagAround()
     245{
     246}
     247
     248////////////////////////////////////////////////////////////////////////
     249void FlagAround::Print(ostream & os)
     250{
     251 os<<"FlagAround::Print"
     252   <<" LSide="<<LSide
     253   <<" flgSample="<<flgSample<<" flgAround="<<flgAround
     254   <<endl;
     255}
     256
     257////////////////////////////////////////////////////////////////////////
     258void FlagAround::init() {
     259  cout << "FlagAround::init" << endl;
     260  declareInput("BoloIn");       // input index 0
     261  declareOutput("BoloOut");     // output index 0
     262
     263  int_4 lbuff = 2*LSide +10;
     264  if(neededHistory<lbuff) setNeededHistory(lbuff);
     265}
     266
     267////////////////////////////////////////////////////////////////////////
     268void FlagAround::run()
     269{
     270long snb = getMinIn();
     271long sne = getMaxIn();
     272
     273if(snb>sne) {
     274  cout<<"FlagAround::run() - Bad sample interval"<<snb<<" , "<<sne<<endl;
     275  throw ParmError("FlagAround::run() - Bad sample interval");
     276}
     277if(!checkInputTOIIndex(0)) {
     278  cout<<"FlagAround::run() - Input TOI (BoloIn) not connected! "<<endl;
     279  throw ParmError("FlagAround::run() Input TOI (BoloIn) not connected!");
     280}
     281if(!checkOutputTOIIndex(0)) {
     282  cout<<"FlagAround::run() - Output TOI (BoloOut) not connected! "<<endl;
     283  throw ParmError("FlagAround::run() Output TOI (BoloOut) not connected!");
     284}
     285
     286//---------------------------------------------------------
     287try {
     288
     289cout<<"FlagAround::run(): SampleNum de "<<snb<<" a "<<sne<<endl;
     290uint_4 nflag=0, nflagged=0, nflagalready=0;
     291
     292// Un peu boeuf! On pourrait optimiser!
     293// Si on ne tue pas (LSide=0), alors juste un transfert de donnees
     294for(int_4 sn=snb;sn<=sne;sn++) {
     295  r_8 bolo; uint_8 fgbolo=0;
     296  getData(0,sn,bolo,fgbolo);
     297  if(fgbolo&flgSample) { // Pixel flaggue flgSample
     298    nflag++;
     299  } else if(fgbolo&flgAround) { // Pixel deja flagge around?
     300    nflagalready++;
     301  } else if(LSide>0) { // Pixel a flagguer?
     302    int_4 ideb = sn-LSide, ifin = sn+LSide;
     303    for(int_4 i=ideb;i<=ifin;i++) { // Y a t-il un "mauvais" pixel autour?
     304      if(i<snb || i>sne || i==sn) continue;
     305      r_8 b; uint_8 fg=0;
     306      getData(0,i,b,fg);
     307      if(fg&flgSample) {fgbolo |= flgAround; nflagged++; break;}
     308    }
     309  }
     310  putData(0,sn,bolo,fgbolo);
     311}
     312cout<<"FlagAround::run(): Fin de boucle: nflag="<<nflag
     313    <<" nflagged="<<nflagged<<" (already="<<nflagalready
     314    <<") / tot="<<sne-snb+1<<endl;
     315
     316//---------------------------------------------------------
     317} catch (PException & exc) {
     318  cout<<"FlagAround: Catched Exception "<<(string)typeid(exc).name()
     319      <<"\n .... Msg= "<<exc.Msg()<<endl;
     320}
     321
     322return;                                                                           
     323}
  • trunk/ArchTOIPipe/ProcWSophya/ktoibad.h

    r1733 r1735  
    99//-- Pour rechercher les glitches
    1010//   toi BoloIn ---> |FlagGlitch | ---> toi BoloOut
    11 
    1211class FlagGlitch : public TOIProcessor {
    1312public:
     
    4342};
    4443
     44//-- Pour flagguer les samples autour de samples deja flaggues
     45//   toi BoloIn ---> |FlagAround | ---> toi BoloOut
     46class FlagAround : public TOIProcessor {
     47public:
     48  FlagAround(uint_4 lm,uint_8 flgs=FlgToiAll);
     49  virtual ~FlagAround();
     50
     51  virtual void  init(void);
     52  virtual void  run(void);
     53
     54  //! Flagguer les samples avec la valeur flag
     55  inline void SetFlag(uint_8 flag=FlgToiAround) {flgAround = flag;}
     56  //! Flagguer autour des samples ayant la valeur flag
     57  inline void SetFlagAroundFlag(uint_8 flag=FlgToiAll) {flgSample = flag;}
     58  //! Print
     59  void Print(ostream & os);
     60  inline void Print(void) {Print(cout);}
     61
     62protected:
     63  uint_8 flgSample,flgAround;
     64  uint_4 LSide;
     65};
     66
    4567#endif
  • trunk/ArchTOIPipe/TestPipes/tstktoibad.cc

    r1733 r1735  
    1616 <<" -b label_bolomuv"
    1717 <<" -g lg,lm,nsg,bupd"
     18 <<" -a lmaround"
    1819 <<" -p lp,sn1,sn2"
    1920 <<endl;
     
    2425 int_4 sdeb=0,sfin=-1;
    2526 int_4 lp=1,sn1=-1,sn2=-1;
    26  uint_4 lg=3,lm=15,bupd=1000;
     27 uint_4 lg=3,lm=15,bupd=1000,lmaround=10;
    2728 r_8 nsg=5.;
    2829 char *label_bolomuv = "boloMuV";
    2930  int c;
    30  while((c = getopt(narg,arg,"hs:g:b:p:")) != -1) {
     31 while((c = getopt(narg,arg,"hs:g:b:a:p:")) != -1) {
    3132  switch (c) {
    3233  case 's' :
     
    3536  case 'g' :
    3637   sscanf(optarg,"%d,%d,%lf,%d",&lg,&lm,&nsg,&bupd);
     38   break;
     39  case 'a' :
     40   sscanf(optarg,"%d",&lmaround);
    3741   break;
    3842  case 'b' :
     
    7377 deglitch.Print();
    7478
     79 FlagAround flgaround(lm);
     80 flgaround.Print();
     81
    7582 // Creation des tuyaux et des connections associees
    7683 int taille = 8192;
    77  // tuyau bolo pour entree processeur
    78  TOISegmented * boloin = new TOISegmented("tuyau_bolo_in",taille);
    79  rfits.addOutput(label_bolomuv,boloin);
    80  deglitch.addInput("BoloIn",boloin);
     84 // tuyau bolo pour entree processeur FlagGlitch
     85 TOISegmented * toi1 = new TOISegmented("tuyau_bolo_in1",taille);
     86 rfits.addOutput(label_bolomuv,toi1);
     87 deglitch.addInput("BoloIn",toi1);
    8188
    82  // tuyau bolo pour sortie processeur
    83  bool writeflag=true;
    84  TOISegmented * boloout = new TOISegmented("tuyau_bolo_out",taille);
    85  deglitch.addOutput("BoloOut",boloout);
    86  wfits.addInput(label_bolomuv,boloout,writeflag);
     89 // tuyau bolo pour entree processeur FlagAround
     90 TOISegmented * toi2 = new TOISegmented("tuyau_bolo_in2",taille);
     91 deglitch.addOutput("BoloOut",toi2);
     92 flgaround.addInput("BoloIn",toi2);
     93
     94 // tuyau bolo pour entree fits writer
     95 TOISegmented * toiout = new TOISegmented("tuyau_bolo_out",taille);
     96 flgaround.addOutput("BoloOut",toiout);
     97 wfits.addInput(label_bolomuv,toiout,true);
    8798
    8899 // Print de status avant lancement des taches:
     
    92103 wfits.PrintStatus(cout); 
    93104 cout<<"----- TOISegmented::PrintStatus() : -----"<<endl;
    94  boloin->PrintStatus(cout); 
    95  boloout->PrintStatus(cout); 
     105 toi1->PrintStatus(cout); 
     106 toi2->PrintStatus(cout); 
     107 toiout->PrintStatus(cout); 
    96108 cout<<"-----FlagGlitch ::PrintStatus() : -----"<<endl;
    97109 deglitch.PrintStatus(cout); 
     110 cout<<"-----FlagAround ::PrintStatus() : -----"<<endl;
     111 flgaround.PrintStatus(cout); 
    98112
    99113 // Lancement des taches
     
    102116 wfits.start();
    103117 deglitch.start();
     118 flgaround.start(); 
    104119
    105120 // Gestion de la re-connection des threads
Note: See TracChangeset for help on using the changeset viewer.