Logo coherent WaveBurst  
Library Reference Guide
Logo
STFT.hh
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato
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: STFT Class Library
21  * File name: STFT.hh
22  * Author: Gabriele Vedovato (vedovato@lnl.infn.it)
23  **********************************************************/
24 
25 
26 #ifndef STFT_HH
27 #define STFT_HH
28 
29 #include "TCanvas.h"
30 #include "TH2D.h"
31 #include "TPolyLine.h"
32 #include "TStyle.h"
33 #include "TColor.h"
34 #include "TObjString.h"
35 #include "TObjArray.h"
36 #include "TString.h"
37 #include "TMarker.h"
38 #include "TROOT.h"
39 #include "TMath.h"
40 #include "TPaveText.h"
41 #include "TSystem.h"
42 #include "TLatex.h"
43 
44 #include <string>
45 #include <iostream>
46 #include <fstream>
47 #include <stdlib.h>
48 #include <math.h>
49 #include <ctype.h>
50 
51 #include "wavecomplex.hh"
52 #include "wavearray.hh"
53 
54 #include "Window.hh"
55 
56 #define DUMMY_PALETTE_ID 1000000000
57 
58 using namespace std;
59 
60 namespace CWB {
61 
62 class STFT {
63 
64 public:
65 
66  STFT(wavearray<double> x, int nfft, int noverlap, TString ztype="amplitude",
67  TString fwindow="hann", double fparam=0.0, TString name="stft");
68  ~STFT();
69 
70  TCanvas* GetCanvas() {return canvas;}
71  TH2D* GetHistogram() {return h2;}
72 
73  void SetLogz(bool isLogz=true) {this->isLogz=isLogz;}
74  bool GetLogz() {return isLogz;}
75  TString GetZtype() {return ztype;}
76  void SetTitle(TString title) {h2->SetTitle(title);this->title=title;}
77  TString GetTitle() {return title;}
78  void SetPalette(int paletteId=1) {this->paletteId=paletteId;}
79  bool GetPaletteId() {return paletteId;}
80 
81  void Draw(double t1=0.0, double t2=0.0, double f1=0.0, double f2=0.0, double z1=0.0, double z2=0.0,
82  int dpaletteId = DUMMY_PALETTE_ID, Option_t* option = "colfz");
83  void Print(TString pname);
84 
85 private:
86 
87  void SetPlotStyle(int paletteId = 1);
88 
89  TCanvas* canvas;
90  TH2D* h2;
91 
92  bool isLogz;
95  int paletteId;
97 
98  double* window;
99 };
100 
101 } // end namespace
102 
103 #endif
#define DUMMY_PALETTE_ID
Definition: STFT.hh:56
int noverlap
Definition: TestDelta.C:20
void SetLogz(bool isLogz=true)
Definition: STFT.hh:73
TH1 * t1
TString ztype
Definition: STFT.hh:96
bool GetLogz()
Definition: STFT.hh:74
Definition: ced.hh:42
gx Draw(GWAT_TIME)
par [0] name
bool GetPaletteId()
Definition: STFT.hh:79
TString("c")
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
int nfft
Definition: TestDelta.C:19
return wmap canvas
int paletteId
Definition: STFT.hh:95
STL namespace.
TH2D * h2
Definition: STFT.hh:90
TString title
Definition: STFT.hh:93
TString GetZtype()
Definition: STFT.hh:75
MDC Print()
TCanvas * canvas
Definition: STFT.hh:89
TF1 * f2
TH2D * GetHistogram()
Definition: STFT.hh:71
TString GetTitle()
Definition: STFT.hh:77
char title[256]
Definition: SSeriesExample.C:1
bool isLogz
Definition: STFT.hh:92
double * window
Definition: STFT.hh:98
TCanvas * GetCanvas()
Definition: STFT.hh:70
void SetPalette(int paletteId=1)
Definition: STFT.hh:78
TString name
Definition: STFT.hh:94
void SetTitle(TString title)
Definition: STFT.hh:76