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 generatefs(float) : Sample rate in S/sampl(float) : Amplitudefreq(float) : Signal frequency in Hzphase(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) :float64array 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 generatemean(float) : Mean of the distributionsd(float) : Standard deviation of the distribution- Returns:
out(ndarray) :float64array 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 generatestart(float) : Start valuestop(float) : Stop valuenoise(float) : RMS level of Gaussian noise to add (0 for no noise)- Returns:
out(ndarray) :float64array 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 generatefs(float) : Sample rate in S/sampl(float) : Amplitudefreq(float) : Signal frequency in Hzphase(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) :float64array 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 typefloat,int16,int32, orint64- 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=Complexmin: Minumum valuemax: Maximum valuemid: Middle value ((max + min) / 2)range: Range (max - min)avg: Average valuerms: RMS valuermsac: RMS value with DC removedmin_index: Index of first occurence of minimum valuemax_index: Index of first occurence of maximum value