Miscellaneous.jl

This module implements miscellaneous utilities.

FunctionDescription
Eegle.Miscellaneous.removeremove elements from vectors and rows or columns from matrices
Eegle.Miscellaneous.isSquarecheck that a matrix is square
Eegle.Miscellaneous.minimalocal minuma of a sequence
Eegle.Miscellaneous.maximalocal maxima of a sequence

📖

Eegle.Miscellaneous.removeFunction
    function remove(X::Union{Vector, Matrix}, 
                    what::Union{Int, Vector{Int}}; 
        dims=1)

Return vector X removing one or more elements, or matrix X removing one or more columns or rows.

If X is a matrix, dims=1 (default) remove rows, dims=2 remove columns.

If X is a Vector, dims has no effect.

The what argument can be either an integer or a vector of integers

See Also Eegle.Preprocessing.removeSamples, Eegle.Preprocessing.removeChannels

Examples

using Eegle # or using Eegle.Miscellaneous

a=randn(5)
b=remove(a, 2) # remove second element
b=remove(a, collect(1:3)) # remove rows 1 to 3

A=randn(3, 3)
B=remove(A, 2) # remove second row
B=remove(A, 2; dims=2) # remove second column

A=randn(5, 5)
B=remove(A, collect(1:2:5)) # remove rows 1, 3 and 5
C=remove(A, [1, 4]) # remove rows 1 and 4

# remove columns 2, 3, 8, 9, 10
A=randn(10, 10)
B=remove(A, [collect(2:3); collect(8:10)]; dims=2)

# remove every other sample (decimation by a factor of 2)
A=randn(10, 10)
B=remove(A, collect(1:2:size(A, 1)); dims=1)

# NB: before decimating the data must be low-pass filtered,
# see the documentation of `resample`
source
Eegle.Miscellaneous.minimaFunction
    function minima(v::AbstractVector{T}) 
    where T<:Real

Return the 2-tuple formed by the vector of local minima of vector v and the vector of the indices of v corresponding to the minima.

This is useful in several situations. For example, Eegle uses it to segment spontaneous EEG data (see Eegle.Processing.epoching).

source
Eegle.Miscellaneous.maximaFunction
    function maxima(v::AbstractVector{T}) 
    where T<:Real

Return the 2-tuple formed by the vector of local maxima of vector v and the vector of the indices of v corresponding to the maxima.

source