36 #include "wavelet.hpp"
37 #include "lowpass.hpp"
38 #include "../wavelets/morlet.hpp"
39 #include "../wavelets/paul.hpp"
41 #include <boost/circular_buffer.hpp>
50 enum Family :
unsigned char {
67 const Family DEFAULT_FAMILY = MORLET;
100 #pragma mark === Public Interface ===
101 #pragma mark > Constructors
136 #pragma mark > Accessors
168 template <
typename T>
173 setAttribute_internal(attr_name, boost::any(attr_value));
174 }
catch(
const boost::bad_any_cast &) {
175 throw std::runtime_error(
"Argument value type does not match Attribute type");
207 template <
typename T>
211 return boost::any_cast<T>(getAttribute_internal(attr_name));
212 }
catch(
const boost::bad_any_cast &) {
213 throw std::runtime_error(
"Return value type does not match Attribute type");
219 #pragma mark > Online Estimation
235 #pragma mark > Offline Estimation
246 arma::cx_mat process(std::vector<double> values);
254 arma::cx_mat process_online(std::vector<double> values);
259 #pragma mark > Utilities
267 std::size_t
size()
const;
273 std::string
info()
const;
295 #pragma mark === Public Attributes ===
347 #ifndef WAVELET_TESTING
351 #pragma mark === Protected Methods ===
364 virtual void onAttributeChange(AttributeBase* attr_pointer);
373 virtual void setAttribute_internal(std::string attr_name,
374 boost::any
const& attr_value);
383 virtual boost::any getAttribute_internal(std::string attr_name)
const;
388 #pragma mark === Protected Attributes ===
392 std::map<int, boost::circular_buffer<float>> data_;
397 std::map<int, LowpassFilter> filters_;
402 std::vector< std::shared_ptr<Wavelet> > wavelets_;
407 std::shared_ptr<Wavelet> reference_wavelet_;
418 #pragma mark === Attribute Specializations ===
421 void checkLimits<Family>(Family
const& value,
422 Family
const& limit_min,
423 Family
const& limit_max);
Filterbank(float samplerate, float frequency_min, float frequency_max, float bands_per_octave)
Constructor.
Minimal-delay Wavelet Filterbank.
Definition: filterbank.hpp:77
std::string __str__()
"print" method for python => returns the results of write method
Definition: filterbank.hpp:287
std::vector< double > scales
Scales of each band in the filterbank.
Definition: filterbank.hpp:324
std::vector< int > delaysInSamples() const
get the delays in sample for each filter
Attribute< float > bands_per_octave
Number of bands per octave of the Filterbank.
Definition: filterbank.hpp:309
Filterbank & operator=(Filterbank const &src)
Assignment operator.
std::vector< double > frequencies
Equivalent Fourier frequencies of each band in the filterbank.
Definition: filterbank.hpp:329
Standard Optimisation (Wavelet Downsampling with frame-based calculations)
Definition: filterbank.hpp:91
std::string info() const
get info on the current configuration
No optimisation (no wavelet downsampling)
Definition: filterbank.hpp:86
Attribute< float > frequency_min
Minimum Frequency of the Filterbank (Hz)
Definition: filterbank.hpp:299
std::vector< int > downsampling_factors
Downsampling factor for each band.
Definition: filterbank.hpp:334
Definition: attribute.hpp:42
Attribute< float > frequency_max
Maximum Frequency of the Filterbank (Hz)
Definition: filterbank.hpp:304
void update(float value)
update the filter with an incoming value
std::size_t size() const
get number of bands
std::vector< std::complex< double > > result_complex
Results of the filtering process (scalogram slice)
Definition: filterbank.hpp:339
virtual ~Filterbank()
Destructor.
Attribute< Family > family
Wavelet Family.
Definition: filterbank.hpp:319
Agressive Optimisation (Wavelet Downsampling with Signal Downsampling)
Definition: filterbank.hpp:96
Attribute< Optimisation > optimisation
Optimisation mode the filterbank implementation.
Definition: filterbank.hpp:314
T getAttribute(std::string attr_name) const
get attribute value by name
Definition: filterbank.hpp:208
void setAttribute(std::string attr_name, T attr_value)
set attribute value by name
Definition: filterbank.hpp:169
std::vector< double > result_power
Resulting Power of the filtering process (power scalogram slice)
Definition: filterbank.hpp:344
void reset()
clear the current data buffer
Optimisation
Optimisation level of the filterbank implementation.
Definition: filterbank.hpp:82