Class SquareWaveGenerator
Defined in File SquareWaveGenerator.h
Inheritance Relationships
Base Type
public ska::pst::common::GaussianNoiseGenerator
(Class GaussianNoiseGenerator)
Class Documentation
-
class SquareWaveGenerator : public ska::pst::common::GaussianNoiseGenerator
Generates and validates normally-distributed noise that is amplitude-modulated using a square wave with configurable modulation period, duty cycle, and on-pulse amplitude that may vary linearly as a function of frequency channel independently in each polarisation.
Public Functions
Construct a new SquareWaveGenerator object.
-
~SquareWaveGenerator() override = default
Destroy the SquareWaveGenerator object.
-
virtual void configure(const ska::pst::common::AsciiHeader &config) override
Configure the streams written to data + weights.
Parameters that configure this class include the following:
UTC_START used to seed the random number generator (mandatory)
CAL_DUTY_CYCLE the fraction of the square wave period in the on-pulse state (optional; must be greater than 0 and less than 1)
CALFREQ the frequency (inverse of the period) of the square wave (optional; must be greater than zero)
The following intensity configuration parameters are all optional and must be greater than zero:
CAL_OFF_INTENSITY off-pulse intensity for all polarizations and frequency channels
CAL_ON_INTENSITY on-pulse intensity for all polarizations and frequency channels
CAL_ON_POL_0_INTENSITY on-pulse intensity for polarization 0 and all frequency channels
CAL_ON_POL_1_INTENSITY on-pulse intensity for polarization 1 and all frequency channels
CAL_ON_CHAN_0_INTENSITY on-pulse intensity for all polarizations at frequency channel zero
CAL_ON_CHAN_N_INTENSITY on-pulse intensity for all polarizations at the number of frequency channels
CAL_ON_POL_0_CHAN_0_INTENSITY on-pulse intensity for polarization 0 at frequency channel zero
CAL_ON_POL_0_CHAN_N_INTENSITY on-pulse intensity for polarization 0 at the number of frequency channels
CAL_ON_POL_1_CHAN_0_INTENSITY on-pulse intensity for polarization 1 at frequency channel zero
CAL_ON_POL_1_CHAN_N_INTENSITY on-pulse intensity for polarization 1 at the number of frequency channels
If any one of the above CHAN_0 intensities is specified, then the matching CHAN_N intensity must also be specified. Each CHAN_0,CHAN_N pair defines an intensity gradient that will be applied to all frequency channels. If any intensity (in any polarization or frequency channel) is multiply defined, then the intensity configuration parameters that appear later in the above list will override any configuration set by parameters listed earlier.
- Parameters
config – configuration including any of the parameters specified in the above list
-
virtual void fill_data(char *buf, uint64_t size) override
Fill the buffer with a sequence of data.
- Parameters
buf – base memory address of the buffer to be filled
size – number of bytes to be written to buffer
-
virtual auto test_data(char *buf, uint64_t size) -> bool override
Verify the data stream in the provided buffer.
- Parameters
buf – pointer to buffer containing sequence of data to be verified
size – number of bytes in buffer to be tested
- Returns
true if data match expectations
-
void set_on_intensity(float intensity)
Set the on-pulse intensity for all polarizations and frequency channels.
- Parameters
intensity – the intensity for all polarizations and frequency channels
-
void set_on_intensity(float intensity0, float intensityN)
Set the on-pulse intensity for all polarizations with a slope in frequency channel.
- Parameters
intensity0 – the intensity for all polarizations at frequency channel zero
intensityN – the intensity for all polarizations at frequency channel N
-
void set_on_intensity_pol(unsigned ipol, float intensity)
Set the on-pulse intensity for the specified polarization and all frequency channels.
- Parameters
intensity – the intensity for the specified polarization and all frequency channels
-
void set_on_intensity_pol(unsigned ipol, float intensity0, float intensityN)
Set the on-pulse intensity for the specified polarization with a slope in frequency channel.
- Parameters
intensity0 – the intensity for the specified polarization at frequency channel zero
intensityN – the intensity for the specified polarization at frequency channel N