Skip to content

Signal Processing Cheat Sheet

alex-kachur-jibo edited this page Oct 23, 2017 · 7 revisions

needs import breeze.signal._
Note: many of these functions have extensive optional parameters in breeze. See the ScalaDoc for a description of each parameter.

Basic Operations

Operation Breeze Numpy Matlab
Convolve convolve[Input, KernelType, Output] conv(u,v) conv(u,v)
Correlate correlate[Input, KernelType, Output] xcorr(u,v) xcorr(u,v)

these Breeze functions will use fft convolution by default for floating point DenseMatrixes and DenseVectors. For Int and Long DV/DMs, you can specify fft convolution by specifying the optional argument optMethod = OptMethod.FFT

Transforms

Operation Breeze Numpy Matlab
1D Fourier transform fourierTr( data: Array[Complex ) fft( a ) fft( a )
1D Inverse Fourier transform iFourierTr(data: Array[Complex]) ifft( a ) ifft( a )
2D Fourier Transform fourierTr2C(data: Array[Array[Complex]]) fft2( a ) fft2( a )
2D Inverse Fourier Transform iFourierTr( data: Array[Array[Complex]] ) ifft2( a ) ifft2( a )

Convenience Functions for DFT

Operation Breeze Numpy Matlab
Fourier frequencies fourierFreq( n, dt = (timestep) ) or fourierFreq( n, fs = (sample freq) ) fftfreq(n, dt) ---
Fourier shift fourierShift( data: Array[Double] ) fftshift( a ) fftshift( a )
(inverse) iFourierShift( data: Array[Double] ) ifftshift( a ) ifftshift( a )

Filtering

Operation Breeze Numpy Matlab
Filter filter( data: Input, kernel: Kernel, overhang: OptOverhang = OptOverhang.PreserveLength, padding: OptPadding = OptPadding.Zero ) --- ---
Bandpass Filter filterBP( data: Array[Double], omegaLow: Double, omegaHigh: Double, sampleRate: Double, taps = 512 ) --- ---
Bandstop Filter filterBS( data: Array[Double], omegaLow: Double, omegaHigh: Double, sampleRate: Double, taps = 512 ) --- ---
Lowpass Filter filterLP( data: Array[Double], omega: Double, sampleRate: Double, taps = 512 ) --- ---
Highpass Filter filterHP( data: Array[Double], omega: Double, sampleRate: Double, taps = 512 ) --- ---
Median Filter filterMedian( data: DenseVector[Input], windowLength: Int, overhang: OptOverhang = OptOverhang.PreserveLength ) --- ---
Clone this wiki locally