Internals
Functions here are not exported.
DSP.os_fft_complexity
— FunctionEstimate the number of floating point multiplications per output sample for an overlap-save algorithm with fft size nfft
, and filter size nb
.
DSP.os_prepare_conv
— FunctionPrepare buffers and FFTW plans for convolution. The two buffers, tdbuff and fdbuff may be an alias of each other, because complex convolution only requires one buffer. The plans are mutating where possible, and the inverse plan is unnormalized.
DSP.os_conv_block!
— FunctionTake a block of data, and convolve it with the smaller convolution input. This may modify the contents of tdbuff
and fdbuff
, and the result will be in tdbuff
.
Like the real version, but only operates on one buffer
DSP.os_filter_transform!
— FunctionTransform the smaller convolution input to frequency domain, and return it in a new array. However, the contents of buff
may be modified.
DSP.Windows.makewindow
— Functionmakewindow(winfunc::Function, n::Integer, padding::Integer, zerophase::Bool)
Generate a discrete window vector of the given length with padding
zeros. winfunc
should be a function giving the window value in the range of [-0.5, 0.5]. The function is assumed to be 0 outside of this range.
If zerophase
is false
(the default) the window is centered around index (n+1)/2
, which is commonly used for FIR filter design. These are often used for FIR filter design, and usually odd-length. Note that for even-length windows this will cause the window center to be located between samples.
If zerophase
is true
the window is centered around index 1 (with the negative half wrapped to the end of the vector). Additionally this creates a "periodic" window, which means that if there is no padding then the left and right endpoints of the window wrap around to the same sample, so the window length is the same as an n+1
-length non-zerophase
window. Alternatively you can think of the continuous zerophase
window being of width n
and the non-zerophase
window being of length n-1
. zerophase
windows are often used in FFT processing, and are usually even-length.
Example:
function hanning(n::Integer; padding::Integer=0, zerophase::Bool=false)
makewindow(n, padding, zerophase) do x
0.5*(1+cos(2pi*x))
end
end
DSP.Windows.padplot
— Functionpadplot(plotstr)
Takes a multiline string and pre-pads it so that it shows up as preformatted code when included in a docstring.
DSP._zeropad
— Function_zeropad(u, padded_size, [data_dest, data_region])
Creates and returns a new base-1 index array of size padded_size
, with the section of u
specified by data_region
copied into the region of the new array as specified by data_dest
. All other values will be initialized to zero.
If either data_dest
or data_region
is not specified, then the defaults described in _zeropad!
will be used.
DSP._zeropad!
— Function_zeropad!(padded::AbstractVector,
u::AbstractVector,
padded_axes = axes(padded),
data_dest::Tuple = (1,),
data_region = CartesianIndices(u))
Place the portion of u
specified by data_region
into padded
, starting at location data_dest
. Sets the rest of padded
to zero. This will mutate padded
. padded_axes
must correspond to the axes of padded
.
DSP._zeropad_keep_offset
— Function_zeropad_keep_offset(u, padded_size, [data_dest, dat_region])
Like _zeropad
, but retains the first index of u
when creating a new array.
DSP.Filters._polyprep
— Function_polyprep(D::Symbol, x::Union{T,Vector{T}}, ::Type) where {T<:Number}
Converts x
to polynomial form. If x is a Number
, it has to be converted into a Vector
, otherwise LaurentPolynomial
dispatch goes into stack overflow trying to collect a 0-d array into a Vector
.
The DSP convention for Laplace domain is highest power first.
The Polynomials.jl convention is lowest power first.
DSP.Filters.freq_eval
— Functionfunction freq_eval(xf, x::AbstractVector, y::AbstractVector, ad::AbstractVector)
FUNCTION: freq_eval (gee) FUNCTION TO EVALUATE THE FREQUENCY RESPONSE USING THE LAGRANGE INTERPOLATION FORMULA IN THE BARYCENTRIC FORM
DSP.Filters.build_grid
— Functionbuild_grid(numtaps, band_defs, Hz, grid_density, neg)
Returns grid
, des
, and wt
arrays
DSP.Filters.lagrange_interp
— Functionlagrange_interp(k::Integer, n::Integer, m::Integer, x::AbstractVector)
CALCULATE THE LAGRANGE INTERPOLATION COEFFICIENTS
DSP.Periodograms.coherence_from_cs!
— Functioncoherence_from_cs!(output::AbstractArray, cs_matrix)
Compute the pairwise channel coherences from a cross spectral matrix, storing the result in output
.
DSP.optimalfftfiltlength
— FunctionDetermine the length of FFT that minimizes the number of multiplications per output sample for an overlap-save convolution of vectors of size nb
and nx
.