wf: Basic waveform operations

wf module contains Wf class for handling waveform data. It implements such basic operations as addition, multiplication, subsets, plotting etc. Also implemented are the FFT and several methods of interpolation.

class wf.Wf(ns, fs, t0=0.0, name='', type='f')[source]

The waveform class

ns - number of samples

fs - sampling frequency

t0 - start time

name - name of the waveform

type - type of the waveform, f (default) for floating point and i for integer

add(wf)

Add another waveform data

It is also possible to do wf1+wf2

addBias(bias)

Add a bias (pedestal) to the waveform

addBurst(amp, freq, phi, t1, tp)

Add an RF burst

addDecSin(amp, freq, phi, t1, tau)

Add a decaying exponential

addNoise(sigma)

Add noise to the waveform

addSin(amp, freq, phi=0.0)

Add a sinusoidal signal

addTrend(trend)

Add a trend to the waveform

clone()

Make a new copy of the waveform

copy(wf)

Save a copy of data in another waveform

divide(wf)

Divide by another waveform data

It is also possible to do wf1/wf2

doFft()

Take an FFT of the waveform

getAmp(wfI, wfQ)

Get the amplitude from the real and imaginary components

getFs()[source]

Return the sampling frequency

getNs()[source]

Return the number of samples

getPhi(wfI, wfQ)

Get the phase from the real and imaginary components

getSample(i)

Get the value of the sample number i

getStat()

Get waveform statistics

getT()

Get the time array

getT0()[source]

Return the start time of the waveform

getValue(t, mode=4)

Get the value of the waveform at a time t

mode - interpolation mode, one of the:

WF_NEAREST - rounding to the nearest value WF_LINEAR - linear interpolation WF_QUADRATIC - quadratic interpolation WF_SINC - interpolation using sinc function WF_LANCZOS - interpolation using Lanczos core WF_DEFAULT - default mode, initially set to WF_LANCZOS

getWf()[source]

getWf function prototype

isCompatible(wf)

Check compatibility with another waveform

Waveforms are compatible if they start at the same t0 and have the same sampling rate

isSimilar(wf)

Check compatibility with another waveform

multiply(wf)

Multiply by another waveform data

It is also possible to do wf1*wf2

plotFft()

Plot the FFT of the waveform

plotSamples(opt='')

Plot the waveform vs sample number

plotSpectrum()

Plot the spectrum of the waveform

plotWf(opt='')

Plot the waveform in time

printOut()

Print out the waveform parameters and data

reset()

Reset the data in the waveform

scale(s)

Scale the waveform data

setFs(fs)

Reset the sampling frequency of the waveform

setNs(ns)

Reset the number of samples in the waveform

setSample(i, val)

Set the value of the sample i

setSamples(vals)

Set the values of the waveform

setT0(t0)

Set the start time of the waveform

subset(n1, n2)

Get a new waveform with a subset of data [n1,n2)

subtract(wfsub)

Subtract another waveform data

It is also possible to do wf1-wf2

toFloat()

Convert an integer waveform into a float waveform

toInt()

Convert a float waveform into an integer waveform

Previous topic

Welcome to wfProc’s documentation!

Next topic

proc: Waveform processing

This Page