Class NormalSequence

Inheritance Relationships

Base Type

Class Documentation

class NormalSequence : public ska::pst::common::ByteSequence

Generates a sequence of normally distributed integer values. The configuration of the distribution is controlled by header supplied in the configure method, through the following parameters: DISTRIBUTION_MEAN: mean of the values DISTRIBUTION_STDDEV: standard deviation of the values NBIT: Number of bits per sample in the values.

Public Functions

NormalSequence() = default

Construct a new Normal Sequence object.

~NormalSequence() = default

Destroy the Normal Sequence object.

virtual void configure(const ska::pst::common::AsciiHeader &header) override

Configure the Normal Sequence using the meta data present in the AsciiHeader.

Parameters

header – header containing a UTC_START and OBS_OFFSET key/val pair

inline void set_stddev(float rms)

Set the standard deviation of the generated data.

Parameters

rms – the standard deviation of the normal distribution

virtual void reset() override

Reset the internal state of the Normal Sequence. The next call to generate or validate will behave as per the first call to these functions.

virtual void generate(char *buffer, uint64_t bufsz) override

Generate a random sequence of normally distributed unsigned 8-bit or 16-bit integers. Each random number generated advances the sequence of random numbers.

Parameters
  • buffer – pointer to memory to which the random sequence should be written

  • bufsz – number of elements to write to the buffer

virtual bool validate(char *buffer, uint64_t bufsz) override

Compare contents of buffer to expected random sequence.

Parameters
  • buffer – pointer to buffer containing samples to be validated

  • bufsz – size of the buffer to be validated

Returns

true if all samples are valid

Returns

false if any samples are invalid