Logo coherent WaveBurst  
Library Reference Guide
Logo
waverdc.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Sergey Klimenko
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 /*-------------------------------------------------------
20  * Package: Wavelet Analysis Tool
21  * File name: waverdc.hh
22  *-------------------------------------------------------
23 */
24 
25 #ifndef WAVERDC_HH
26 #define WAVERDC_HH
27 
28 #include <iostream>
29 #include "wavearray.hh"
30 using namespace std;
31 
35 
36 class WaveRDC : public wavearray<unsigned int>
37 {
38 public:
39 
40  int nSample; // number of samples in comressed data array
41  int nLayer; // number of layers in comressed data array
42  int optz; // current layer compression options
43 
44  WaveRDC();
45 
46  virtual ~WaveRDC();
47 
48  WaveRDC& operator =(const WaveRDC &); // assign
49  WaveRDC& operator+=(const WaveRDC &); // concatenate
50 // WaveRDC& operator<<(const WaveRDC &); // copy
51 
52  WaveRDC& operator-=(const WaveRDC &x){return *this;}; // no operation!
53  WaveRDC& operator*=(const WaveRDC &x){return *this;}; // no operation!
54  WaveRDC& operator =(const unsigned int x){return *this;}; // no operation!
55  WaveRDC& operator+=(const unsigned int x){return *this;}; // no operation!
56  WaveRDC& operator-=(const unsigned int x){return *this;}; // no operation!
57  WaveRDC& operator*=(const unsigned int x){return *this;}; // no operation!
58 
59  virtual int DumpRDC(const char*, int = 0);
60 
61  int Compress(const waveShort &);
62 // int Compress(const waveShort &, double);
63 // int Compress(const waveFloat &, double);
64  int Compress(const waveDouble &, double);
65 
66  int unCompress(waveFloat &, int level = 1);
67  int unCompress(waveDouble &, int level = 1);
68  int unCompress(wavearray<int> &, int level = 1);
69 
70  void Dir(int v = 1);
71 
72  float getScale(const waveDouble &, double);
73  void getShort(const waveDouble &, waveShort &);
74  void getSign(const waveDouble &, waveShort &);
75 
76 //private:
77 
78  int freebits; // free bits in the last word of current block
79  int kLong; // encoding bit length for large integers
80  int kShort; // encoding bit length of short word
81  int kBSW; // length of the Block Service Word
82  short Bias; // constant bias subtracted from the data
83  short Zero; // number that encodes 0;
84  float Scale; // coefficient to scale data
85  float rmsLimit; // limit on the data rms
86 
87  int Push(short *, int, unsigned int *, int &, int, int);
88  void Push(unsigned int &, unsigned int *, int &, int);
89 
90  int Pop(int *, int, int &, int, int);
91  void Pop(unsigned int &, int &, int);
92 
93 
94  inline int getOPTZ() {return optz;};
95  inline int wabs(int i) {return i>0 ? i : -i;}
96  inline short wabs(short i) {return i>0 ? i : -i;}
97  inline int wint(double a) {return int(2*a)-int(a);}
98 
99  inline size_t getLSW(size_t opt){ // get length of Layer Service Word (size_t)
100  size_t n = 2;
101  if(opt & 0x2 ) n++;
102  if((opt & 0x8) && (opt & 0x3)) n++;
103  if(opt & 0x10) n++;
104  return n;
105  }
106 
107  ClassDef(WaveRDC,1)
108 
109 };
110 
111 
112 #endif
113 
114 
115 
116 
117 
118 
119 
120 
WaveRDC & operator*=(const unsigned int x)
Definition: waverdc.hh:57
float rmsLimit
Definition: waverdc.hh:85
int optz
Definition: waverdc.hh:42
int kShort
Definition: waverdc.hh:80
TString opt
wavearray< double > a(hp.size())
WSeries< float > v[nIFO]
Definition: cwb_net.C:80
int wint(double a)
Definition: waverdc.hh:97
int n
Definition: cwb_net.C:28
int getOPTZ()
Definition: waverdc.hh:94
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
STL namespace.
size_t getLSW(size_t opt)
Definition: waverdc.hh:99
int freebits
Definition: waverdc.hh:78
int unCompress(int *in, wavearray< float > &out)
Definition: lossy.cc:176
i drho i
short wabs(short i)
Definition: waverdc.hh:96
WaveRDC & operator+=(const unsigned int x)
Definition: waverdc.hh:55
wavearray< double > waveDouble
Definition: waverdc.hh:34
wavearray< short > waveShort
Definition: waverdc.hh:32
WaveRDC & operator-=(const unsigned int x)
Definition: waverdc.hh:56
WaveRDC & operator-=(const WaveRDC &x)
Definition: waverdc.hh:52
int nLayer
Definition: waverdc.hh:41
i() int(T_cor *100))
int kLong
Definition: waverdc.hh:79
short Bias
Definition: waverdc.hh:82
wavearray< float > waveFloat
Definition: waverdc.hh:33
int kBSW
Definition: waverdc.hh:81
int wabs(int i)
Definition: waverdc.hh:95
WaveRDC & operator*=(const WaveRDC &x)
Definition: waverdc.hh:53
short Zero
Definition: waverdc.hh:83
float Scale
Definition: waverdc.hh:84
int nSample
Definition: waverdc.hh:40
int Compress(wavearray< double > &in, int *&out, int Lwt, int Lbt, const double g1, const double g2, int np1, int np2)
Definition: lossy.cc:36