Waveforms

genalyzer.cos(nsamples, fs, ampl, freq, phase=0.0, td=0.0, tj=0.0)

Generate a cosine waveform sampled at rate fs.

The waveform is: ampl * cos(2*pi*freq*(t + td) + phase), where t = [0, 1/fs, 2/fs, …]. Time delay td shifts the waveform in time. If tj > 0, random Gaussian aperture jitter is added to each sampling instant to model clock jitter.

Args:

nsamples (int) : Number of samples to generate

fs (float) : Sample rate in S/s

ampl (float) : Amplitude

freq (float) : Signal frequency in Hz

phase (float) : Phase offset in radians (default: 0.0)

td (float) : Time delay in seconds (default: 0.0)

tj (float) : RMS aperture jitter in seconds (default: 0.0)

Returns:

out (ndarray) : float64 array of cosine waveform samples

genalyzer.gaussian(nsamples, mean, sd)

Generate an array of Gaussian (normally distributed) random samples.

Args:

nsamples (int) : Number of samples to generate

mean (float) : Mean of the distribution

sd (float) : Standard deviation of the distribution

Returns:

out (ndarray) : float64 array of Gaussian random samples

genalyzer.ramp(nsamples, start, stop, noise)

Generate a linear ramp waveform from start to stop with midpoint sampling.

Each sample is placed at the center of its step. If noise > 0, Gaussian noise with the specified RMS level is added.

Args:

nsamples (int) : Number of samples to generate

start (float) : Start value

stop (float) : Stop value

noise (float) : RMS level of Gaussian noise to add (0 for no noise)

Returns:

out (ndarray) : float64 array of ramp waveform samples

genalyzer.sin(nsamples, fs, ampl, freq, phase=0.0, td=0.0, tj=0.0)

Generate a sine waveform sampled at rate fs.

The waveform is: ampl * sin(2*pi*freq*(t + td) + phase), where t = [0, 1/fs, 2/fs, …]. Time delay td shifts the waveform in time. If tj > 0, random Gaussian aperture jitter is added to each sampling instant to model clock jitter.

Args:

nsamples (int) : Number of samples to generate

fs (float) : Sample rate in S/s

ampl (float) : Amplitude

freq (float) : Signal frequency in Hz

phase (float) : Phase offset in radians (default: 0.0)

td (float) : Time delay in seconds (default: 0.0)

tj (float) : RMS aperture jitter in seconds (default: 0.0)

Returns:

out (ndarray) : float64 array of sine waveform samples

genalyzer.wf_analysis(a)

Compute time-domain statistics of a waveform.

Computes min, max, mid, range, average, RMS, and AC-RMS values.

Args:

a (ndarray) : Input array of type float, int16, int32, or int64

Returns:

results (dict) : Dictionary containing all waveform analysis results

Notes:

Every Key:Value pair in the dictionary is str:float.

The dictionary contains the following keys:

signaltype : Signal type: 0=Real, 1=Complex

min : Minumum value

max : Maximum value

mid : Middle value ((max + min) / 2)

range : Range (max - min)

avg : Average value

rms : RMS value

rmsac : RMS value with DC removed

min_index : Index of first occurence of minimum value

max_index : Index of first occurence of maximum value