breeze.signal

Type members

Classlikes

This class is a converter for using breeze.signal functions on Arrays of Double and Complex, from Java/Matlab/Mathematica.

This class is a converter for using breeze.signal functions on Arrays of Double and Complex, from Java/Matlab/Mathematica.

abstract class OptDesignMethod extends Opt
Companion
object
Companion
class
abstract class OptFilterTaps extends Opt
Companion
object
Companion
class
abstract class OptMethod extends Opt

Option values: how to deal with convolution and filter padding.

Option values: how to deal with convolution and filter padding.

Companion
object
object OptMethod
Companion
class
abstract class OptOverhang extends Opt

Option values: how to deal with convolution overhangs.

Option values: how to deal with convolution overhangs.

Companion
object
object OptOverhang
Companion
class
abstract class OptPadding extends Opt

Option values: how to deal with convolution and filter padding.

Option values: how to deal with convolution and filter padding.

Companion
object
object OptPadding
Companion
class
abstract class OptRange extends Opt

slices specific result ranges out of results for convolve, etc

slices specific result ranges out of results for convolve, etc

Companion
object
object OptRange
Companion
class
abstract class OptWindowFunction extends Opt

Option values: window function for filter design.

Option values: window function for filter design.

Companion
object
Companion
class
object fourierShift extends UFunc

Shift the zero-frequency component to the center of the spectrum. This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component only if len(x) is even.

Shift the zero-frequency component to the center of the spectrum. This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component only if len(x) is even.

Value Params
dft

input array

object fourierTr extends UFunc

Returns the discrete fourier transform of a DenseVector or DenseMatrix. Currently, DenseVector/DenseMatrix types of Double and Complex are supported. Scaling follows the common signal processing convention, i.e. <b>no scaling on forward DFT</b>, and 1/n scaling for the inverse DFT. Of note, fft(x: DenseMatrix[Double]) will perform the 2D fft in both row and column dimensions, as opposed to the MatLab toolbox syntax, which performs column-wise 1D fft. Implementation is via the implicit trait fft.Impl[ InputType, OutputType ], which is found in breeze.signal.support.fft.Impl.scala.

Returns the discrete fourier transform of a DenseVector or DenseMatrix. Currently, DenseVector/DenseMatrix types of Double and Complex are supported. Scaling follows the common signal processing convention, i.e. <b>no scaling on forward DFT</b>, and 1/n scaling for the inverse DFT. Of note, fft(x: DenseMatrix[Double]) will perform the 2D fft in both row and column dimensions, as opposed to the MatLab toolbox syntax, which performs column-wise 1D fft. Implementation is via the implicit trait fft.Impl[ InputType, OutputType ], which is found in breeze.signal.support.fft.Impl.scala.

object iFourierShift extends UFunc

Inverse shift the zero-frequency component to the center of the spectrum. For odd sequences, this is not equivalent to breeze.signal.fourierShift

Inverse shift the zero-frequency component to the center of the spectrum. For odd sequences, this is not equivalent to breeze.signal.fourierShift

Value Params
dft

input array

object iFourierTr extends UFunc

Returns the inverse fast fourier transform of a DenseVector or DenseMatrix. Currently, DenseVector/DenseMatrix types of Double and Complex are supported. Scaling follows the common signal processing convention, i.e. no scaling on forward DFT, and <b>1/n scaling for the inverse DFT</b>. Of note, ifft(x: DenseMatrix[Double]) will perform the 2D ifft in both row and column dimensions, as opposed to the MatLab toolbox syntax, which performs column-wise 1D ifft. Implementation is via the implicit trait CanIFFT[ InputType, OutputType ], which is found in breeze.signal.support.CanIFFT.scala.

Returns the inverse fast fourier transform of a DenseVector or DenseMatrix. Currently, DenseVector/DenseMatrix types of Double and Complex are supported. Scaling follows the common signal processing convention, i.e. no scaling on forward DFT, and <b>1/n scaling for the inverse DFT</b>. Of note, ifft(x: DenseMatrix[Double]) will perform the 2D ifft in both row and column dimensions, as opposed to the MatLab toolbox syntax, which performs column-wise 1D ifft. Implementation is via the implicit trait CanIFFT[ InputType, OutputType ], which is found in breeze.signal.support.CanIFFT.scala.

object rootMeanSquare extends UFunc

Root mean square of a vector.

Root mean square of a vector.

Value members

Concrete methods

def convolve[Input, KernelType, Output](data: Input, kernel: KernelType, range: OptRange, overhang: OptOverhang, padding: OptPadding, method: OptMethod)(implicit canConvolve: CanConvolve[Input, KernelType, Output]): Output

Convolves DenseVectors. Implementation is via the implicit trait CanConvolve[ InputType, OutputType ], which is found in breeze.signal.support.CanConvolve.scala.

Convolves DenseVectors. Implementation is via the implicit trait CanConvolve[ InputType, OutputType ], which is found in breeze.signal.support.CanConvolve.scala.

Value Params
canConvolve

implicit delegate which is used for implementation. End-users should not use this argument.

data

DenseVector or DenseMatrix to be convolved

kernel

DenseVector or DenseMatrix kernel

def correlate[Input, KernelType, Output](data: Input, kernel: KernelType, range: OptRange, overhang: OptOverhang, padding: OptPadding, method: OptMethod)(implicit canConvolve: CanConvolve[Input, KernelType, Output]): Output

Correlates DenseVectors. Implementation is via the implicit trait CanConvolve[ InputType, OutputType ], which is found in breeze.signal.support.CanConvolve.scala. See breeze.signal.convolve for options and other information.

Correlates DenseVectors. Implementation is via the implicit trait CanConvolve[ InputType, OutputType ], which is found in breeze.signal.support.CanConvolve.scala. See breeze.signal.convolve for options and other information.

def designFilterDecimation[Output](factor: Int, multiplier: Double, optDesignMethod: OptDesignMethod, optWindow: OptWindowFunction, optFilterOrder: OptFilterTaps)(implicit canDesignFilterDecimation: CanDesignFilterDecimation[Output]): Output
def designFilterFirwin[Output](taps: Int, omegas: DenseVector[Double], nyquist: Double, zeroPass: Boolean, scale: Boolean, multiplier: Double, optWindow: OptWindowFunction)(implicit canFirwin: CanFirwin[Output]): FIRKernel1D[Output]

FIR filter design using the window method.

FIR filter design using the window method.

This function computes the coefficients of a finite impulse response filter. The filter will have linear phase; it will be Type I if numtaps is odd and Type II if numtaps is even.

Type II filters always have zero response at the Nyquist rate, so a ValueError exception is raised if firwin is called with numtaps even and having a passband whose right end is at the Nyquist rate.

Portions of the code are translated from scipy (scipy.org) based on provisions of the BSD license.

Value Params
nyquist

The nyquist frequency, default is 1.

omegas

Cutoff frequencies of the filter, specified in units of "nyquist." The frequencies should all be positive and monotonically increasing. The frequencies must lie between (0, nyquist). 0 and nyquist should not be included in this array.

optWindow

Currently supports a hamming window breeze.signal.OptWindowFunction.Hamming, a specified window breeze.signal.OptWindowFunction.User, or no window breeze.signal.OptWindowFunction.None.

scale

Whether to scale the coefficiency so that frequency response is unity at either (A) 0 if zeroPass is true or (B) at nyquist if the first passband ends at nyquist, or (C) the center of the first passband. Default is true.

zeroPass

If true (default), the gain at frequency 0 (ie the "DC gain") is 1, if false, 0.

def filter[Input, Kernel, Output](data: Input, kernel: Kernel, overhang: OptOverhang, padding: OptPadding)(implicit canFilter: CanFilter[Input, Kernel, Output]): Output

Filter input data with the specified kernel and options.

Filter input data with the specified kernel and options.

Value Params
canFilter

(implicit delegate to perform filtering on specific Input data types)

data

data to be filtered

kernel

filter kernel (argument of DenseVector[Double] will specify a FIR kernel with specified values).

overhang

whether to have overhanging values. See breeze.signal.OptOverhang

padding

how to pad the values. See breeze.signal.OptPadding

def filterBP[Input, Output](data: Input, omegas: (Double, Double), sampleRate: Double, taps: Int, kernelDesign: OptDesignMethod, overhang: OptOverhang, padding: OptPadding)(implicit canFilterBPBS: CanFilterBPBS[Input, Output]): Output

Bandpass filter the input data.

Bandpass filter the input data.

Value Params
canFilterBPBS

(implicit delegate to perform filtering on specific Input data types)

data

data to be filtered

kernelDesign

currently only supports OptKernelType.Firwin. See breeze.signal.OptDesignMethod

omegas

sequence of two filter band parameters, in units of the Nyquist frequency, or in Hz if the sampleRate is set to a specific value other than 2d.

overhang

whether to have overhanging values when filtering. See breeze.signal.OptOverhang

padding

how to pad the values when filtering. See breeze.signal.OptPadding

sampleRate

default of 2.0 means that the Nyquist frequency is 1.0

taps

number of taps to use (default = 512)

def filterBS[Input, Output](data: Input, omegas: (Double, Double), sampleRate: Double, taps: Int, kernelDesign: OptDesignMethod, overhang: OptOverhang, padding: OptPadding)(implicit canFilterBPBS: CanFilterBPBS[Input, Output]): Output

Bandstop filter the input data.

Bandstop filter the input data.

Value Params
canFilterBPBS

(implicit delegate to perform filtering on specific Input data types)

data

data to be filtered

kernelDesign

currently only supports OptKernelType.Firwin. See breeze.signal.OptDesignMethod

omegas

sequence of two filter band parameters, in units of the Nyquist frequency, or in Hz if the sampleRate is set to a specific value other than 2d.

overhang

whether to have overhanging values when filtering. See breeze.signal.OptOverhang

padding

how to pad the values when filtering. See breeze.signal.OptPadding

sampleRate

default of 2.0 means that the Nyquist frequency is 1.0

taps

number of taps to use (default = 512)

def filterHP[Input, Output](data: Input, omega: Double, sampleRate: Double, taps: Int, kernelDesign: OptDesignMethod, overhang: OptOverhang, padding: OptPadding)(implicit canFilterLPHP: CanFilterLPHP[Input, Output]): Output

Highpass filter the input data.

Highpass filter the input data.

Value Params
canFilterLPHP

(implicit delegate to perform filtering on specific Input data types)

data

data to be filtered

kernelDesign

currently only supports OptKernelType.Firwin. See breeze.signal.OptDesignMethod

omega

cutoff frequency, in units of the Nyquist frequency, or in Hz if the sampleRate is set to a specific value other than 2d.

overhang

whether to have overhanging values when filtering. See breeze.signal.OptOverhang

padding

how to pad the values when filtering. See breeze.signal.OptPadding

sampleRate

default of 2.0 means that the Nyquist frequency is 1.0

taps

number of taps to use (default = 512)

def filterLP[Input, Output](data: Input, omega: Double, sampleRate: Double, taps: Int, kernelDesign: OptDesignMethod, overhang: OptOverhang, padding: OptPadding)(implicit canFilterLPHP: CanFilterLPHP[Input, Output]): Output

Lowpass filter the input data.

Lowpass filter the input data.

Value Params
canFilterLPHP

(implicit delegate to perform filtering on specific Input data types)

data

data to be filtered

kernelDesign

currently only supports OptKernelType.Firwin. See breeze.signal.OptDesignMethod

omega

cutoff frequency, in units of the Nyquist frequency, or in Hz if the sampleRate is set to a specific value other than 2d.

overhang

whether to have overhanging valueswhen filtering. See breeze.signal.OptOverhang

padding

how to pad the values when filtering. See breeze.signal.OptPadding

sampleRate

default of 2.0 means that the Nyquist frequency is 1.0

taps

number of taps to use (default = 512)

def filterMedian[Input](data: DenseVector[Input], windowLength: Int, overhang: OptOverhang)(implicit canFilterMedian: CanFilterMedian[Input]): DenseVector[Input]

Median filter the input data.

Median filter the input data.

Value Params
overhang

specify OptOverhang.PreserveLength (default) or OptOverhang.None (result will be (windowLength -1) shorter) for OptOverhang.PreserveLength, the edges will feature symmetrical odd windows of increasing size, ie ( median( {0} ), median( {0, 1, 2} ), median( {0, 1, 2, 3, 4} )... )

windowLength

only supports odd windowLength values, since even values would cause half-frame time shifts in one or the other direction, and would also lead to floating point values even for integer input

def filterMedian[Input](data: DenseVector[Input], windowLength: Int)(implicit canFilterMedian: CanFilterMedian[Input]): DenseVector[Input]
def fourierFreq(windowLength: Int, fs: Double, dt: Double, shifted: Boolean): DenseVector[Double]

Returns the frequencies for each tap in a discrete Fourier transform, useful for plotting. You must specify either an fs or a dt argument. If you specify both, which is redundant, fs == 1.0/dt must be true.

Returns the frequencies for each tap in a discrete Fourier transform, useful for plotting. You must specify either an fs or a dt argument. If you specify both, which is redundant, fs == 1.0/dt must be true.

f = [0, 1, ..., n/2-1, -n/2, ..., -1] / (dtn) if n is even f = [0, 1, ..., (n-1)/2, -(n-1)/2, ..., -1] / (dtn) if n is odd

Value Params
dt

time step (CAUTION: 1.0/fs; specify default of -1 if using fs)

fs

sampling frequency (1.0/dt; specify default of -1 if using dt)

shifted

whether to return fourierShift'ed frequencies, default=false

windowLength

window length of discrete Fourier transform

def haarTr[Input, Output](v: Input)(implicit canHaarTransform: CanHaarTr[Input, Output]): Output

Return the padded fast haar transformation of a DenseVector or DenseMatrix. Note that the output will always be padded to a power of 2. A matrix will cause a 2D fht. The 2D haar transformation is defined for squared power of 2 matrices. A new matrix will thus be created and the old matrix will be placed in the upper-left part of the new matrix. Avoid calling this method with a matrix that has few cols / many rows or many cols / few rows (e.g. 1000000 x 3) as this will cause a very high memory consumption.

Return the padded fast haar transformation of a DenseVector or DenseMatrix. Note that the output will always be padded to a power of 2. A matrix will cause a 2D fht. The 2D haar transformation is defined for squared power of 2 matrices. A new matrix will thus be created and the old matrix will be placed in the upper-left part of the new matrix. Avoid calling this method with a matrix that has few cols / many rows or many cols / few rows (e.g. 1000000 x 3) as this will cause a very high memory consumption.

Value Params
canHaarTransform

implicit delegate which is used for implementation. End-users should not use this argument.

v

DenseVector or DenseMatrix to be transformed.

Returns

DenseVector or DenseMatrix

See also
def haarTransform[Input, Output](v: Input)(implicit canHaarTransform: CanHaarTr[Input, Output]): Output
def iHaarTr[Input, Output](v: Input)(implicit canInverseHaarTransform: CanIHaarTr[Input, Output]): Output

Returns the inverse fast haar transform for a DenseVector or DenseMatrix.

Returns the inverse fast haar transform for a DenseVector or DenseMatrix.

def inverseHaarTransform[Input, Output](v: Input)(implicit canInverseHaarTransform: CanIHaarTr[Input, Output]): Output