AdaptiveSmooth.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_AdaptiveSmooth_h
10 #define __Pulsar_AdaptiveSmooth_h
11 
12 #include "Pulsar/Transformation.h"
13 
14 namespace Pulsar {
15 
16  class Profile;
17 
20  class AdaptiveSmooth : public Transformation<Profile> {
21 
22  public:
23 
26 
28  virtual ~AdaptiveSmooth ();
29 
31  float get_turns () const;
32 
34  unsigned get_max_harm() const;
35 
37  void set_hold (bool);
38 
40  bool get_hold() const;
41 
43  void transform(Profile *);
44 
46  enum Method { Wiener, Sinc_MSE, Sinc_IC, VonMises };
47 
49  void set_method(Method m);
50 
51  protected:
52 
54  std::vector<float> filter;
55 
57  int max_harm;
58 
60  bool hold;
61 
63  float noise_band;
64 
66  Method method;
67 
68  private:
69 
71  void compute(const float *fprof, int nbin);
72 
74  void compute_wiener(const float *pspec, double sigma2, int nh);
75 
77  void compute_sinc_mse(const float *pspec, double sigma2, int nh);
78 
80  void compute_sinc_ic(const float *pspec, double sigma2, int nh);
81 
83  void compute_lpf(const float *pspec, double sigma2, int nh,
84  float (*filter_func)(float,float));
85 
87  void compute_vonmises_lpf(const float *pspec, double sigma2, int nh);
88 
89  };
90 
91 }
92 
93 #endif
int max_harm
Maximum nonzero harmonic.
Definition: AdaptiveSmooth.h:62
const float * get_amps() const
Return a pointer to the amplitudes array.
Definition: ProfileAmps.C:141
Method
Different types of filter.
Definition: AdaptiveSmooth.h:51
void frc1d(size_t nfft, float *into, const float *from)
float noise_band
Upper fraction of band to use for noise estimate.
Definition: AdaptiveSmooth.h:68
Method method
Which filter method to use.
Definition: AdaptiveSmooth.h:71
void bcr1d(size_t nfft, float *into, const float *from)
AdaptiveSmooth()
Default constructor.
Definition: AdaptiveSmooth.C:20
const ScalarMath log(const ScalarMath &x)
Any quantity recorded as a function of pulse phase.
Definition: Profile.h:45
unsigned get_nbin() const
Return the number of bins.
Definition: ProfileAmps.h:50
void scale(double scale)
multiplies each bin of the profile by scale
Definition: Profile.C:311
bool get_hold() const
Get hold state.
Definition: AdaptiveSmooth.C:48
std::vector< float > filter
Current fourier-domain smoothing function.
Definition: AdaptiveSmooth.h:59
bool hold
Current hold state.
Definition: AdaptiveSmooth.h:65
void transform(Profile *)
Smooth given Profile.
Definition: AdaptiveSmooth.C:54
unsigned get_max_harm() const
Get maximum nonzero harmonic.
Definition: AdaptiveSmooth.C:41
virtual ~AdaptiveSmooth()
Destructor.
Definition: AdaptiveSmooth.C:29
float get_turns() const
Get the characteristic width of the smoothing window in turns.
Definition: AdaptiveSmooth.C:34
void set_method(Method m)
Set filter method.
Definition: AdaptiveSmooth.C:50
Defines the PSRCHIVE library.
Definition: CalSource.h:17
void set_hold(bool)
Hold current filter to apply to more profiles.
Definition: AdaptiveSmooth.C:46
normalization get_norm()

Generated using doxygen 1.8.17