Utility Functionality

Filtering

Cardio.medfilt1Function
medfilt1(x::Array{<:Real}; n::Int = 3, padding::String = "zeropad", dim::Int = -1)

Apply a median filter to a signal vector or array x, similar to Matlabs medfilt1. Using Heap based calculation of the median to increase performance for larger windows n.

Args:

  • 'x::Array{<:Real}': Array containing real values

Keywords:

  • 'n::Int': Window length. The Median at point i is defined as median(x[i-n+1:i])
  • 'padding::String': Specifies how to deal with Endpoints. The modes 'zeropad' and 'truncate' are available, with the first as default.
  • 'dim::Int': Specifies the dimension to be filtered along. As default the first non singleton dimension is chosen.

Return:

  • 'Array{Float64,N}': Always type Float64 with the same length as the input x

Examples

julia> medfilt1(collect(1:10))
10-element Array{Float64,1}:
 1.0
 2.0
 3.0
 4.0
 5.0
 6.0
 7.0
 8.0
 9.0
 9.0
source

AR spectra

Cardio.arDecompositionFunction
arDecomposition(x::AbstractVector, p::Union{Int, UnitRange{Int}}; nfreq::Int = 124, sf::Real = 1, verbose::Bool = false)

Perform a decomosition of the AR spectrum of signal x with order p. Returns the complex spectra associated to each AR-pole (nfreq x p) and the respectie center frequencies (p) and a frequency vector (nfreq)

Arguments

  • x: Signal to be decomposed
  • p: order of the AR process, if a UnitRange is given, the optimal order will be chosen through AIC

Keywords

  • nfreq: resolution of the analysed spectra, defaults to 256
  • sf: sampling frequency in Hz, defaults to 1
  • verbose: print some information oder selection, defaults to false
source
Cardio.getSpectralComponentFunction
getSpectralComponent(S::AbstractMatrix, centerFrequencies::AbstractVector, frange::Tuple{<:Real, <:Real} = (0.0, Inf))

Extract the spectral components of a decomposed AR spectrum S, where the center frequencies fall in frange. See also arDecomposition.

source