WaveletTransform.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2008 by Paul Demorest
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 #ifndef __Pulsar_Wavelet_h
10 #define __Pulsar_Wavelet_h
11 
12 #include "ReferenceAble.h"
13 
14 #include <gsl/gsl_wavelet.h>
15 
16 namespace Pulsar {
17 
18  class Profile;
19 
21 
24  class WaveletTransform : public Reference::Able {
25 
26  public:
27 
30 
33 
35 
44  void set_type(const gsl_wavelet_type *t) { type=t; };
45 
47 
54  void set_order(int o) { order=o; };
55 
57  void set_wavelet(std::string s);
58 
60  void set_decimate(bool _dec=true) { decimate = _dec; }
61 
63  void transform(unsigned npts, const float *in);
64 
66  void transform(const std::vector<float>& in);
67 
69  void transform(const Pulsar::Profile* in);
70 
72  void invert();
73 
75  enum State { Wavelet, Time, Empty };
76 
78  const bool get_decimate() const { return decimate; }
79 
81  State get_state() { return state; }
82 
84  double get_data(int level, int k);
85 
87  double get_data(int n);
88 
90  double* get_data();
91 
93  const double* get_data() const;
94 
96  const int get_npts() const { return npts; };
97 
99  const int get_log2_npts() const { return log2_npts; };
100 
102  const int get_ncoeff() const { return decimate ? npts : log2_npts*npts; }
103 
105  const int get_ncoeff(int level) const;
106 
107  protected:
108 
110  const gsl_wavelet_type *type;
111 
113  bool decimate;
114 
116  int order;
117 
119  gsl_wavelet *wave;
120 
122  int npts;
123 
125  int log2_npts;
126 
128  double *data;
129 
131  double mean;
132 
134  State state;
135 
137  gsl_wavelet_workspace *work;
138 
139  private:
140 
142  void free_mem();
143 
145  void init_mem();
146 
147 
148  };
149 
150 }
151 
152 #endif
int order
Wavelet order.
Definition: WaveletTransform.h:121
int npts
Number of points.
Definition: WaveletTransform.h:127
void set_decimate(bool _dec=true)
Set whether or not to decimate during transform.
Definition: WaveletTransform.h:65
WaveletTransform()
Constructor.
Definition: WaveletTransform.C:18
double * data
Data storage.
Definition: WaveletTransform.h:133
const int get_log2_npts() const
Get log2 of number of pts currently in use.
Definition: WaveletTransform.h:104
void invert()
Perform inverse transform in-place.
Definition: WaveletTransform.C:149
void set_type(const gsl_wavelet_type *t)
Set wavelet type.
Definition: WaveletTransform.h:49
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
~WaveletTransform()
Destructor.
Definition: WaveletTransform.C:33
State state
Current state of the data.
Definition: WaveletTransform.h:139
State
Possible states of the data.
Definition: WaveletTransform.h:80
double * get_data()
Get pointer to data array.
Definition: WaveletTransform.C:252
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
const bool get_decimate() const
Get decimation setting.
Definition: WaveletTransform.h:83
State get_state()
Get current state.
Definition: WaveletTransform.h:86
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
void transform(unsigned npts, const float *in)
Perform forward transform.
Definition: WaveletTransform.C:99
void set_order(int o)
Set wavelet order.
Definition: WaveletTransform.h:59
int log2_npts
Log2 of npts.
Definition: WaveletTransform.h:130
const gsl_wavelet_type * type
Wavelet type.
Definition: WaveletTransform.h:115
void set_wavelet(std::string s)
Set wavelet type and order using short string notation.
Definition: WaveletTransform.C:38
double mean
Mean of data.
Definition: WaveletTransform.h:136
const int get_npts() const
Get number of pts currently in use.
Definition: WaveletTransform.h:101
bool decimate
Use decimated (standard) or undecimated transform.
Definition: WaveletTransform.h:118
gsl_wavelet * wave
Wavelet coeffs.
Definition: WaveletTransform.h:124
Defines the PSRCHIVE library.
Definition: CalSource.h:17
gsl_wavelet_workspace * work
GSL workspace.
Definition: WaveletTransform.h:142
const int get_ncoeff() const
Get total number of wavelet coeffs computed.
Definition: WaveletTransform.h:107

Generated using doxygen 1.8.17