Filterbank.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2002-2011 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Signal/General/dsp/Filterbank.h
10 
11 #ifndef __Filterbank_h
12 #define __Filterbank_h
13 
14 #include "dsp/Convolution.h"
15 
16 namespace dsp {
17 
19  /* This class implements the coherent filterbank technique described
20  in Willem van Straten's thesis. */
21 
22  class Filterbank: public Convolution {
23 
24  public:
25 
27  class Config;
28 
30  Filterbank (const char* name = "Filterbank", Behaviour type = outofplace);
31 
33  void prepare ();
34 
36  void reserve ();
37 
39  uint64_t bytes_storage() const override;
40 
42  uint64_t bytes_scratch () const override;
43 
45  uint64_t get_minimum_samples () { return nsamp_fft; }
46 
48  uint64_t get_minimum_samples_lost () { return nsamp_overlap; }
49 
51  void set_nchan (unsigned _nchan) { nchan = _nchan; }
52 
54  unsigned get_nchan () const { return nchan; }
55 
56  unsigned get_nchan_subband () const {return nchan_subband; }
57 
59  void set_freq_res (unsigned _freq_res) { freq_res = _freq_res; }
60  void set_frequency_resolution (unsigned fres) { freq_res = fres; }
61 
63  unsigned get_freq_res () const { return freq_res; }
64  unsigned get_frequency_resolution () const { return freq_res; }
65 
66  void set_frequency_overlap (unsigned over) { overlap_ratio = over; }
67  unsigned get_frequency_overlap () const { return (unsigned) overlap_ratio; }
68 
70  unsigned get_nfilt_pos() {return nfilt_pos;}
71 
73  unsigned get_nfilt_neg() {return nfilt_neg;}
74 
75  FTransform::Plan* get_forward();
76 
77  FTransform::Plan* get_backward();
78 
80  class Engine;
81  void set_engine (Engine*);
82  Engine* get_engine();
83 
84  protected:
85 
87  virtual void transformation ();
88 
90  virtual void filterbank ();
91  virtual void custom_prepare () {}
92 
95  unsigned nchan;
96 
98  unsigned freq_res;
99 
100  // This is the number of channels each input channel will be divided into
101  unsigned nchan_subband;
102 
104  double overlap_ratio;
105 
108 
111 
112  private:
113 
114  void do_prepare ();
115  void prepare_output (uint64_t ndat = 0, bool set_ndat = false);
116  void resize_output (bool reserve_extra = false);
117 
118  };
119 
120 }
121 
122 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
void set_freq_res(unsigned _freq_res)
Set the frequency resolution factor.
Definition: Filterbank.h:69
void reserve()
Reserve the maximum amount of output space required.
Definition: Filterbank.C:454
void prepare_output()
Prepare the output TimeSeries.
Definition: Convolution.C:449
Behaviour
All Transformations must define their behaviour.
Definition: Transformation.h:47
unsigned get_nchan() const
Get the number of channels into which the input will be divided.
Definition: Filterbank.h:64
virtual void set_buffering_policy(BufferingPolicy *policy)
Set the policy for buffering input and/or output data.
Definition: Transformation.h:85
static Register & get_register()
Return the list of registered sub-classes.
Definition: File_registry.C:246
const ScalarMath sqrt(const ScalarMath &x)
std::string name
Operation name.
Definition: Operation.h:153
static bool record_time
Global flag enables stopwatch to record the time spent operating.
Definition: Operation.h:42
uint64_t bytes_storage() const override
The number of bytes of additional storage used by the operation.
Definition: Filterbank.C:306
uint64_t get_minimum_samples_lost()
Get the minimum number of samples lost.
Definition: Filterbank.h:58
Reference::To< Engine > engine
Interface to alternate processing engine (e.g. GPU)
Definition: Filterbank.h:117
virtual void filterbank()
Perform the filterbank step.
Definition: Filterbank.C:556
Buffers the Transformation input.
Definition: InputBuffering.h:26
void shift(unsigned npts, float *arr, double shift)
static List & get_registry()
Convolves a TimeSeries using a frequency response function.
Definition: Convolution.h:64
void prepare()
Prepare all relevant attributes.
Definition: Filterbank.C:46
unsigned nchan
Number of channels into which the input will be divided This is the final number of channels in the o...
Definition: Filterbank.h:105
unsigned get_freq_res() const
Get the frequency resolution factor.
Definition: Filterbank.h:73
unsigned get_nfilt_pos()
get the response's positive impulse
Definition: Filterbank.h:80
Filterbank(const char *name="Filterbank", Behaviour type=outofplace)
Null constructor.
Definition: Filterbank.C:26
Breaks a single-band TimeSeries into multiple frequency channels.
Definition: Filterbank.h:27
unsigned get_nfilt_neg()
get the response's negative impulse
Definition: Filterbank.h:83
uint64_t bytes_scratch() const override
The number of bytes of scratch space used by the operation.
Definition: Filterbank.C:324
unsigned freq_res
Frequency resolution factor.
Definition: Filterbank.h:108
Reference::To< ScalarFilter > zero_DM_normalizer
Scalar filter (normalizer)
Definition: Filterbank.h:120
Loads BitSeries data from a LWA DRX file.
Definition: LWAFile.h:24
double overlap_ratio
Frequency channel overlap ratio.
Definition: Filterbank.h:114
virtual void transformation()
Perform the convolution transformation on the input TimeSeries.
Definition: Filterbank.C:505
normalization get_norm()
void set_nchan(unsigned _nchan)
Set the number of channels into which the input will be divided.
Definition: Filterbank.h:61
Loads BitSeries data from a LuMP data file.
Definition: LuMPFile.h:25
uint64_t get_minimum_samples()
Get the minimum number of samples required for operation.
Definition: Filterbank.h:55

Generated using doxygen 1.8.17