[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 |
|
---|
| 29 | protected:
|
---|
| 30 | int totnscount; // Nombre total d'echantillon processe
|
---|
| 31 | int glnscount; // Nombre total de glitch
|
---|
| 32 | int glcount; // Nombre de glitch detecte
|
---|
| 33 |
|
---|
| 34 | int wsize; // Taille de fenetre de travail
|
---|
| 35 | double nsig; // Seuil en nb de sigmas
|
---|
| 36 | int maxpoints; // Nb maxi de points > ns sigmas
|
---|
| 37 | };
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | // Un filtre simple, dans le domaine temporel
|
---|
| 41 | // remplace val -> Somme(val(i)*coeff(i)) ds Fenetre
|
---|
| 42 |
|
---|
| 43 | class SimpleFilter : public TOIProcessor {
|
---|
| 44 | public:
|
---|
| 45 | enum FilterKind {
|
---|
| 46 | UserFilter=0, // User defined filter function
|
---|
| 47 | MeanFilter=1, // Replace sample by the window mean value (lowpass)
|
---|
| 48 | SumFilter=2, // Replace sample by the window sum (lowpass)
|
---|
| 49 | GaussFilter=3, // Apply a gaussian to the window samples
|
---|
| 50 | DiffFilter=4, // value -= MeanValue
|
---|
| 51 | };
|
---|
| 52 |
|
---|
| 53 | SimpleFilter(int wsz=128,
|
---|
| 54 | FilterKind fk=SimpleFilter::MeanFilter,
|
---|
| 55 | double a=1., double s=1.);
|
---|
| 56 | // SimpleFilter(int wsz, Arr_DoubleFunctionOfX f=NULL);
|
---|
| 57 | ~SimpleFilter();
|
---|
| 58 |
|
---|
| 59 | inline FilterKind Type() { return fkind; }
|
---|
| 60 |
|
---|
| 61 | inline int WSize() const { return wsize; }
|
---|
| 62 | inline int TotalSampleCount() const { return totnscount; }
|
---|
| 63 |
|
---|
| 64 | virtual void init();
|
---|
| 65 | virtual void run();
|
---|
| 66 |
|
---|
| 67 | protected:
|
---|
| 68 | FilterKind fkind;
|
---|
| 69 | int totnscount; // Nombre total d'echantillon processe
|
---|
| 70 | int wsize; // Taille de fenetre de travail
|
---|
| 71 | double* coef; // Coefficients du filtre
|
---|
| 72 |
|
---|
| 73 | };
|
---|
| 74 |
|
---|
| 75 | #endif
|
---|