Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
netpixel.hh
Go to the documentation of this file.
1 // Wavelet Analysis Tool
2 // Sergey Klimenko, University of Florida
3 // universal pixel data container for network cluster analysis
4 // used with DMT and ROOT
5 //
6 
7 #ifndef NETPIXEL_HH
8 #define NETPIXEL_HH
9 
10 #include <iostream>
11 #include "wavearray.hh"
12 #include "WaveDWT.hh"
13 #include "wseries.hh"
14 #include "TNamed.h"
15 
16 struct pixdata {
17  double noiserms; // average noise rms
18  double wave; // vector of 00 pixel's wavelet amplitudes
19  double w_90; // vector of 90 pixel's wavelet amplitudes
20  double asnr; // vector of 00 pixel's whitened amplitudes
21  double a_90; // vector of 90 pixel's whitened amplitudes
22  float rank; // vector of pixel's rank amplitudes
23  int index; // index in wavearray
24 };
25 
26 class netpixel : public TNamed {
27  public:
28 
29  netpixel();
30  netpixel(size_t);
31 
32  virtual ~netpixel(){ this->clear(); }
33  bool operator == (const netpixel &) const {return true;}
34  bool operator < (const netpixel &) const {return true;}
35 
36  // operator =
37  netpixel& operator= (const netpixel&);
38 
39  // set pixel data
40  inline bool setdata(double a, char type='R', size_t n=0){
41  if(n<this->size()) {
42  if(type == 'N' || type == 'n') this->data[n].noiserms = a;
43  else if(type == 'I' || type == 'i') this->data[n].index = int(a+0.1);
44  else if(type == 'W' || type == 'w') this->data[n].wave = a;
45  else if(type == 'U' || type == 'u') this->data[n].w_90 = a;
46  else if(type == 'S' || type == 's') this->data[n].asnr = a;
47  else if(type == 'P' || type == 'p') this->data[n].a_90 = a;
48  else if(type == 'R' || type == 'r') this->data[n].rank = a;
49  else this->data[n].asnr = a;
50  return true;
51  }
52  else { return false; }
53  }
54 
55  // get pixel data
56  inline double getdata(char type='R', size_t n=0){
57  if(n<this->size()) {
58  if(type == 'N' || type == 'n') return double(this->data[n].noiserms);
59  else if(type == 'I' || type == 'i') return double(this->data[n].index);
60  else if(type == 'W' || type == 'w') return double(this->data[n].wave);
61  else if(type == 'U' || type == 'u') return double(this->data[n].w_90);
62  else if(type == 'S' || type == 's') return double(this->data[n].asnr);
63  else if(type == 'P' || type == 'p') return double(this->data[n].a_90);
64  else if(type == 'R' || type == 'r') return double(this->data[n].rank);
65  else return double(this->data[n].asnr);
66  }
67  return 0;
68  }
69 
70  // get size of pixel arrays
71  inline size_t size(){ return this->data.size(); }
72  // get capacity of pixel object
73  inline size_t capacity(){ return data.capacity(); }
74  // clear pixel
75  inline void clear(){
76  data.clear(); std::vector<pixdata>().swap(data);
77  tdAmp.clear(); std::vector<wavearray<float> >().swap(tdAmp);
78  neighbors.clear(); std::vector<int>().swap(neighbors);
79  }
80  // clear pixel
81  inline void clean(){
82  tdAmp.clear(); std::vector<wavearray<float> >().swap(tdAmp);
83  }
84  // add link to neighbors
85  inline void append(int n){ neighbors.push_back(n); }
86  // write pixel to file
87  bool write(const FILE *);
88  // read pixel from file
89  bool read(const FILE *);
90 
91  size_t clusterID; // cluster ID
92  size_t time; // time index for master detector
93  size_t frequency; // frequency index (layer)
94  size_t layers; // number of frequency layers
95  float rate; // wavelet layer rate
96  float likelihood; // likelihood
97  float null; // null
98  float theta; // source angle theta index
99  float phi; // source angle phi index
100  float ellipticity; // waveform ellipticity
101  float polarisation; // waveform polarisation
102  bool core; // pixel type: true - core , false - halo
103 
104  std::vector<pixdata> data;
105  std::vector<wavearray<float> > tdAmp;
106  std::vector<int> neighbors; // vector of links to neighbors
107 
108  ClassDef(netpixel,2)
109 };
110 
111 #endif // NETPIXEL_HH
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
float phi
Definition: netpixel.hh:99
float rank
Definition: netpixel.hh:22
size_t clusterID
Definition: netpixel.hh:91
std::vector< wavearray< float > > tdAmp
Definition: netpixel.hh:105
float * rank
wavearray< double > a(hp.size())
size_t frequency
Definition: netpixel.hh:93
float likelihood
Definition: netpixel.hh:96
int n
Definition: cwb_net.C:10
std::vector< int > neighbors
Definition: netpixel.hh:106
netevent W & wave
std::vector< pixdata > data
Definition: netpixel.hh:104
size_t layers
Definition: netpixel.hh:94
size_t capacity()
Definition: netpixel.hh:73
bool write(const FILE *)
Definition: netpixel.cc:73
double asnr
Definition: netpixel.hh:20
bool core
Definition: netpixel.hh:102
virtual ~netpixel()
Definition: netpixel.hh:32
double w_90
Definition: netpixel.hh:19
size_t size()
Definition: netpixel.hh:71
double wave
Definition: netpixel.hh:18
i() int(T_cor *100))
float polarisation
Definition: netpixel.hh:101
int index
Definition: netpixel.hh:23
bool operator==(const netpixel &) const
Definition: netpixel.hh:33
void clear()
Definition: netpixel.hh:75
void append(int n)
Definition: netpixel.hh:85
size_t time
Definition: netpixel.hh:92
netpixel()
Definition: netpixel.cc:18
float ellipticity
Definition: netpixel.hh:100
double noiserms
Definition: netpixel.hh:17
wavearray< int > index
float theta
Definition: netpixel.hh:98
bool read(const FILE *)
Definition: netpixel.cc:129
double asnr
float rate
Definition: netpixel.hh:95
bool operator<(const netpixel &) const
Definition: netpixel.hh:34
double getdata(char type='R', size_t n=0)
Definition: netpixel.hh:56
float null
Definition: netpixel.hh:97
double a_90
Definition: netpixel.hh:21
void clean()
Definition: netpixel.hh:81
bool setdata(double a, char type='R', size_t n=0)
Definition: netpixel.hh:40
netpixel & operator=(const netpixel &)
Definition: netpixel.cc:52