Logo coherent WaveBurst  
Library Reference Guide
Logo
wavepath.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Eric Chassande-Mottin, Philippe Bacon, Gayathri V, Archana Pai
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: wavegraph Class Library
21  * File name: wavepath.hh
22  * Authors: Eric Chassande-Mottin, Eric O. Le Bigot
23  **********************************************************/
24 
25 #ifndef WAVEPATH_HH
26 #define WAVEPATH_HH
27 
28 #include <math.h>
29 #include <vector>
30 #include <set>
31 #include <iostream>
32 #include <string>
33 #include <algorithm>
34 
35 #include "TNamed.h"
36 
37 typedef std::set<int> nodeids;
38 
39 typedef struct {
40  int nodeid; // node id (should match node rank in the graph -- stored for debugging purpose)
41  int timeix; // time index
42  int freqix; // freq index
43  int scaleix; // scale index
44  double value_avg; // node average value
45  double value_stdev; // value standard deviation
46  bool is_endnode; // flag is true if node is an end node
47  nodeids ancestors; // ids of the node ancestors
48 } wavenode;
49 
50 typedef struct {
51  int scaleix; // scale index
52  int timeix; // time index
53  int freqix; // freq index
54  int log2scale; // scale
55  int nodeid; // node ID
56  double time; // time (sec)
57  double freq; // freq (Hz)
58 } pixel;
59 
60 typedef std::vector<wavenode> nodes;
61 typedef std::vector<pixel> cluster;
62 
63 class wavepath : public TNamed {
64 public:
65 
66  wavepath() {};
67  ~wavepath() {};
68 
69  int length() {return path.size();}
70 
71  int nodeid(int id) {return path[id].nodeid;}
72 
73  int time(int id) {return path[id].timeix;}
74 
75  int freq(int id) {return path[id].freqix;}
76 
77  int scale(int id) {return path[id].scaleix;}
78 
79  double get_weight() {return weight;}
80  double get_weight() const {return weight;}
81 
82  int is_endnode(int id) {return path[id].is_endnode;}
83 
84  void clear(){offset=0; weight=0.0; path.clear();}
85 
86  void init(const wavenode node, const int offset, const int refscaleidx, const double path_weight);
87 
88  void add_node(const wavenode node);
89 
90  void print();
91 
92  cluster convert_to_cluster(const int scalemin, const double fs, const int path_width);
93 
94 private:
95 
96  nodes path; // list of nodes in the path
97  int offset; // time origin of the path in the full data segment
98  // offset corresponds to an number of pixels in the reference scale plane
99  int refscaleidx; // index of the reference scale
100  double weight; // total weight carried by the pixels in the path
101 
102  ClassDef(wavepath,0);
103 
104 };
105 
106 bool compare_paths(const wavepath& path1, const wavepath& path2);
107 std::vector<cluster> select_clusters_distinct_in_time(std::vector<cluster>& clusters,const double precision);
108 
109 #endif
double value_stdev
Definition: wavepath.hh:45
double time
Definition: wavepath.hh:56
int nodeid
Definition: wavepath.hh:55
int refscaleidx
Definition: wavepath.hh:99
std::vector< pixel > cluster
Definition: wavepath.hh:61
wavepath()
Definition: wavepath.hh:66
int length()
Definition: wavepath.hh:69
void init(const wavenode node, const int offset, const int refscaleidx, const double path_weight)
Definition: wavepath.cc:63
std::vector< cluster > select_clusters_distinct_in_time(std::vector< cluster > &clusters, const double precision)
Definition: wavepath.cc:166
int is_endnode(int id)
Definition: wavepath.hh:82
int scaleix
Definition: wavepath.hh:43
double get_weight() const
Definition: wavepath.hh:80
std::set< int > nodeids
Definition: wavepath.hh:37
int timeix
Definition: wavepath.hh:41
~wavepath()
Definition: wavepath.hh:67
int nodeid
Definition: wavepath.hh:40
double precision
int scaleix
Definition: wavepath.hh:51
bool is_endnode
Definition: wavepath.hh:46
int log2scale
Definition: wavepath.hh:54
int nodeid(int id)
Definition: wavepath.hh:71
int freqix
Definition: wavepath.hh:53
void clear()
Definition: wavepath.hh:84
int time(int id)
Definition: wavepath.hh:73
int offset
Definition: wavepath.hh:97
double value_avg
Definition: wavepath.hh:44
nodes path
Definition: wavepath.hh:96
double weight
Definition: wavepath.hh:100
int timeix
Definition: wavepath.hh:52
int freqix
Definition: wavepath.hh:42
void add_node(const wavenode node)
Definition: wavepath.cc:81
double freq
Definition: wavepath.hh:57
double get_weight()
Definition: wavepath.hh:79
Long_t id
int scale(int id)
Definition: wavepath.hh:77
cluster convert_to_cluster(const int scalemin, const double fs, const int path_width)
Definition: wavepath.cc:103
bool compare_paths(const wavepath &path1, const wavepath &path2)
Definition: wavepath.cc:23
std::vector< wavenode > nodes
Definition: wavepath.hh:60
int freq(int id)
Definition: wavepath.hh:75
nodeids ancestors
Definition: wavepath.hh:47
void print()
Definition: wavepath.cc:91