Class dsp::InverseFilterbank

class InverseFilterbank : public dsp::Convolution

Performs the PFB inversion synthesis operation.

Combines multiple input frequency channels into a smaller number of output channels.

The PFB inversion algorithm is fed a chunk of input data. The size of this chunk is determined by the upstream IOManager. For each input chunk, it does the following.

  • Advance through the input data by input_fft_length minus input_discard_total, or the number of samples skipped from the start and end of each input step. If the input_discard_total is greater than zero, this means that each successive step will be reading from data that we’ve already operated on.

  • For each channel in the input data step, apply an input_fft_length size FFT. If there is an oversampling factor that is greater than one, discard samples from either end of the resulting frequency domain data, before stitching into a large array whose size will be output_fft_length long. How these samples get stitched into this array is determined by the presence of the zeroth PFB channel.

  • Apply an inverse FFT to the stitched spectrum, before copying the newly created upsampled time domain data into the output TimeSeries buffer. In the same way that we read overlapped chunks of input data, we also write out the output data in overlapped segments.

The input TimeSeries can be critically sampled or over sampled. In the over sampled case, input spectra will be appropriately stitched together, discarding band edge overlap regions.

The manner in which input channels are synthesized depends on the number of input channels that are present, and if the zeroth PFB channel is present. Here, the “reassembled” spectrum refers to the spectrum that gets assembled from forward FFTs operating on each input channel in the transformation step. There are three distinct scenarios:

  • All PFB channels are present, and the zeroth, or DC PFB channel is present. Here, the first half channel of the reassembled spectrum gets put at the end of the spectrum; we “roll” the assembled spectrum by half a channel.

  • The DC PFB channel is present, but we only have a subset of the channels from upstream channelization. In this case, we discard the zeroth channel, and append a half channel’s worth of zeros to the end of the assembled spectrum

  • We have neither the DC PFB channel nor all the PFB channels. In this case we leave the assembled spectrum as is.

Public Functions

InverseFilterbank(const char *name = "InverseFilterbank", Behaviour type = outofplace)

Null constructor.

virtual void set_input(const TimeSeries *input) override

Set the container from which input data will be read.

virtual void prepare() override

Prepare all relevant attributes.

virtual void reserve() override

Reserve the maximum amount of output space required.

virtual void set_response(Response *response) override

Set the frequency response function.

virtual void set_zero_DM_response(Response *response) override

Set the zero DM frequency response function.

inline uint64_t get_minimum_samples()

Get the minimum number of samples required for operation.

inline uint64_t get_minimum_samples_lost()

Get the minimum number of samples lost.

inline void set_input_nchan(unsigned _input_nchan)

Set the number of input channels.

inline unsigned get_input_nchan() const

Get the number of input channels.

inline void set_output_nchan(unsigned _output_nchan)

Set the number of output channels.

inline unsigned get_output_nchan() const

Get the number of output channels.

inline unsigned get_nchan_subband() const

Get the number of input channels per output channels.

inline void set_freq_res(unsigned _freq_res)

Set the frequency resolution factor.

inline void set_frequency_resolution(unsigned _freq_res)

Set the frequency resolution factor.

inline unsigned get_freq_res() const

Get the frequency resolution factor.

inline unsigned get_frequency_resolution() const

Get the frequency resolution factor.

inline void set_oversampling_factor(const Rational &_osf)

Set oversampling_factor.

inline const Rational &get_oversampling_factor()

Get oversampling_factor.

inline bool get_pfb_all_chan() const

Get the pfb_all_chan flag.

void set_pfb_all_chan(bool)

Set the pfb_all_chan flag.

inline int get_input_discard_neg() const

Get the number of samples discarded at the end of an input step.

inline void set_input_discard_neg(int _input_discard_neg)

Set the number of samples discarded at the end of an input step.

inline int get_input_discard_pos() const

Get the number of samples discarded at the start of an input step.

inline void set_input_discard_pos(int _input_discard_pos)

Set the number of samples discarded at the start of an input step.

inline int get_output_discard_neg() const

Get the number of samples discarded at the end of an output step.

inline void set_output_discard_neg(int _output_discard_neg)

Set the number of samples discarded at the end of an output step.

inline int get_output_discard_pos() const

Get the number of samples discarded at the start of an output step.

inline void set_output_discard_pos(int _output_discard_pos)

Get the number of samples discarded at the start of an output step.

void set_input_fft_length(unsigned nfft, const dsp::Observation *info = nullptr)

Set the number of samples in the forward FFT performed on input oversampled data.

inline int get_input_fft_length() const

Get the size of the forward fft, in number of oversampled input samples.

inline int get_output_fft_length() const

Get the size of the backward fft, in number of samples.

inline void set_output_fft_length(int _output_fft_length)

Set the size of the backward fft, in number of samples.

virtual void set_cerr(std::ostream &os) const override

Set output error stream.

class Config : public dsp::Filterbank::Config
class Engine : public OwnStream

Abstract base class for derived engines that operate on data in order to perform inverse (synthesis) filterbank operation

Subclassed by dsp::InverseFilterbankEngineCPU

Public Functions

virtual void setup(InverseFilterbank*) = 0

If kernel is not set, then the engine should set up for benchmark only.

virtual void perform(const dsp::TimeSeries *in, dsp::TimeSeries *out, uint64_t npart, const uint64_t in_step, const uint64_t out_step) = 0

Perform the filterbank operation on the input data.

inline virtual void finish()

Finish up.

inline unsigned get_total_scratch_needed() const

get the amount of scratch space the engine has calculated that it needs

class Reporter