[1442] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 |
|
---|
| 3 | #ifndef SIMTOIPR_H
|
---|
| 4 | #define SIMTOIPR_H
|
---|
| 5 |
|
---|
| 6 | #include "toiprocessor.h"
|
---|
| 7 |
|
---|
| 8 | // --------- Un deglitcheur simple
|
---|
| 9 | // Dans chaque fenetre de largeur de wsz
|
---|
| 10 | // if (val > Mean(Window)+ns*Sigma(Window)) val = Mean(Window)
|
---|
| 11 | // Si Pas plus de maxnpt points remplissants cette condition
|
---|
| 12 |
|
---|
| 13 | class SimpleDeglitcher : public TOIProcessor {
|
---|
| 14 | public:
|
---|
| 15 | SimpleDeglitcher(int wsz=64, double ns=3, int maxnpt=5);
|
---|
| 16 | virtual ~SimpleDeglitcher();
|
---|
| 17 |
|
---|
| 18 | virtual void init();
|
---|
| 19 | virtual void run();
|
---|
| 20 |
|
---|
| 21 | inline int WSize() const { return wsize; }
|
---|
| 22 | inline double NbSigmas() const { return nsig; }
|
---|
| 23 | inline int MaxPoints() const { return maxpoints; }
|
---|
| 24 |
|
---|
| 25 | inline int TotalSampleCount() const { return totnscount; }
|
---|
| 26 | inline int GlitchCount() const { return glcount; }
|
---|
| 27 | inline int GlitchSampleCount() const { return glnscount; }
|
---|
| 28 |
|
---|
[1443] | 29 | virtual void PrintStatus(ostream & os) ; // const plus tard
|
---|
| 30 |
|
---|
[1442] | 31 | protected:
|
---|
| 32 | int totnscount; // Nombre total d'echantillon processe
|
---|
| 33 | int glnscount; // Nombre total de glitch
|
---|
| 34 | int glcount; // Nombre de glitch detecte
|
---|
[1443] | 35 | bool deglitchdone; // Deglitch effectue
|
---|
[1442] | 36 |
|
---|
| 37 | int wsize; // Taille de fenetre de travail
|
---|
| 38 | double nsig; // Seuil en nb de sigmas
|
---|
| 39 | int maxpoints; // Nb maxi de points > ns sigmas
|
---|
| 40 | };
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | // Un filtre simple, dans le domaine temporel
|
---|
| 44 | // remplace val -> Somme(val(i)*coeff(i)) ds Fenetre
|
---|
| 45 |
|
---|
| 46 | class SimpleFilter : public TOIProcessor {
|
---|
| 47 | public:
|
---|
| 48 | enum FilterKind {
|
---|
| 49 | UserFilter=0, // User defined filter function
|
---|
| 50 | MeanFilter=1, // Replace sample by the window mean value (lowpass)
|
---|
| 51 | SumFilter=2, // Replace sample by the window sum (lowpass)
|
---|
| 52 | GaussFilter=3, // Apply a gaussian to the window samples
|
---|
| 53 | DiffFilter=4, // value -= MeanValue
|
---|
| 54 | };
|
---|
| 55 |
|
---|
| 56 | SimpleFilter(int wsz=128,
|
---|
| 57 | FilterKind fk=SimpleFilter::MeanFilter,
|
---|
| 58 | double a=1., double s=1.);
|
---|
| 59 | // SimpleFilter(int wsz, Arr_DoubleFunctionOfX f=NULL);
|
---|
| 60 | ~SimpleFilter();
|
---|
| 61 |
|
---|
| 62 | inline FilterKind Type() { return fkind; }
|
---|
| 63 |
|
---|
| 64 | inline int WSize() const { return wsize; }
|
---|
| 65 | inline int TotalSampleCount() const { return totnscount; }
|
---|
| 66 |
|
---|
[1443] | 67 | virtual void PrintStatus(ostream & os) ; // const plus tard
|
---|
| 68 |
|
---|
[1442] | 69 | virtual void init();
|
---|
| 70 | virtual void run();
|
---|
| 71 |
|
---|
| 72 | protected:
|
---|
| 73 | FilterKind fkind;
|
---|
| 74 | int totnscount; // Nombre total d'echantillon processe
|
---|
| 75 | int wsize; // Taille de fenetre de travail
|
---|
| 76 | double* coef; // Coefficients du filtre
|
---|
| 77 |
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | #endif
|
---|