Autocorrelation Wavelet Transform

Transforms on 1 Signal

Public API

WaveletsExt.ACWT.acdwtFunction
acdwt(x, wt[, L])

Performs a discrete autocorrelation wavelet transform for a given signal x. The signal can be 1D or 2D. The wavelet type wt determines the transform type. Refer to Wavelet.jl for a list of available methods.

Arguments

  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

::Array{T}: Output from ACDWT on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACDWT
acdwt(x, wt)
acdwt(x, wt, 4) # level 4 decomposition

See also: acdwt_step, iacdwt, acdwt!

source
WaveletsExt.ACWT.acdwt!Function
acdwt!(xw, x, wt, L)

Same as acdwt but without array allocation.

Arguments

  • xw::AbstractArray{T}: An allocated array of dimension (n,L+1) or (n,m,3L+1) to write the outputs of x onto.
  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

xw::Array{T,2}: Output from ACDWT on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine, 7)
wt = wavelet(WT.haar)

# ACDWT
xw = Matrix{Float64}(undef, (128,5))
acdwt!(xw, x, wt, 4)

See also: acdwt

source
WaveletsExt.ACWT.iacdwtFunction
iacdwt(xw[, wt])

Performs the inverse autocorrelation discrete wavelet transform. Can be used for both the 1D and 2D case.

Note

The inverse autocorrelation transform does not require any wavelet filter, but an optional wt positional argument is included for the standardization of syntax with dwt and sdwt, but is ignored during the reconstruction of signals.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACDWT-transformed array.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACDWT
xw = acdwt(x, wt)

# IACDWT
x̃ = iacdwt(xw)

See also: acdwt, iacdwt_step!

source
WaveletsExt.ACWT.iacdwt!Function
iacdwt!(x, xw[, wt])

Similar to iacdwt but without array allocation.

Arguments

  • x::AbstractArray{T} where T<:Number or x::AbstractArray{T,2} where T<:Number: Allocation for reconstructed signal.
  • xw::AbstractArray{T} where T<:Number or xw::AbstractArray{T,4}: ACDWT-transformed array.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

x::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACDWT
xw = acdwt(x, wt)

# IACDWT
x̃ = similar(x)
iacdwt!(x̃, xw)

See also: iacdwt, acdwt

source
WaveletsExt.ACWT.acwptFunction
acwpt(x, wt[, L])

Computes L levels of autocorrelation wavelet packet transforms (ACWPT) on x.

Arguments

  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ or (2ᴷ,2ᴹ) where $K, M \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

::Array{T}: Output from ACWPT on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPT
xw = acwpt(x, wt)

See also: iacwpt, acdwt, acwpd

source
WaveletsExt.ACWT.acwpt!Function
acwpt!(xw, x, wt[, L])

Same as acwpt but without array allocation.

Arguments

  • xw::AbstractArray{T} where T<:Number: Allocation for transformed signal.
  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ or (2ᴷ,2ᴹ) where $K, M \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

xw::Array{T}: Output from ACWPT on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPT
xw = Array{Float64,2}(undef, (128,128))
acwpt!(xw, x, wt)

See also: acwpt, iacwpt

source
WaveletsExt.ACWT.iacwptFunction
iacwpt(xw[, wt])

Computes the inverse autocorrelation wavelet packet transform (IACWPT) on xw.

Note

The inverse autocorrelation transform does not require any wavelet filter, but an optional wt positional argument is included for the standardization of syntax with wpt and swpt, but is ignored during the reconstruction of signals.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACWPT-transformed array.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPT
xw = acwpt(x, wt)

# IACWPT
x̃ = iacwpt(xw)

See also: iacdwt, acwpt

source
WaveletsExt.ACWT.iacwpt!Function
iacwpt!(x, xw[, wt])

Same as iacwpt but without array allocation.

Arguments

  • x::AbstractArray{T} where T<:Number: Allocated array for output.
  • xw::AbstractArray{T} where T<:Number: ACWPD-transformed array.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

x::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPT
xw = acwpt(x, wt)

# IACWPT
x̂ = similar(x)
iacwpt!(x̂, xw)

See also: iacwpt

source
WaveletsExt.ACWT.acwpdFunction
acwpd(x, wt[, L])

Performs a discrete autocorrelation wavelet packet transform for a given signal x. The wavelet type wt determines the transform type. Refer to Wavelet.jl for a list of available methods.

Arguments

  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ or (2ᴷ,2ᴹ) where $K, M \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

::Array{T}: Output from ACWPD on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPD
acwpd(x, wt)

acwpd(x, wt, 4)

See also: iacwpd, acdwt, acdwt_step

source
WaveletsExt.ACWT.acwpd!Function
acwpd!(xw, x, wt[, L])

Same as acwpd but without array allocation.

Arguments

  • xw::AbstractArray{T} where T<:Number: Allocated array for output.
  • x::AbstractArray{T} where T<:Number: Original signal, preferably of size 2ᴷ where $K \in \mathbb{N}$.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition.

Returns

xw::Array{T}: Output from ACWPD on x.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPD
xw = Matrix{Float64}(undef, (128, 255))
acwpd!(xw, x, wt)
acwpd!(xw, x, wt, 7)

See also: acwpd!

source
WaveletsExt.ACWT.iacwpdFunction
iacwpd(xw, L)
iacwpd(xw[, wt, L])
iacwpd(xw, tree)
iacwpd(xw, wt, tree)

Performs the inverse autocorrelation discrete wavelet packet transform, with respect to a decomposition tree.

Note

The inverse autocorrelation transform does not require any wavelet filter, but an optional wt positional argument is included for the standardization of syntax with wpt and swpt, but is ignored during the reconstruction of signals.

Note

This function might not be very useful if one is looking to reconstruct a raw decomposed signal. The purpose of this function would be better utilized in applications such as denoising, where a signal is decomposed (swpd) and thresholded (denoise/denoiseall) before being reconstructed.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACWPD-transformed array.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition used for reconstruction.
  • tree::BitVector: Binary tree for inverse transform to be computed accordingly.

Returns

::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPD
xw = acwpd(x, wt)

# IACWPD
x̂ = iacwpd(xw, 4)
x̂ = iacwpd(xw, wt, 4)
x̂ = iacwpd(xw, maketree(x))
x̂ = iacwpd(xw, wt, maketree(x))

See also: acwpd

source
WaveletsExt.ACWT.iacwpd!Function
iacwpd!(x, xw, L)
iacwpd!(x, xw[, wt, L])
iacwpd!(x, xw, tree)
iacwpd!(x, xw, wt, tree)

Same as iacwpd but with no array allocation.

Arguments

  • x::AbstractArray{T} where T<:Number: Allocated array for output.
  • xw::AbstractArray{T} where T<:Number: ACWPD-transformed array.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: maxtransformlevels(x)) Number of levels of decomposition used for reconstruction.
  • tree::BitVector: Binary tree for inverse transform to be computed accordingly.

Returns

x::Array{T}: Inverse transformed signal.

Examples

using Wavelets, WaveletsExt

# Setup
x = generatesignals(:heavysine)
wt = wavelet(WT.haar)

# ACWPD
xw = acwpd(x, wt)

# IACWPD
x̂ = similar(x)
iacwpd!(x̂, xw, 4)
iacwpd!(x̂, xw, wt, 4)
iacwpd!(x̂, xw, maketree(x))
iacwpd!(x̂, xw, wt, maketree(x))

See also: iacwpd

source

Transforms on Multiple Signals

Public API

WaveletsExt.ACWT.acdwtallFunction
acdwtall(x, wt[, L])

Computes the autocorrelation discrete wavelet transform (ACDWT) on each slice of signal.

Arguments

  • x::AbstractArray{T} where T<:Number: Input N-1-D signals, where each signal is sliced at dimension N.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: minimum(size(xw)[1:end-1]) |> maxtransformlevels) Number of levels of wavelet transforms.

Returns

  • ::Array{T}: Slices of transformed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACDWT on all signals in x
xw = acdwtall(x, wt)

See also: acdwt

source
WaveletsExt.ACWT.iacdwtallFunction
iacdwtall(xw[, wt])

Computes the inverse autocorrelation discrete wavelet transform (IACDWT) on each slice of signal.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACDWT-transformed signal.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

  • ::Array{T}: Slices of reconstructed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACDWT on all signals in x
xw = acdwtall(x, wt)

# IACDWT on all signals in xw
x̂ = iacdwtall(xw)

See also: iacdwt

source
WaveletsExt.ACWT.acwptallFunction
acwptall(x, wt[, L])

Computes the autocorrelation wavelet packet transform (ACWPT) on each slice of signal.

Arguments

  • x::AbstractArray{T} where T<:Number: Input N-1-D signals, where each signal is sliced at dimension N.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: minimum(size(xw)[1:end-1]) |> maxtransformlevels) Number of levels of wavelet transforms.

Returns

  • ::Array{T}: Slices of transformed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACWPT on all signals in x
xw = acwptall(x, wt)

See also: acwpt

source
WaveletsExt.ACWT.iacwptallFunction
iacwptall(xw[, wt])

Computes the inverse autocorrelation wavelet packet transform (IACWPT) on each slice of signal.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACWPT-transformed signal.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.

Returns

  • ::Array{T}: Slices of reconstructed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACWPT on all signals in x
xw = acwptall(x, wt)

# IACWPT on all signals in xw
x̂ = iacwptall(xw)

See also: iacwpt

source
WaveletsExt.ACWT.acwpdallFunction
acwpdall(x, wt[, L])

Computes the autocorrelation wavelet packet decomposition (ACWPD) on each slice of signal.

Arguments

  • x::AbstractArray{T} where T<:Number: Input N-1-D signals, where each signal is sliced at dimension N.
  • wt::OrthoFilter: Orthogonal wavelet filter.
  • L::Integer: (Default: minimum(size(xw)[1:end-1]) |> maxtransformlevels) Number of levels of wavelet transforms.

Returns

  • ::Array{T}: Slices of transformed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACWPD on all signals in x
xw = acwpdall(x, wt)

See also: acwpd

source
WaveletsExt.ACWT.iacwpdallFunction
iacwpdall(xw[, wt, L])
iacwpdall(xw, L)
iacwpdall(xw, wt, tree)
iacwpdall(xw, tree)

Computes the inverse autocorrelation wavelet packet decomposition (IACWPD) on each slice of signal.

Arguments

  • xw::AbstractArray{T} where T<:Number: ACWPD-transformed signal.
  • wt::Union{OrthoFilter, Nothing}: (Default: nothing) Orthogonal wavelet filter.
  • L::Integer: (Default: minimum(size(xw)[1:end-2]) |> maxtransformlevels) Number of levels of wavelet transforms.
  • tree::BitVector: Binary tree for inverse transform to be computed accordingly.

Returns

  • ::Array{T}: Slices of reconstructed signals.

Examples

using Wavelets, WaveletsExt

# Generate random signals
x = randn(32, 5)
# Create wavelet
wt = wavelet(WT.db4)

# ACWPD on all signals in x
xw = acwpdall(x, wt)

# IACWPD on all signals in xw
x̂ = iacwpdall(xw)
x̂ = iacwpdalll(xw, maketree(x))
x̂ = iacwpdall(xw, 5)

See also: iacwpd

source

Utilities

Private API

Single Step Transforms

Private API

WaveletsExt.ACWT.acdwt_stepFunction
acdwt_step(v, d, h, g)

Performs one level of the autocorrelation discrete wavelet transform (acdwt) on the vector v, which is the j-th level scaling coefficients (Note the 0th level scaling coefficients is the raw signal). The vectors h and g are the detail and scaling filters.

Arguments

  • v::AbstractArray{T} where T<:Number: Array of coefficients from a node at level d.
  • d::Integer: Depth level of v.
  • h::Vector{S} where S<:Number: High pass filter.
  • g::Vector{S} where S<:Number: Low pass filter.

Returns

  • w₁::AbstractVector{T} where T<:Number or w₁::AbstractMatrix{T} where T<:Number: Vector allocation for output from low pass filter (1D case); or matrix allocation for output from low + low pass filter (2D case).
  • w₂::AbstractVector{T} where T<:Number or w₂::AbstractMatrix{T} where T<:Number: Vector allocation for output from high pass filter (1D case); or matrix allocation for output from low + high pass filter (2D case).
  • w₃::AbstractVector{T} where T<:Number or w₃::AbstractMatrix{T} where T<:Number: Matrix allocation for output from high + low pass filter (2D case).
  • w₄::AbstractVector{T} where T<:Number or w₄::AbstractMatrix{T} where T<:Number: Matrix allocation for output from high + high pass filter (2D case).

Examples

using Wavelets, WaveletsExt

# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.make_acreverseqmfpair(wt)

# One step of ACDWT
ACWT.acdwt_step(v, 0, h, g)

See also: acdwt, iacdwt

source
WaveletsExt.ACWT.acdwt_step!Function
acdwt_step!(w₁, w₂, v, j, h, g)

Same with acdwt_step but without array allocation.

Arguments

  • w₁::AbstractVector{T} where T<:Number or w₁::AbstractMatrix{T} where T<:Number: Vector allocation for output from low pass filter (1D case); or matrix allocation for output from low + low pass filter (2D case).
  • w₂::AbstractVector{T} where T<:Number or w₂::AbstractMatrix{T} where T<:Number: Vector allocation for output from high pass filter (1D case); or matrix allocation for output from low + high pass filter (2D case).
  • w₃::AbstractVector{T} where T<:Number or w₃::AbstractMatrix{T} where T<:Number: Matrix allocation for output from high + low pass filter (2D case).
  • w₄::AbstractVector{T} where T<:Number or w₄::AbstractMatrix{T} where T<:Number: Matrix allocation for output from high + high pass filter (2D case).
  • v::AbstractArray{T} where T<:Number: Array of coefficients from a node at level d.
  • d::Integer: Depth level of v.
  • h::Vector{S} where S<:Number: High pass filter.
  • g::Vector{S} where S<:Number: Low pass filter.

Returns

  • w₁::AbstractVector{T} where T<:Number or w₁::AbstractMatrix{T} where T<:Number: Output from low pass filter (1D case); or output from low + low pass filter (2D case).
  • w₂::AbstractVector{T} where T<:Number or w₂::AbstractMatrix{T} where T<:Number: Output from high pass filter (1D case); or output from low + high pass filter (2D case).
  • w₃::AbstractVector{T} where T<:Number or w₃::AbstractMatrix{T} where T<:Number: Output from high + low pass filter (2D case).
  • w₄::AbstractVector{T} where T<:Number or w₄::AbstractMatrix{T} where T<:Number: Output from high + high pass filter (2D case).

Examples

using Wavelets, WaveletsExt

# Setup
v = randn(8)
w₁ = similar(v)
w₂ = similar(v)
wt = wavelet(WT.haar)
g, h = WT.make_acreverseqmfpair(wt)

# One step of ACDWT
ACWT.acdwt_step!(w₁, w₂, v, 0, h, g)

See also: acdwt_step!, acdwt, iacdwt

source
WaveletsExt.ACWT.iacdwt_stepFunction
iacdwt_step(w₁, w₂)
iacdwt_step(w₁, w₂, w₃, w₄)

Perform one level of the inverse autocorrelation discrete wavelet transform (IACDWT) on the vectors w₁ and w₂, which are the j+1-th level scaling coefficients (Note that the 0th level scaling coefficients is the raw signal).

Arguments

  • w₁::AbstractVector{T} where T<:Number or w₁::AbstractMatrix{T} where T<:Number: Coefficients of left child node (1D case); or coefficients from top left child node (2D case).
  • w₂::AbstractVector{T} where T<:Number or w₂::AbstractMatrix{T} where T<:Number: Coefficients of right child node (1D case); or coefficients from top right child node (2D case).
  • w₃::AbstractVector{T} where T<:Number or w₃::AbstractMatrix{T} where T<:Number: Coefficients from bottom left child node (2D case).
  • w₄::AbstractVector{T} where T<:Number or w₄::AbstractMatrix{T} where T<:Number: Coefficients from bottom right child node (2D case).

Returns

  • v::Array{T}: Reconstructed coefficients.

Examples

using Wavelets, WaveletsExt

# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.make_acreverseqmfpair(wt)

# One step of ACDWT
w₁, w₂ = ACWT.acdwt_step(v, 0, h, g)

# One step of IACDWT
v̂ = ACWT.iacdwt_step(w₁, w₂)

See also: iacdwt_step!, acdwt_step, iacdwt

source
WaveletsExt.ACWT.iacdwt_step!Function
iacdwt_step!(v, w₁, w₂)

Same as iacdwt_step but without array allocation.

Arguments

  • v::AbstractArray{T} where T<:Number: Array allocation for reconstructed coefficients.
  • w₁::AbstractVector{T} where T<:Number or w₁::AbstractMatrix{T} where T<:Number: Coefficients of left child node (1D case); or coefficients from top left child node (2D case).
  • w₂::AbstractVector{T} where T<:Number or w₂::AbstractMatrix{T} where T<:Number: Coefficients of right child node (1D case); or coefficients from top right child node (2D case).
  • w₃::AbstractVector{T} where T<:Number or w₃::AbstractMatrix{T} where T<:Number: Coefficients from bottom left child node (2D case).
  • w₄::AbstractVector{T} where T<:Number or w₄::AbstractMatrix{T} where T<:Number: Coefficients from bottom right child node (2D case).

Returns

  • v::Array{T}: Reconstructed coefficients.

Examples

using Wavelets, WaveletsExt

# Setup
v = randn(8)
wt = wavelet(WT.haar)
g, h = WT.make_acreverseqmfpair(wt)

# One step of ACDWT
w₁, w₂ = ACWT.acdwt_step(v, 0, h, g)

# One step of IACDWT
v̂ = similar(v)
ACWT.iacdwt_step!(v̂, w₁, w₂)

See also: iacdwt_step, acdwt_step, iacdwt

source