NeuroAnalyzer.jl documentation

This documentation has been generated using Documenter.jl.

Utils

Base.sizeFunction
size(A::AbstractArray, [dim])

Return a tuple containing the dimensions of A. Optionally you can specify a dimension to just get the length of that dimension.

Note that size may not be defined for arrays with non-standard indices, in which case axes may be useful. See the manual chapter on arrays with custom indices.

See also: length, ndims, eachindex, sizeof.

Examples

julia> A = fill(1, (2,3,4));

julia> size(A)
(2, 3, 4)

julia> size(A, 2)
3
source
size(cb::CircularBuffer)

Return a tuple with the size of the buffer.

size(df::AbstractDataFrame[, dim])

Return a tuple containing the number of rows and columns of df. Optionally a dimension dim can be specified, where 1 corresponds to rows and 2 corresponds to columns.

See also: nrow, ncol

Examples

julia> df = DataFrame(a=1:3, b='a':'c');

julia> size(df)
(3, 2)

julia> size(df, 1)
3
size(dfr::DataFrameRow[, dim])

Return a 1-tuple containing the number of elements of dfr. If an optional dimension dim is specified, it must be 1, and the number of elements is returned directly as a number.

See also: length

Examples

julia> dfr = DataFrame(a=1:3, b='a':'c')[1, :]
DataFrameRow
 Row │ a      b
     │ Int64  Char
─────┼─────────────
   1 │     1  a

julia> size(dfr)
(2,)

julia> size(dfr, 1)
2
size(p::Plan, [dim])

Return the size of the input of a plan p, optionally at a specified dimenion dim.

size(::AbstractPolynomial, [i])

Returns the size of the polynomials coefficients, along axis i if provided.

size(s::Sampleable)

The size (i.e. shape) of each sample. Always returns () when s is univariate, and (length(s),) when s is multivariate.

size(d::MultivariateDistribution)

Return the sample size of distribution d, i.e (length(d),).

size(d::MatrixDistribution)

Return the size of each sample from distribution d.

size(model::AbstractDimensionalityReduction, d::Int)

Returns the dimension of the input data if d == 1, the dimension of the output data if d == 2, otherwise throws error.

size(f)

Dimensions of the coefficient matrix of the whitening transform f.

size(M)

Returns a tuple with the dimensions of input (the dimension of the observation space) and output (the dimension of the principal subspace).

size(M::PPCA)

Returns a tuple with values of the input dimension $d$, i.e the dimension of the observation space, and the output dimension $p$, i.e the dimension of the principal subspace.

size(M::KernelPCA)

Returns a tuple with the input dimension $d$, i.e the dimension of the observation space, and the output dimension $p$, i.e the dimension of the principal subspace.

size(M:CCA)

Return a tuple with the dimension of X, Y, and the output dimension.

size(M::MDS)

Returns tuple where the first value is the MDS model M input dimension, i.e the dimension of the observation space, and the second value is the output dimension, i.e the dimension of the embedding.

size(M::MetricMDS)

Returns tuple where the first value is the MDS model M input dimension, i.e the dimension of the observation space, and the second value is the output dimension, i.e the dimension of the embedding.

size(M::MulticlassLDA)

Get the input (i.e the dimension of the observation space) and output (i.e the dimension of the transformed features) dimensions of the model M.

size(M)

Get the input (i.e the dimension of the observation space) and output (i.e the dimension of the subspace projection) dimensions of the model M.

size(M::ICA)

Returns a tuple with the input dimension, i.e the number of observed mixtures, and the output dimension, i.e the number of independent components.

size(M::FactorAnalysis)

Returns a tuple with values of the input dimension $d$, i.e the dimension of the observation space, and the output dimension $p$, i.e the dimension of the principal subspace.

size(g, i)

Return the number of vertices in g if i=1 or i=2, or 1 otherwise.

Examples

julia> using Graphs

julia> g = cycle_graph(4);

julia> size(g, 1)
4

julia> size(g, 2)
4

julia> size(g, 3)
1
size(m::MixedModel)

Returns the size of a mixed model as a tuple of length four: the number of observations, the number of (non-singular) fixed-effects parameters, the number of conditional modes (random effects), the number of grouping variables

size(obj)

Return size of the object data.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • s::Tuple{Int64, Int64, Int64}
size(obj, n)

Return size of the object data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • d::Int64: compute size along dimension d

Returns

  • s::Int64
NeuroAnalyzer.add_componentFunction
add_component(obj; <keyword arguments>)

Add component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name
  • v::Any: component value

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_component!Function
add_component!(obj; <keyword arguments>)

Add component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name
  • v::Any: component value

Returns

Nothing

NeuroAnalyzer.add_noteFunction
add_note(obj; <keyword arguments>)

Add recording note to the object header.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • note::String

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_note!Function
add_note!(obj; <keyword arguments>)

Add recording note to the object header.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • note::String

Returns

Nothing

NeuroAnalyzer.applyFunction
apply(obj; <keyword arguments>)

Apply custom function.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • f::String: function to be applied, e.g. f="mean(obj, dims=3)"; OBJ signal is given using variable obj here.

Returns

  • out::Array{Float64, 3}
NeuroAnalyzer.areduceFunction
areduce(a, f; <keyword arguments>)

Reduce an array at indices of a vector being multiplications of a constant. Useful e.g. for simplifying values across frequencies, when the number of frequencies (and thus values) is high.

Arguments

  • a::AbstractArray: e.g. signal data
  • f::AbstractVector: e.g. frequencies
  • n::Float64=0.5: reduce at multiplications of this value

Returns

  • a_new::Array{eltype(a), ndims(a)}
  • f_new::Vector{eltype(f)}
NeuroAnalyzer.arr2matFunction
arr2mat(x)

Reshape array into matrix.

Arguments

  • x::AbstractArray

Returns

  • m::AbstractMatrix
NeuroAnalyzer.band_frqFunction
band_frq(obj, band)

Return band frequency limits.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • band::Symbol: band range name:
    • :list
    • :total
    • :delta: 0.1 - 4.0 Hz
    • :theta: 4.0 - 8.0 Hz
    • :alpha: 8.0 - 13.0 Hz
    • :alpha_lower: 8.0 - 10.5 Hz
    • :alpha_higher: 10.5 - 13.0 Hz
    • :beta: 14.0 - 30.0 Hz
    • :beta_lower: 14.0 - 25.0 Hz
    • :beta_higher: 25.0 - 30.0 Hz
    • :gamma: 30.0 - 150.0 Hz
    • :gamma_1: 30.0 - 40.0 Hz
    • :gamma_2: 40.0 - 50.0 Hz
    • :gamma_lower: 30.0 - 80.0 Hz
    • :gamma_higher: 80.0 - 150.0 Hz

Returns

  • bf::Tuple{Float64, Float64}
band_frq(fs, band)

Return band frequency limits.

Arguments

  • fs::Int64: sampling rate
  • band::Symbol: band range name:
    • :list
    • :total
    • :delta: 0.1 - 4.0 Hz
    • :theta: 4.0 - 8.0 Hz
    • :alpha: 8.0 - 13.0 Hz
    • :alpha_lower: 8.0 - 10.5 Hz
    • :alpha_higher: 10.5 - 13.0 Hz
    • :beta: 14.0 - 30.0 Hz
    • :beta_lower: 14.0 - 25.0 Hz
    • :beta_higher: 25.0 - 30.0 Hz
    • :gamma: 30.0 - 150.0 Hz
    • :gamma_1: 30.0 - 40.0 Hz
    • :gamma_2: 40.0 - 50.0 Hz
    • :gamma_lower: 30.0 - 80.0 Hz
    • :gamma_higher: 80.0 - 150.0 Hz

Returns

  • bf::Tuple{Float64, Float64}
NeuroAnalyzer.cextremaFunction
cextrema(x)

Return extreme values of the complex vector.

Arguments

  • x::Vector{ComplexF64}

Returns

Tuple containing:

  • cmax::ComplexF64
  • cmin::ComplexF64
NeuroAnalyzer.channel_clusterFunction
channels_cluster(obj; <keyword arguments>)

Return channels belonging to a cluster of channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • cluster::Symbol: available clusters are:
    • :f1: left frontal (F1, F3, F5, F7, AF3, AF7)
    • :f2: right frontal (F2, F4, F6, F8, AF4, AF8)
    • :t1: left temporal (C3, C5, T7, FC3, FC5, FT7)
    • :t2: right temporal (C4, C6, T8, FC4, FC6, FT8)
    • :c1: anterior central (Cz, C1, C2, FC1, FC2, FCz)
    • :c2: posterior central (Pz, P1, P2, CP1, CP2, CPz)
    • :p1: left parietal (P3, P5, P7, CP3, CP5, TP7)
    • :p2: right parietal (P4, P6, P8, CP4, CP6, TP8)
    • :o: occipital (Oz, O1, O2, POz, PO3, PO4)

Returns

  • ch::Vector{String}: list of channel numbers belonging to a given cluster of channels
NeuroAnalyzer.channel_infoFunction
channel_info(obj; <keyword arguments>)

Show channel info.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64

Returns

Nothing

NeuroAnalyzer.channel_orderFunction
channel_order(obj)

Return channel order of the object.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • co::Vector{Int64}
NeuroAnalyzer.channel_pickFunction
channel_pick(obj; <keyword arguments>)

Return set of channel indices corresponding to a set of electrodes ("pick", e.g. left or frontal electrodes).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • p::Vector{Symbol}: pick of electrodes; picks may be combined, e.g. [:left, :frontal]
    • :list
    • :central (or :c)
    • :left (or :l)
    • :right (or :r)
    • :frontal (or :f)
    • :temporal (or :t)
    • :parietal (or :p)
    • :occipital (or :o)

Returns

  • chs::Vector{Int64}: channel numbers
NeuroAnalyzer.chtypesFunction
chtypes(obj)

Return channel types.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • cht::Vector{String}
NeuroAnalyzer.cmaxFunction
cmax(x)

Return maximum value of the complex vector.

Arguments

  • x::Vector{ComplexF64}

Returns

  • cmax::ComplexF64
NeuroAnalyzer.cminFunction
cmin(x)

Return minimum value of the complex vector.

Arguments

  • x::Vector{ComplexF64}

Returns

  • cmin::ComplexF64
NeuroAnalyzer.component_typeFunction
component_type(obj, c)

Return component data type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name

Return

  • c_type::DataType
NeuroAnalyzer.cumsFunction
cums(signal)

Calculate cumulative sum of a 3-dimensional array.

Arguments

  • signal::Array{<:Real, 3}

Returns

  • signal_cs::Array{Float64, 3}
NeuroAnalyzer.cwtfrqFunction
cwtfrq(s; <keyword arguments>)

Return mean frequencies of a collection of analytic or real wavelets for a given signal.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • f::Vector{Float64}: frequencies
cwtfrq(s; <keyword arguments>)

Return mean frequencies of a collection of analytic or real wavelets for a given signal.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • f::Vector{Float64}: frequencies
cwtfrq(obj; <keyword arguments>)

Return mean frequencies of a collection of analytic or real wavelets for a given signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • f::Vector{Float64}: frequencies
NeuroAnalyzer.datatypeFunction
datatype(obj)

Return data type of the object.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • dt::String
NeuroAnalyzer.delete_componentFunction
delete_component(obj; <keyword arguments>)

Delete component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_component!Function
delete_component!(obj; <keyword arguments>)

Delete component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name

Returns

Nothing

NeuroAnalyzer.delete_noteFunction
delete_note(obj)

Delete recording note from the object header.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_note!Function
delete_note!(obj)

Delete recording note from the object header.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Nothing

NeuroAnalyzer.delmeanFunction
delmean(s)

Demean signal.

Arguments

  • s::AbstractArray

Returns

  • s_new::AbstractArray
NeuroAnalyzer.describeFunction
describe(obj; <keyword arguments>)

Return basic descriptive statistics of the object data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • df::Bool=false: if true, return statistics as a DataFrame

Returns

  • Union{Nothing, DataFrame}
NeuroAnalyzer.detector_labelsFunction
detector_labels(obj)

Return NIRS detector labels.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • l::Vector{String}
NeuroAnalyzer.epoch_lenFunction
epoch_len(obj)

Return epoch length.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • len::Int64
epoch_len(study)

Return length of epochs per NeuroAnalyzer NEURO object in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • len::Int64
NeuroAnalyzer.extract_componentFunction
extract_component(obj, c)

Extract component values.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name

Returns

  • c::Any
NeuroAnalyzer.f2tFunction
f2t(f)

Convert frequency in Hz to cycle length in ms.

Arguments

  • f::Real: frequency in Hz

Returns

  • f::Float64: cycle length in ms
NeuroAnalyzer.fft0Function
fft0(x, n)

Perform zeros-padded FFT.

Arguments

  • x::AbstractVector
  • n::Int64: number of zeros to add

Returns

  • fft0::Vector{ComplexF64}
NeuroAnalyzer.fft2Function
fft2(x)

Perform zeros-padded FFT, so the length of padded vector is a power of 2.

Arguments

  • x::AbstractVector

Returns

  • fft2::Vector{ComplexF64}
NeuroAnalyzer.fft_transformFunction
fft_transform(x; <keyword arguments>)

Perform FFT transformation.

Arguments

  • x::AbstractVector
  • fs::Int64: sampling rate
  • wlen::Int64=fs: window length
  • woverlap::Int64=round(Int64, wlen * 0.97):
  • w::Bool=false: if true, apply Hanning window per segment
  • demean::Bool=false: if true, demean each segment
  • nfft::Int64=0: length of input vector to the FFT; if nfft > n_samples, then the input signal will be zero-padded until it is of length nfft
  • mode::Symbol=:r:
    • :r: use one-sided FFT (rfft)
    • :f: use two-sided FFT (fft)

Returns

  • mf::Vector{ComplexF64}: Fourier coefficients
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.findpeaksFunction
findpeaks(signal; <keyword arguments>)

Find peaks.

Arguments

  • signal::AbstractVector
  • d::Int64=32: distance between peeks in samples

Returns

  • p_idx::Vector{Int64}
NeuroAnalyzer.f_nearestFunction
f_nearest(m, pos)

Find nearest position tuple in a matrix of positions.

Arguments

  • m::Matrix{Tuple{Float64, Float64}}: matrix of positions
  • p::Tuple{Float64, Float64}: position tuple

Returns

  • pos::Tuple{Int64, Int64}: row and column in m
NeuroAnalyzer.freqsFunction
freqs(t)

Return vector of frequencies and Nyquist frequency for time vector.

Arguments

  • t::AbstractVector, AbstractRange}: time vector

Returns

  • hz::Vector{Float64}
  • nf::Float64
freqs(s, fs)

Return vector of frequencies and Nyquist frequency for signal.

Arguments

  • s::AbstractVector
  • fs::Int64

Returns

  • hz::Vector{Float64: signal vector
  • nf::Float64
freqs(obj)

Return vector of frequencies and Nyquist frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • hz::Vector{Float64}
  • nf::Float64
NeuroAnalyzer.generate_csineFunction
generate_csine(f, t, a)

Generates complex sine wave.

Arguments

  • f::Real: frequency [Hz]
  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude, sine amplitude will be in [-amp, +amp]

Returns

  • cs::Vector{ComplexF64}`
NeuroAnalyzer.generate_gaussianFunction
generate_gaussian(fs, f, t; <keyword arguments>)

Generate Gaussian wave.

Arguments

  • fs::Int64: sampling rate
  • f::Real: frequency
  • t::Real=1: length = -t:1/fs:t
  • ncyc::Int64: : number of cycles, width, SD of the Gaussian
  • a::Real=1: peak amp

Returns

  • g::Vector{Float64}
NeuroAnalyzer.generate_morletFunction
generate_morlet(fs, f, t; <keyword arguments>)

Generate Morlet wavelet.

Arguments

  • fs::Int64: sampling rate
  • f::Real: frequency
  • t::Real=1: wavelet length is -t:1/fs:t
  • ncyc::Int64=5: number of cycles
  • complex::Bool=false: generate complex Morlet

Returns

  • morlet::Union{Vector{Float64}, Vector{ComplexF64}}
NeuroAnalyzer.generate_morlet_fwhmFunction
generate_morlet_fwhm(fs, f, t; <keyword arguments>)

Generate Morlet wavelet using FWHM (full width at half maximum) formula.

Arguments

  • fs::Int64: sampling rate
  • f::Real: frequency
  • t::Real=1: length = -t:1/fs:t
  • h::Float64=0.25: full width at half-maximum in seconds (FWHM)

Returns

  • mw::Vector{ComplexF64}

Source

Cohen MX. A better way to define and describe Morlet wavelets for time-frequency analysis. NeuroImage. 2019 Oct;199:81–6.

NeuroAnalyzer.generate_noiseFunction
generate_noise(n, a; <keyword arguments>)

Generate noise.

Arguments

  • n::Int64: length (in samples)
  • a::Real=1.0: amplitude, signal amplitude will be in [-amp, +amp]
  • type::Symbol=:whiten: noise type:
    • :whiten: normally distributed
    • :whiteu: uniformly distributed
    • :pink

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_signalFunction
generate_signal(n, amp)

Generate signal based on normally distributed random noise.

Arguments

  • n::Int64: length (in samples)
  • a::Real=1.0: amplitude, signal amplitude will be in [-amp, +amp]

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_sincFunction
generate_sinc(t, f, peak, norm)

Generate sinc function.

Arguments

  • t::AbstractRange=-2:0.01:2: time
  • `f::Real=1.0: frequency
  • peak::Real=0: sinc peak time
  • norm::Bool=true: generate normalized function

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_sineFunction
generate_sine(f, t, a, p)

Generates sine wave.

Arguments

  • f::Real: frequency [Hz]
  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude, sine amplitude will be in [-amp, +amp]
  • p::Real: initial phase [degrees]

Returns

  • s::Vector{Float64}`
NeuroAnalyzer.generate_squareFunction
generate_square(t, a, p, w, offset)

Generates square wave.

Arguments

  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude
  • p::Real: duty cycle
  • w::Real: width
  • offset::Real: amplitude offset

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_triangleFunction
generate_triangle(t, a)

Generates triangle wave.

Arguments

  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_windowFunction
generate_window(type, n; <keyword arguments>)

Return the n-point long symmetric window type.

Arguments

  • type::Symbol: window type:
    • :hann: Hann
    • :bh: Blackman-Harris
    • :bohman: Bohman
    • :flat: Flat-top window
    • :bn: Blackman-Nuttall
    • :nutall: Nuttall
    • :triangle: symmetric triangle (left half ↑, right half ↓)
    • :exp: symmetric exponential (left half ↑, right half ↓)
  • n::Int64: window length
  • even::Bool=false: if true, make the window of even length (increase length by 1 for odd value of n)

Returns

  • w::Vector{Float64}:: generated window
NeuroAnalyzer.gradientFunction
gradient(x; <keyword arguments>)

Calculate gradient of a 1-dimensional scalar field.

Arguments

  • x::AbstractVector
  • rev::Bool=false: by default the direction of the gradient vector field is towards maximum value, if rev=true, the direction is towards the minimum value

Returns

Named tuple containing:

  • g::Vector{Vector{Float64}}: vector field of gradients
  • g_len::Vector{Float64}: scalar field of gradient lengths
gradient(x; <keyword arguments>)

Calculate gradient of a 2-dimensional scalar field.

Arguments

  • x::AbstractMatrix
  • rev::Bool=false: by default the direction of the gradient vector field is towards maximum value, if rev=true, the direction is towards the minimum value

Returns

Named tuple containing:

  • g::Matrix{Vector{Float64}}: vector field of gradients
  • g_len::Matrix{Float64}: scalar field of gradient lengths
gradient(x; <keyword arguments>)

Calculate gradient of a ≥3-dimensional scalar field.

Arguments

  • x::AbstractArray
  • rev::Bool=false: by default the direction of the gradient vector field is towards maximum value, if rev=true, the direction is towards the minimum value

Returns

Named tuple containing:

  • g::Array{Vector{Float64}, 3}: vector field of gradients
  • g_len::Array{Float64, 3}: scalar field of gradient lengths
NeuroAnalyzer.historyFunction
history(obj)

Show processing history.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • h::Vector{String}
NeuroAnalyzer.hz2radsFunction
hz2rads(f)

Convert frequency in Hz to rad/s.

Arguments

  • f::Real

Returns

  • f_rads::Float64
NeuroAnalyzer.ifft0Function
ifft0(x, n)

Perform IFFT of zero-padded vector.

Arguments

  • x::AbstractVector
  • n::Int64: number of zeros added to x

Returns

  • ifft0::Vector{ComplexF64}: reconstructed signal trimmed to original length
NeuroAnalyzer.infoFunction
info(obj; <keyword arguments>)

Show info.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • df::Bool=false: if true, return object data as a DataFrame containing time points and channels

Returns

  • Union{Nothing, DataFrame}
NeuroAnalyzer.l1Function
l1(a1, a2)

Compare two arrays (e.g. two spectrograms), using L1 (Manhattan) distance.

Arguments

  • a1::AbstractArray: first array
  • a2::AbstractArray: second array

Returns

  • l1::Float64
NeuroAnalyzer.l2Function
l2(a1, a2)

Compare two arrays (e.g. two spectrograms), using L2 (Euclidean) distance.

Arguments

  • a1::AbstractArray: first array
  • a2::AbstractArray: second array

Returns

  • l2::Float64
NeuroAnalyzer.labelsFunction
labels(obj)

Return channel labels.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • l::Vector{String}
NeuroAnalyzer.linspaceFunction
linspace(start, stop, length)

Generates a sequence of evenly spaced numbers between start and stop.

Arguments

  • start::Number
  • stop::Number
  • n::Int64: sequence length

Returns

  • range::Vector{Float64}
NeuroAnalyzer.list_componentFunction
list_component(obj)

List component names.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • components::Vector{Symbol}
NeuroAnalyzer.logspaceFunction
logspace(start, stop, n)

Generates a sequence of log10-spaced numbers between start and stop.

Arguments

  • start::Number
  • stop::Number
  • n::Int64: sequence length

Returns

  • range::Vector{Float64}
NeuroAnalyzer.make_tableFunction
make_table(; <keyword arguments>)

Display data as a table.

Arguments

  • header::Matrix{String}: table header, e.g. header = ["Group" "A" "B"]
  • data::Matrix{Any}: table data, e.g. data = ["var1" 1.0 2.0; "var2" 3.0 4.0]

Returns

Nothing

NeuroAnalyzer.maxatFunction
maxat(x, y)

Find maximum value of one vector and return value at its index from another vector.

Argument

  • x::AbstractVector
  • y::AbstractVector

Returns

  • value::Real
  • idx::Int64
NeuroAnalyzer.minatFunction
minat(x, y)

Find minimum value of one vector and return value at its index from another vector.

Argument

  • x::AbstractVector
  • y::AbstractVector

Returns

  • value::Real
  • idx::Int64
NeuroAnalyzer.m_normFunction
m_norm(m)

Normalize matrix.

Arguments

  • m::AbstractArray

Returns

  • m_norm::AbstractArray
NeuroAnalyzer.m_pad0Function
m_pad0(m)

Pad matrix with zeros to make it square.

Arguments

  • m::AbstractMatrix

Returns

  • m::AbstractMatrix
NeuroAnalyzer.m_sortFunction
m_sort(m, m_idx; <keyword arguments>)

Sorts matrix using sorting index.

Arguments

  • m::AbstractMatrix
  • m_idx::Vector{Int64}: sorting index
  • rev::Bool=false: reverse sort
  • dims::Int64=1: sort by columns (dims=1) or by rows (dims=2)

Returns

  • m_sorted::AbstractMatrix
NeuroAnalyzer.m_sortpermFunction
m_sortperm(m; <keyword arguments>)

Generates matrix sorting index.

Arguments

  • m::AbstractMatrix
  • rev::Bool: reverse sort
  • dims::Int64=1: sort by columns (dims=1) or by rows (dims=2)

Returns

  • idx::Matrix{Int64}
NeuroAnalyzer.na_infoFunction
na_info()

Show NeuroAnalyzer and imported packages versions.

Arguments

Nothing

Returns

Nothing

NeuroAnalyzer.na_plugins_installFunction
na_plugins_install(plugin)

Install NeuroAnalyzer plugin from remote Git repository or from local .TAR.GZ/.ZIP archive (requires unzip or tar command to be available).

Arguments

  • plugin::String: plugin Git repository URL or file name (with full path)

Returns

Nothing

NeuroAnalyzer.na_plugins_updateFunction
na_plugins_update(plugin)

Update NeuroAnalyzer plugin(s).

Arguments

  • plugin::String: plugin to update; if empty, update all

Returns

Nothing

NeuroAnalyzer.na_set_prefsFunction
na_set_prefs(use_cuda, progress_bar, verbose)

Save NeuroAnalyzer preferences.

Arguments

  • use_cuda::Bool
  • progress_bar::Bool
  • verbose::Bool

Returns

Nothing

NeuroAnalyzer.na_versionFunction
na_version()

Convert NeuroAnalyzer version to string.

Arguments

Nothing

Returns

  • VER::String
NeuroAnalyzer.nchannelsFunction
nchannels(obj; <keyword arguments>)

Return number type channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::String="all": channel type (stored in the global channel_types constant variable)

Returns

  • ch_n::Int64
nchannels(study)

Return number of channels per NeuroAnalyzer NEURO object in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
NeuroAnalyzer.nepochsFunction
nepochs(obj)

Return number of epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • ep_n::Int64
nepochs(study)

Return number of epochs per NeuroAnalyzer NEURO object in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
NeuroAnalyzer.nextpow2Function
nextpow2(x)

Return the next power of 2 for a given number.

Argument

  • x::Int64

Returns

  • nextpow2::Int64
NeuroAnalyzer.optode_labelsFunction
optode_labels(obj)

Return optode labels.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • l::Vector{String}
NeuroAnalyzer.pad0Function
pad0(x, n)

Pad row(s) with zeros. Works with 1-, 2- and 3-dimensional arrays.

Arguments

  • x::Union{AbstractVector, AbstractArray}
  • n::Int64: padding length (number of zeros to add)

Returns

  • pad0::Union{AbstractVector, AbstractArray}
NeuroAnalyzer.pad2Function
pad2(x)

Pad row(s) with zeros to the nearest power of 2 length. Works with 1-, 2- and 3-dimensional arrays.

Arguments

  • x::Union{AbstractVector, AbstractArray}

Returns

  • pad2::Union{AbstractVector, AbstractArray}
NeuroAnalyzer.padmFunction
padm(x, n)

Pad row(s) with mean value(s). Works with 1-, 2- and 3-dimensional arrays.

Arguments

  • x::Union{AbstractVector, AbstractArray}
  • n::Int64: padding length (number of values to add)
  • mode::Symbol=:row: how the mean is calculated:
    • :all: mean of all rows
    • :row: separate mean per each row

Returns

  • padm::Union{AbstractVector, AbstractArray}
NeuroAnalyzer.paired_labelsFunction
paired_labels(l; <keyword arguments>)

Return paired labels.

Arguments

  • l::Vector{String}
  • unq::Bool=true: if true, do not add pairs of the same labels, e.g. "label1-label1"

Returns

  • l_paired::Vector{String}: paired labels
paired_labels(l1, l2)

Return paired labels.

Arguments

  • l1::Vector{String}
  • l2::Vector{String}

Returns

  • l_paired::Vector{String}: paired labels
NeuroAnalyzer.perm_cmpFunction
perm_cmp(a1, a2; <keyword arguments>)

Compare two 3-dimensional arrays (e.g. two spectrograms), using permutation based statistic.

Arguments

  • a1::Array{<:Real, 3}: first array
  • a2::Array{<:Real, 3}: second array
  • p::Float64=0.05: p-value
  • perm_n::Int64=1000: number of permutations

Returns

Named tuple containing:

  • zmap::Matrix{Float64}: array of Z-values
  • bm::BitMatrix: binarized mask of statistically significant positions
NeuroAnalyzer.phasesFunction
phases(s)

Calculate phases.

Arguments

  • s::AbstractVector

Returns

  • phases::Vector{Float64}
NeuroAnalyzer.playFunction
play(obj; <keyword arguments>)

Play channel signal as audio.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • seg::Tuple{Real, Real}: time segment to play
  • ep::Int64: epoch number

Returns

Nothing

NeuroAnalyzer.rads2hzFunction
rads2hz(f)

Convert frequency in rad/s to Hz.

Arguments

  • f::Real

Returns

  • f_rads::Float64
NeuroAnalyzer.rename_componentFunction
rename_component(obj, c_old, c_new)

Rename component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c_old::Symbol: old component name
  • c_new::Symbol: new component name

Return

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.rename_component!Function
rename_component!(obj, c_old, c_new)

Rename component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c_old::Symbol: old component name
  • c_new::Symbol: new component name

Returns

Nothing

NeuroAnalyzer.reset_componentsFunction
reset_components(obj)

Remove all components.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.rfft0Function
rfft0(x, n)

Perform zeros-padded single-sided FFT.

Arguments

  • x::AbstractVector
  • n::Int64: number of zeros to add

Returns

  • rfft0::Vector{ComplexF64}
NeuroAnalyzer.rfft2Function
rfft2(x)

Perform zeros-padded single-sided FFT, so the length of padded vector is a power of 2.

Arguments

  • x::AbstractVector

Returns

  • rfft2::Vector{ComplexF64}
NeuroAnalyzer.s2tFunction
s2t(s, fs)

Convert sample number to time in seconds.

Arguments

  • t::Int64: sample number
  • fs::Int64: sampling rate

Returns

  • s2t::Float64: time in s
s2t(obj; <keyword arguments>)

Convert time in samples to seconds.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • s::Int64: time in samples

Returns

  • s2t::Float64: time in seconds
NeuroAnalyzer.signal_lenFunction
signal_len(obj)

Return signal length.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • sl::Int64
NeuroAnalyzer.source_labelsFunction
source_labels(obj)

Return NIRS source labels.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • l::Vector{String}
NeuroAnalyzer.srFunction
sr(obj)

Return sampling rate.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • fs::Int64
sr(study)

Return sampling rate of NeuroAnalyzer NEURO objects in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • sr::Int64
NeuroAnalyzer.t2fFunction
t2f(t)

Convert cycle length in ms to frequency.

Arguments

  • t::Real: cycle length in ms

Returns

  • f::Float64: frequency in Hz
NeuroAnalyzer.t2sFunction
t2s(t, fs)

Convert time in seconds to sample number.

Arguments

  • t::T: time in s
  • fs::Int64: sampling rate

Returns

  • t2s::Int64: sample number
t2s(obj; <keyword arguments>)

Convert time in seconds to sample number.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::T: time in seconds

Returns

  • t2s::Int64: time in samples
NeuroAnalyzer.tavgFunction
tavg(s)

Average signal across trials.

Arguments

  • s::AbstractArray

Returns

  • s_new::AbstractArray
NeuroAnalyzer.to_dfFunction
to_df(obj)

Export object data as DataFrame.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • df::DataFrame: DataFrame containing time points and channels
NeuroAnalyzer.tuple_orderFunction
tuple_order(t, rev)

Order tuple elements in ascending or descending (rev=true) order.

Arguments

  • t::Tuple{Real, Real}
  • rev::Bool=false

Returns

  • t::Tuple{Real, Real}
NeuroAnalyzer.vec2matFunction
vec2mat(x; <keyword arguments>)

Reshape vector into matrix using fixed segment length and overlapping.

Arguments

  • x::AbstractVector
  • wlen::Int64: window length (in samples)
  • woverlap::Int64: overlap with the previous window (in samples)

Returns

  • m::AbstractMatrix
NeuroAnalyzer.view_headerFunction
header(obj)

Show keys and values of the object header.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Nothing

NeuroAnalyzer.view_noteFunction
view_note(obj)

Return the object recording note.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • note::String
NeuroAnalyzer.vreduceFunction
vreduce(x, f; <keyword arguments>)

Reduce two vectors at indices of the second vector being multiplications of a constant. Useful e.g. for simplifying values across frequencies, when the number of frequencies (and thus values) is high.

Arguments

  • x::AbstractVector: e.g. signal data
  • f::AbstractVector: e.g. frequencies
  • n::Float64=0.5: reduce at multiplications of this value

Returns

  • x_new::AbstractVector
  • f_new::AbstractVector
NeuroAnalyzer.vsearchFunction
vsearch(y, x; <keyword arguments>)

Return the positions of the value in the vector.

Arguments

  • y::T: value of interest
  • x::AbstractVector: vector to search within
  • acc::Bool=false: if true, return the difference between y and x[idx]

Returns

  • idx::Int64
  • d::Real: the difference between y and x[idx]
vsearch(y, x; <keyword arguments>)

Return the positions of the value in the vector.

Arguments

  • y::AbstractVector: vector of interest
  • x::AbstractVector: vector to search within
  • acc::Bool=false: if true, return the difference between y and x[idx:idx + length(y)]

Returns

  • idx::Int64
  • d::Real: the difference between y and x[idx:idx + length(y)]
NeuroAnalyzer.vsplitFunction
vsplit(x, n)

Splits vector into pieces.

Argument

  • x::AbstractVector
  • n::Int64: length of one piece

Returns

  • x::Vector{AbstractVector}

IO

NeuroAnalyzer.export_csvFunction
export_csv(obj; <keyword arguments>)

Export NeuroAnalyzer.NEURO object to CSV.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • header::Bool=false: export header
  • epoch_time::Bool=false: export epoch time points
  • components::Bool=false: export components
  • markers::Bool=false: export event markers
  • locs::Bool=false: export channel locations
  • history::Bool=false: export history
  • overwrite::Bool=false

Returns

Nothing

NeuroAnalyzer.export_locsFunction
export_locs(obj; <keyword arguments>)

Export channel locations data, format is based on file_name extension (.csv, .ced, .locs or .tsv)

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • overwrite::Bool=false

Returns

Nothing

export_locs(locs; <keyword arguments>)

Export channel locations, format is based on file_name extension (.ced, .locs, .tsv)

Arguments

  • locs::DataFrame
  • file_name::String
  • overwrite::Bool=false

Returns

Nothing

NeuroAnalyzer.export_markersFunction
export_markers(obj; <keyword arguments>)

Export NeuroAnalyzer.NEURO object markers to CSV.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • overwrite::Bool=false

Returns

Nothing

NeuroAnalyzer.import_alice4Function
import_alice4(file_name; <keyword arguments>)

Load EDF exported from Alice 4 Polysomnography System and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

  • EDF files exported from Alice 4 have incorrect value of data_records (-1) and multiple sampling rate; channels are upsampled to the highest rate.
NeuroAnalyzer.import_bdfFunction
import_bdf(file_name; <keyword arguments>)

Load BDF/BDF+ file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on channel label

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

  • sampling_rate = n.samples ÷ data.record.duration
  • gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
  • value = (value - digital minimum ) × gain + physical minimum

Source

https://www.biosemi.com/faq/file_format.htm

NeuroAnalyzer.import_bvFunction
import_bv(file_name; <keyword arguments>)

Load BrainVision BVCDF file and return NeuroAnalyzer.NEURO object. At least two files are required: .vhdr (header) and .eeg (signal data). If available, markers are loaded from .vmrk file.

Arguments

  • file_name::String: name of the file to load, should point to .vhdr file.
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_cntFunction
import_cnt(file_name; <keyword arguments>)

Load Neuroscan continuous signal file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label
  • data_format::Symbol=:i32: Neuroscan stores data either in 16-bit (:i16) or 32-bit (:i32) representation, but does not say so in the file format

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

Based on loadcnt.m by Sean Fitzgibbon and Arnaud Delorme (https://cnl.salk.edu/~arno/cntload/index.html)

NeuroAnalyzer.import_csvFunction
import_csv(file_name; <keyword arguments>)

Load CSV file (e.g. exported from EEGLAB) and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

CSV first row or first column must contain channel names. Shape of data array will be detected automatically. Sampling rate will be detected. If file is gzip-ed, it will be uncompressed automatically while reading.

NeuroAnalyzer.import_datFunction
import_dat(file_name)

Load Neuroscan DAT file.

Arguments

  • file_name::String: name of the file to load

Returns

  • dat::DataFrame
NeuroAnalyzer.import_digitrackFunction
import_digitrack(file_name; <keyword arguments>)

Load Digitrack ASCII file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_duomagFunction
import_duomag(file_name)

Load DuoMAG TMS MEP recording file (.ascii or .m) and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_edfFunction
import_edf(file_name; <keyword arguments>)

Load EDF/EDF+ file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

  • sampling_rate = n.samples ÷ data.record.duration
  • gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
  • value = (value - digital minimum ) × gain + physical minimum

Source

  1. Kemp B, Varri A, Rosa AC, Nielsen KD, Gade J. A simple format for exchange of digitized polygraphic recordings. Electroencephalography and Clinical Neurophysiology. 1992; 82(5): 391–3
  2. Kemp B, Olivan J. European data format ‘plus’(EDF+), an EDF alike standard format for the exchange of physiological data. Clinical Neurophysiology 2003; 114: 1755–61
  3. https://www.edfplus.info/specs/
NeuroAnalyzer.import_edf_annotationsFunction
import_edf_annotations(file_name; <keyword arguments>)

Load annotations from EDF+ file and return markers DataFrame. This function is used for EDF+ files containing annotations only.

Arguments

  • file_name::String: name of the file to load

Returns

  • markers::DataFrame
NeuroAnalyzer.import_fiffFunction
import_fiff(file_name)

Load FIFF (Functional Image File Format) file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_gdfFunction
import_gdf(file_name; <keyword arguments>)

Load GDF file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

  • sampling_rate = n.samples ÷ data.record.duration
  • gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
  • value = (value - digital minimum ) × gain + physical minimum

Source

  1. Schlögl A, Filz O, Ramoser H, Pfurtscheller G. GDF - A General Dataformat for Biosignals Version 1.25. 1998
  2. Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.12. 2009
  3. Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.51. 2013
NeuroAnalyzer.import_locsFunction
import_locs(file_name)

Load channel locations. Supported formats:

  • CED
  • ELC
  • LOCS
  • TSV
  • SFP
  • CSD
  • GEO
  • MAT
  • TXT
  • DAT
  • ASC
  • CSV

This is a meta-function that triggers appropriate import_locs_*() function. File format is detected based on file extension.

Arguments

  • file_name::String: name of the file to load

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_ascFunction
import_locs_asc(file_name)

Load channel locations from ASC file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_cedFunction
import_locs_ced(file_name)

Load channel locations from CED file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_csdFunction
import_locs_csd(file_name)

Load channel locations from CSD file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_csvFunction
import_locs_csv(file_name)

Load channel locations from CSV file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_datFunction
import_locs_dat(file_name)

Load channel locations from DAT file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_elcFunction
import_locs_elc(file_name)

Load channel locations from ELC file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_geoFunction
import_locs_geo(file_name)

Load channel locations from GEO file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_locsFunction
import_locs_locs(file_name)

Load channel locations from LOCS file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_matFunction
import_locs_mat(file_name)

Load channel locations from MAT file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_sfpFunction
import_locs_sfp(file_name)

Load channel locations from SFP file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_tsvFunction
import_locs_tsv(file_name)

Load channel locations from TSV file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_txtFunction
import_locs_txt(file_name)

Load channel locations from TXT file.

Arguments

  • file_name::String

Returns

  • locs::DataFrame
NeuroAnalyzer.import_montageFunction
import_montage(file_name)

Load montage from a text file. Example montage files are located in the montages/ folder. The structure of the file is:

  • first line: name of the montage, e.g. longitudinal-BIP
  • next lines: channel pairs or individual channels, e.g. Fz-Cz or Fp1

Each channel/channel pair must be in a separate line

Arguments

  • file_name::String: name of the file to load

Returns

Named tuple containing:

  • ref_list::Vector{String}: list of channel pairs
  • ref_name::String: name of the montage
NeuroAnalyzer.import_ncsFunction
import_ncs(file_name)

Load Neuralinx Continuously Sampled Channels (CSC) and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_nirsFunction
import_nirs(file_name)

Load NIRS file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO

Source

https://github.com/BUNPC/Homer3/wiki/HOMER3-file-formats

NeuroAnalyzer.import_nirxFunction
import_nirx(file_name)

Load NIRX file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load, should point to .hdr file.

Returns

  • obj::NeuroAnalyzer.NEURO

Source

https://nirx.net/file-formats

NeuroAnalyzer.import_npyFunction
import_npy(file_name; <keyword arguments>)

Load NPY file (exported from MNE) and return NeuroAnalyzer.NEURO object. Data type and channel types are set as is EEG.

Arguments

  • file_name::String: name of the file to load
  • sampling_rate::Int64: NPY file contains only signal data, therefore its sampling rate must be provided upon importing

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_nwbFunction
import_nwb(file_name; <keyword arguments>)

Load EEG data from Neurodata Without Borders (NWB) file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Source

  1. https://www.biorxiv.org/content/10.1101/523035v1
NeuroAnalyzer.import_recordingFunction
import_recording(file_name; <keyword arguments>)

Load recording file and return NeuroAnalyzer.NEURO object. Supported formats:

  • EDF/EDF+
  • BDF/BDF+
  • GDF
  • BrainVision
  • CSV
  • SET (EEGLAB dataset)
  • NWB (Neurodata Without Borders)
  • FIFF
  • SNIRF
  • NIRS

This is a meta-function that triggers appropriate import_*() function. File format is detected based on file extension (.edf|.bdf|.gdf|.vhdr|.ahdr|.csv|.csv.gz|.set|.nwb|.fif|.fiff|.snirf|.nirs). Signal data type (e.g. EEG or MEG is auto-detected) and stored in the obj.header.recording[:data_type] field.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on channel label
  • n::Int64=0: subject number to extract in case of multi-subject file

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_setFunction
import_set(file_name; <keyword arguments>)

Load SET file (exported from EEGLAB) and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • detect_type::Bool=true: detect channel type based on its label

Returns

  • obj::NeuroAnalyzer.NEURO

Source

  1. https://eeglab.org/tutorials/ConceptsGuide/Data_Structures.html
NeuroAnalyzer.import_snirfFunction
import_snirf(file_name; <keyword arguments>)

Load Shared Near Infrared Spectroscopy Format (SNIRF) file and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load
  • n::Int64=0: subject number to extract in case of multi-subject file

Returns

  • obj::NeuroAnalyzer.NEURO

Source

https://github.com/fNIRS/snirf/blob/v1.1/snirf_specification.md

NeuroAnalyzer.import_thymatronFunction
import_thymatron(file_name)

Import scanned images of EEG printed by Thymatron ECT equipment and return NeuroAnalyzer.NEURO object.

Usually there are three images: baseline, during seizure activity and after seizure activity. If more then one image is provided, images are added as consecutive channels in the same object.

Image properties:

  • 100 DPI
  • 490 x 100 px
  • height 2.5 cm
  • width 12.5 cm

Arguments

  • file_name::String: name of the file to load
  • dpi::Int64=100: DPI of the scanned images

Returns

  • obj::NeuroAnalyzer.NEURO

Source

Wysokiński A. EEG_ADC: Digitizer and Analyzer of Electroconvulsive Therapy Paper Electroencephalogram Recordings. JECT 2022; 4: 255-256

NeuroAnalyzer.import_xdfFunction
import_xdf(file_name)

Load Extensible Data Format (XDF) and return NeuroAnalyzer.NEURO object.

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.loadFunction
load(file_name)

Load NeuroAnalyzer.NEURO object from file_name file (HDF5-based).

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.load_fiffFunction
load_fiff(file_name)

Load FIFF (Functional Image File Format) file and return FIFF object.

Arguments

  • file_name::String: name of the file to load

Returns

  • fiff::Dict{Symbol, Dict{Any, Any}}
  • fiff_object::Vector{Any}
  • fiff_blocks::Matrix{Int64}

Source

Elekta Neuromag: Functional Image File Format Description. FIFF version 1.3. March 2011

NeuroAnalyzer.load_locsFunction
load_locs(obj; <keyword arguments>)

Load channel locations from file_name and return NeuroAnalyzer.NEURO object with locs data frame.

Accepted formats:

  • CED
  • LOCS
  • ELC
  • TSV
  • SFP
  • CSD
  • GEO
  • MAT
  • TXT
  • DAT
  • ASC
  • CSV

Channel locations:

  • loc_theta: polar angle
  • loc_radius: polar radius
  • loc_x: spherical Cartesian x
  • loc_y: spherical Cartesian y
  • loc_z: spherical Cartesian z
  • loc_radius_sph: spherical radius
  • loc_theta_sph: spherical horizontal angle
  • loc_phi_sph: spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String: name of the file to load

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.load_locs!Function
load_locs!(obj; <keyword arguments>)

Load channel locations from file_name and return NeuroAnalyzer.NEURO object with locs data frame.

Accepted formats:

  • CED
  • LOCS
  • ELC
  • TSV
  • SFP
  • CSD
  • GEO
  • MAT
  • TXT
  • DAT
  • ASC

Channel locations:

  • loc_theta: polar angle
  • loc_radius: polar radius
  • loc_x: spherical Cartesian x
  • loc_y: spherical Cartesian y
  • loc_z: spherical Cartesian z
  • loc_radius_sph: spherical radius
  • loc_theta_sph: spherical horizontal angle
  • loc_phi_sph: spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String

Return

Nothing

NeuroAnalyzer.load_studyFunction
load_study(file_name)

Load NeuroAnalyzer.STUDY object from file_name file (HDF5-based).

Arguments

  • file_name::String: name of the file to load

Returns

  • obj::NeuroAnalyzer.STUDY
NeuroAnalyzer.saveFunction
save(obj; <keyword arguments>)

Save NeuroAnalyzer.NEURO object to file_name file (HDF5-based).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String: name of the file to save to
  • overwrite::Bool=false

Return

Nothing

NeuroAnalyzer.save_studyFunction
save_study(obj; <keyword arguments>)

Save NeuroAnalyzer.STUDY object to file_name file (HDF5-based).

Arguments

  • obj::NeuroAnalyzer.STUDY
  • file_name::String: name of the file to save to
  • overwrite::Bool=false

Return

Nothing

Edit

NeuroAnalyzer.add_channelFunction
add_channel(obj; <keyword arguments>)

Add channels data to an empty NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{<:Number, 3}: channels data
  • label::Union{String, Vector{String}}: channels labels
  • type::Union{String, Vector{String}}: channels types

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_channel!Function
add_channel!(obj; <keyword arguments>)

Add channels data to an empty NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{<:Number, 3}: channels data
  • label::Union{String, Vector{String}}: channels labels
  • type::Union{String, Vector{String}}: channels types

Returns

Nothing

NeuroAnalyzer.add_labelFunction
add_label(obj; <keyword arguments>)

Add channel labels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • clabels::Vector{String}

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_label!Function
add_label!(obj; <keyword arguments>)

Add channel labels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • clabels::Vector{String}

Returns

Nothing

NeuroAnalyzer.add_markerFunction
add_marker(obj; <keyword arguments>)

Add marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • id::String: marker ID
  • start::Real: marker time in seconds
  • len::Real=1.0: marker length in seconds
  • desc::String: marker description
  • ch::Int64=0: channel number, if 0 then marker is related to all channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_marker!Function
add_marker!(obj; id, start, len, desc, ch)

Add marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • id::String: marker ID
  • start::Real: marker time in seconds
  • len::Real=1.0: marker length in seconds
  • desc::String: marker description
  • ch::Int64=0: channel number, if 0 then marker is related to all channels

Returns

Nothing

NeuroAnalyzer.channel2markerFunction
channel2marker(obj; <keyword arguments>)

Convert event channel to markers.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • v::Real=1.0: event channel value interpreted as an event
  • id::String: prefix for marker ID; default is based on event channel name (e.g. "stim1_")
  • desc::String="": marker description; default is based on event channel name (e.g. "stim1")

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.channel2marker!Function
channel2marker!(obj; <keyword arguments>)

Convert event channel to markers.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • v::Real=1.0: event channel value interpreted as an event
  • id::String: prefix for marker ID; default is "mrk_"
  • desc::String="": prefix for marker description; default is based on event channel name (e.g. "stim1_")

Returns

Nothing

NeuroAnalyzer.channel_typeFunction
channel_type(obj; <keyword arguments>)

Get channel type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name

Returns

  • cht::String
NeuroAnalyzer.chopFunction
chop(obj; <keyword arguments>)

Reduce signal by removing reflected signal before the signal and after the signal, i.e. a signal 432112344321 becomes 1234.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64=sr(obj): number of samples to remove, default is 1 second

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.chop!Function
chop!(obj; <keyword arguments>)

Reduce signal by removing reflected signal before the signal and after the signal, i.e. a signal 432112344321 becomes 1234.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64=sr(obj): number of samples to remove, default is 1 second

Returns

Nothing

NeuroAnalyzer.create_dataFunction
create_data(obj; <keyword arguments>)

Create data, channel labels, types and units and time points for NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{Float64, 3}
  • fs::Int64
  • type::String: channel types of imported data channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.create_data!Function
create_data!(obj; <keyword arguments>)

Create data, channel labels, types and units and time points for NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{Float64, 3}
  • fs::Int64
  • type::String: channel types of imported data channels

Returns

Nothing

NeuroAnalyzer.create_objectFunction
create_object(; <keyword arguments>)

Create an empty NeuroAnalyzer.NEURO object.

Arguments

  • data_type::String: data type of the new object ("eeg", "ecog", "seeg", "meg", "nirs", "mep", "eda", "sensors")

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.create_timeFunction
create_time(obj; <keyword arguments>)

Create time points vector for NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • fs::Int64

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.create_time!Function
create_time!(obj; <keyword arguments>)

Create time points vector for NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • fs::Int64

Returns

Nothing

NeuroAnalyzer.delete_channelFunction
delete_channel(obj; <keyword arguments>)

Delete channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channels to be removed
  • del_opt::Bool=false: for NIRS data is set as true if called from remove_optode()

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_channel!Function
delete_channel!(obj; <keyword arguments>)

Delete channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channels to be removed
  • del_opt::Bool=false: for NIRS data is set as true if called from remove_optode()

Returns

Nothing

NeuroAnalyzer.delete_epochFunction
delete_epoch(obj; <keyword arguments>)

Remove epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch numbers to be removed

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_epoch!Function
delete_epoch!(obj; <keyword arguments>)

Remove epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch numbers to be removed

Returns

Nothing

NeuroAnalyzer.delete_markerFunction
delete_marker(obj; <keyword arguments>)

Delete marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64: marker number

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_marker!Function
delete_marker!(obj; n)

Delete marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64: marker number

Returns

Nothing

NeuroAnalyzer.delete_optodeFunction
delete_optode(obj; <keyword arguments>)

Delete optodes) and channels associated with removed optodes.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • opt::Union{Int64, Vector{Int64}, <:AbstractRange}: optode number(s) to be removed

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_optode!Function
delete_optode!(obj; <keyword arguments>)

Delete optopode(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • opt::Union{Int64, Vector{Int64}, <:AbstractRange}: optopode number(s) to be removed

Returns

Nothing

NeuroAnalyzer.detect_badFunction
detect_bad(obj; <keyword arguments>)

Detect bad channels and epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • method::Union{Symbol, Vector{Symbol}}=[:flat, :rmse, :rmsd, :euclid, :var, :p2p, :tkeo, :kurt, :z, :ransac, :amp]: detection method:
    • :flat: flat channel(s)
    • :rmse: RMSE vs average channel outside of 95% CI
    • :rmsd: RMSD
    • :euclid: Euclidean distance
    • :var: mean signal variance outside of 95% CI and variance inter-quartile outliers
    • :p2p: mark bad channels based on peak-to-peak amplitude; good for detecting transient artifacts
    • :tkeo: mark bad channels based on z-score TKEO value outside of 95% CI
    • :kurt: mark bad channels based on z-scores of kurtosis values
    • :z: mark bad channels based on their z-score of amplitude
    • :ransac: calculate each channel correlation to its nearest neighbor with outliers removed using random sample consensus (RANSAC) in successive 1-s segments; channel signals exhibiting low correlation to signals in neighboring scalp channels in individual windows (here, r < ransac_r at more than ransac_tr of the data points) are marked as bad
    • :amp: mark bad channels based on their amplitude
  • w::Int64=10: window width in samples (signal is averaged within w-width window)
  • flat_tol::Float64=0.1: tolerance (signal is flat within -tol to +tol), eps() gives very low tolerance
  • flat_fr::Float64=0.3: acceptable ratio (0.0 to 1.0) of flat segments within a channel before marking it as flat
  • p::Float64=0.99: probability threshold (0.0 to 1.0) for marking a channel as bad; also threshold for :p2p detection: above mean + p * std and below mean - p * std, here p (as percentile) will be converted to z-score (0.9 (90th percentile): 1.282, 0.95 (95th percentile): 1.645, 0.975 (97.5th percentile): 1.960, 0.99 (99th percentile): 2.326); also threshold for :z method: percentage of channel length per epoch for marking a channel as bad
  • tc::Float64=0.3: threshold (0.0 to 1.0) of bad channels ratio to mark the epoch as bad
  • tkeo_method::Symbol=:pow: method of calculating TKEO, see tkeo() for details
  • z::Real=3: threshold number of z-scores
  • ransac_r::Float64=0.8: threshold (0.0 to 1.0) correlation between channels
  • ransac_tr::Float64=0.4: threshold (0.0 to 1.0) ratio of uncorrelated channels
  • ransac_t::Float64=100.0: threshold distance of a sample point to the regression hyperplane to determine if it fits the model well
  • amp_t::Float64=400.0: two-sided rejection amplitude threshold (± 400 μV)

Returns

Named tuple containing:

  • bm::Matrix{Bool}: matrix of bad channels × epochs
  • be::Vector{Int64}: list of bad epochs
NeuroAnalyzer.detect_bad!Function
detect_bad!(obj; <keyword arguments>)

Detect bad channels and epochs and update the :bad_channel field in the OBJ header.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • method::Union{Symbol, Vector{Symbol}}=[:flat, :rmse, :rmsd, :euclid, :var, :p2p, :tkeo, :kurt, :z, :ransac, :amp]: detection method:
    • :flat: flat channel(s)
    • :rmse: RMSE vs average channel outside of 95% CI
    • :rmsd: RMSD
    • :euclid: Euclidean distance
    • :var: mean signal variance outside of 95% CI and variance inter-quartile outliers
    • :p2p: mark bad channels based on peak-to-peak amplitude; good for detecting transient artifacts
    • :tkeo: mark bad channels based on z-score TKEO value outside of 95% CI
    • :kurt: mark bad channels based on z-scores of kurtosis values
    • :z: mark bad channels based on their z-score of amplitude
    • :ransac: calculate each channel correlation to its nearest neighbor with outliers removed using random sample consensus (RANSAC) in successive 1-s segments; channel signals exhibiting low correlation to signals in neighboring scalp channels in individual windows (here, r < ransac_r at more than ransac_tr of the data points) are marked as bad
    • :amp: mark bad channels based on their amplitude
  • w::Int64=10: window width in samples (signal is averaged within w-width window)
  • flat_tol::Float64=0.1: tolerance (signal is flat within -tol to +tol), eps() gives very low tolerance
  • flat_fr::Float64=0.3: acceptable ratio (0.0 to 1.0) of flat segments within a channel before marking it as flat
  • p::Float64=0.99: probability threshold (0.0 to 1.0) for marking a channel as bad; also threshold for :p2p detection: above mean + p * std and below mean - p * std, here p (as percentile) will be converted to z-score (0.9 (90th percentile): 1.282, 0.95 (95th percentile): 1.645, 0.975 (97.5th percentile): 1.960, 0.99 (99th percentile): 2.326); also threshold for :z method: percentage of channel length per epoch for marking a channel as bad
  • tc::Float64=0.3: threshold (0.0 to 1.0) of bad channels ratio to mark the epoch as bad
  • tkeo_method::Symbol=:pow: method of calculating TKEO, see tkeo() for details
  • z::Real=3: threshold number of z-scores
  • ransac_r::Float64=0.8: threshold (0.0 to 1.0) correlation between channels
  • ransac_tr::Float64=0.4: threshold (0.0 to 1.0) ratio of uncorrelated channels
  • ransac_t::Float64=100.0: threshold distance of a sample point to the regression hyperplane to determine if it fits the model well
  • amp_t::Float64=400.0: two-sided rejection amplitude threshold (± 400 μV)

Returns

Nothing

NeuroAnalyzer.edit_channelFunction
edit_channel(obj; <keyword arguments>)

Edit channel properties (:channel_type or :label) in OBJ.header.recording.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • field::Symbol
  • value::String

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_channel!Function
edit_channel!(obj; <keyword arguments>)

Edit channel properties (:channel_type or :label) in OBJ.header.recording.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • field::Symbol
  • value::String

Returns

Nothing

NeuroAnalyzer.edit_markerFunction
edit_marker(obj; <keyword arguments>)

Edit marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64: marker number
  • id::String: marker ID
  • start::Real: marker time in seconds
  • len::Real=1.0: marker length in seconds
  • desc::String: marker description
  • ch::Int64=0: channel number, if 0 then marker is related to all channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_marker!Function
edit_marker!(obj; n, id, start, len, desc, ch)

Edit marker.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64: marker number
  • id::String: marker ID
  • start::Real: marker time in seconds
  • len::Real=1: marker length in seconds
  • desc::String: marker description
  • ch::Int64=0: channel number, if 0 then marker is related to all channels

Returns

Nothing

NeuroAnalyzer.epochFunction
epoch(obj; <keyword arguments>)

Split into epochs. Return signal that is split either by markers (if specified), by epoch length or by number of epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • marker::String="": marker description to split at
  • offset::Real=0: time offset (in seconds) for marker-based epoching (each epoch time will start at marker time - offset)
  • ep_n::Union{Int64, Nothing}=nothing: number of epochs
  • ep_len::Union{Real, Nothing}=nothing: epoch length in seconds

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.epoch!Function
epoch!(obj; <keyword arguments>)

Split into epochs. Return signal that is split either by markers (if specified), by epoch length or by number of epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • marker::String="": marker description to split at
  • offset::Real=0: time offset (in seconds) for marker-based epoching (each epoch time will start at marker time - offset)
  • ep_n::Union{Int64, Nothing}=nothing: number of epochs
  • ep_len::Union{Real, Nothing}=nothing: epoch length in seconds

Returns

Nothing

NeuroAnalyzer.epoch_tsFunction
epoch_ts(obj; <keyword arguments>)

Edit epochs time start.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ts::Real: time start in seconds

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.epoch_ts!Function
epoch_ts!(obj; <keyword arguments>)

Edit OBJ epochs time start.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ts::Real: time start in seconds

Returns

Nothing

NeuroAnalyzer.extract_channelFunction
extract_channel(obj; <keyword arguments>)

Extract channel data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name

Returns

  • d::Array{Float64, 3}
NeuroAnalyzer.extract_dataFunction
extract_data(obj; <keyword arguments>)

Extract data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}=1:nepochs(obj): index of epochs, default is all epochs
  • time::Bool=false: return time vector
  • etime::Bool=false: return epoch time vector

Returns

  • signal::Array{Float64, 3}
  • time::Vector{Float64}
  • etime::Vector{Float64}
NeuroAnalyzer.extract_epochFunction
extract_epoch(obj; <keyword arguments>)

Extract epoch.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Int64: epoch index

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.extract_epoch!Function
extract_epoch!(obj; <keyword arguments>)

Extract epoch.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Int64: epoch index

Returns

Nothing

NeuroAnalyzer.extract_timeFunction
extract_time(obj)

Extract time.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • tpts::Vector{Float64}
NeuroAnalyzer.get_channelFunction
get_channel(obj; <keyword arguments>)

Return list of channel names of specified type or their numbers if names are specified.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}="": channel name or list of channel names
  • type::Union{String, Vector{String}}="all": channels types
  • wl::Real: return NIRS channels for wavelength (in nm)
  • exclude::Union{String, Vector{String}}="bad": channel name or list of channel names to exclude from the list

Returns

  • ch::Union{Vector{String}, Vector{Int64}}
NeuroAnalyzer.joinFunction
join(obj1, obj2)

Join two NeuroAnalyzer objects. Each obj2 epoch are horizontally concatenated (along time) with respective obj1 epoch. Both objects must have the same data type, number of channels, epochs and sampling rate, but may differ in epoch lengths.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.join!Function
join!(obj1, obj2)

Join two NeuroAnalyzer objects into the first object. Each obj2 epoch are horizontally concatenated (along time) with respective obj1 epoch. Both objects must have the same data type, number of channels, epochs and sampling rate, but may differ in epoch lengths.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO

Returns

Nothing

NeuroAnalyzer.keep_channelFunction
keep_channel(obj; <keyword arguments>)

Keep channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channels to keep

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_channel!Function
keep_channel!(obj; <keyword arguments>)

Keep channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channels to keep

Returns

Nothing

NeuroAnalyzer.keep_epochFunction
keep_epoch(obj; <keyword arguments>)

Keep epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch numbers to keep

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_epoch!Function
keep_epoch!(obj; <keyword arguments>)

Keep epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch numbers to keep

Returns

Nothing

NeuroAnalyzer.reflectFunction
reflect(obj; <keyword arguments>)

Expand signal by adding reflected signal before the signal and after the signal, i.e. a signal 1234 becomes 432112344321. This may reduce edge artifacts, but will also affect amplitude of the filtered signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64=sr(obj): number of samples to add, default is 1 second

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reflect!Function
reflect!(obj; <keyword arguments>)

Expand signal by adding reflected signal before the signal and after the signal, i.e. a signal 1234 becomes 432112344321. This may reduce edge artifacts, but will also affect amplitude of the filtered signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64=sr(obj): number of samples to add, default is 1 second

Returns

Nothing

NeuroAnalyzer.rename_channelFunction
rename_channel(obj; <keyword arguments>)

Rename channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • name::String: new name

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.rename_channel!Function
rename_channel!(obj; <keyword arguments>)

Rename channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • name::String: new name

Returns

Nothing

NeuroAnalyzer.replace_channelFunction
replace_channel(obj; <keyword arguments>)

Replace channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • s::AbstractArray

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.replace_channel!Function
replace_channel!(obj; <keyword arguments>)

Replace channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • s::Array{Float64, 3}: signal to replace with

Returns

Nothing

NeuroAnalyzer.set_channel_typeFunction
set_channel_type(obj; <keyword arguments>)

Set channel type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • type::String: new type

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.set_channel_type!Function
set_channel_type!(obj; <keyword arguments>)

Set channel type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • type::String

Returns

Nothing

NeuroAnalyzer.subepochFunction
subepoch(obj; <keyword arguments>)

Extract sub-epochs with a reduced time range.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep_start::Real: sub-epoch start
  • ep_end::Real: sub-epoch end

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.subepoch!Function
subepoch!(obj; <keyword arguments>)

Extract sub-epochs with a reduced time range.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep_start::Real: sub-epoch start
  • ep_end::Real: sub-epoch end

Returns

Nothing

NeuroAnalyzer.trimFunction
trim(s; <keyword arguments>)

Remove segment from the signal.

Arguments

  • v::AbstractVector
  • seg::Tuple{Int64, Int64}: segment (from, to) in samples
  • inverse::Bool=false: if true, keep the segment

Returns

  • trim::Vector{Float64}
trim(m; <keyword arguments>)

Remove segment from the signal.

Arguments

  • m::AbstractMatrix
  • seg::Tuple{Int64, Int64}: segment (from, to) in samples
  • inverse::Bool=false: if true, keep the segment

Returns

  • trim::Matrix{Float64}
trim(a; <keyword arguments>)

Remove segment from the signal.

Arguments

  • a::AbstractArray
  • seg::Tuple{Int64, Int64}: segment (from, to) in samples
  • inverse::Bool=false: if true, keep the segment

Returns

  • trim::Array{Float64, 3}
trim(obj; <keyword arguments>)

Trim signal by removing parts of the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • seg::Tuple{Real, Real}: segment to be removed (from, to) in seconds
  • inverse::Bool=false: if true, keep the segment
  • remove_epochs::Bool=true: if true, remove epochs containing signal to trim or remove signal and re-epoch trimmed signal

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.trim!Function
trim!(obj; <keyword arguments>)

Trim signal by removing parts of the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • seg::Tuple{Real, Real}: segment to be removed (from, to) in seconds
  • inverse::Bool=false: if true, keep the segment
  • remove_epochs::Bool=true: if true, remove epochs containing signal to trim or remove signal and re-epoch trimmed signal

Returns

Nothing

NeuroAnalyzer.vchFunction
vch(obj; <keyword arguments>)

Calculate virtual channel using formula f.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • f::String: channel calculation formula, e.g. "cz / mean(fp1 + fp2)"; case of labels in the formula is ignored, all standard Julia math operators are available, channel labels must be the same as of the OBJ object

Returns

  • vc::Array{Float64, 3}: single channel × time × epochs

Process

NeuroAnalyzer.add_signalFunction
add_signal(s1, s2)

Add signal.

Arguments

  • s1::AbstractVector: target signal
  • s2::AbstractVector: signal to be added

Returns

  • s_noisy::AbstractVector
add_signal(obj; <keyword arguments>)

Add signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • s::AbstractVector: signal to be added to each channel

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_signal!Function
add_signal!(obj; <keyword arguments>)

Add signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • s::AbstractVector: signal to be added to each channel

Returns

Nothing

NeuroAnalyzer.averageFunction
average(s)

Average all channels.

Arguments

  • s::AbstractArray

Returns

  • average::AbstractArray
average(s1, s2)

Averages two signals.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • average::AbstractArray
average(obj; <keyword arguments>)

Return the average signal of channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
average(obj1, obj2)

Return the average signal of two objects.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.average!Function
average!(obj; <keyword arguments>)

Return the average signal of channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

NeuroAnalyzer.average_epochsFunction
average_epochs(obj; <keyword arguments>)

Average EEG/MEG epochs. Non-EEG/MEG channels are removed. OBJ.header.recording[:data_type] becomes erp (for EEG) or erf for MEG. First epoch is the ERP/ERF.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • bl::Tuple{Real, Real}=(0, 0): baseline is from b[1] to b[2] seconds; if bl is greater than (0, 0), DC value is calculated as mean of the b[1] to b[2] seconds and subtracted from the signal
  • blfirst::Bool=false: if true, subtract the baseline segment prior to averaging

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.average_epochs!Function
average_epochs!(obj; <keyword arguments>)

Average EEG/MEG epochs. Non-EEG/MEG channels are removed. OBJ.header.recording[:data_type] becomes erp (for EEG) or erf for MEG. First epoch is the ERP/ERF.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • bl::Tuple{Real, Real}=(0, 0): baseline is the first bl seconds; if bl is greater than 0, DC value is calculated as mean of the first n samples and subtracted from the signal
  • blfirst::Bool=false: if true, subtract the baseline segment prior to averaging

Returns

Nothing

NeuroAnalyzer.bpsplitFunction
bpsplit(obj; <keyword arguments>)

Split signal into frequency bands using a FIR band-pass filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • order::Int64=8: number of taps for FIR band-pass filter
  • w::Union{Nothing, AbstractVector, <:Real}=nothing: window for :fir filter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb)

Returns

Named tuple containing:

  • s::Array{Float64, 4}: split signal
  • bn::Vector{Symbol}: band names
  • bf::Vector{Tuple{Real, Real}}: band frequencies
NeuroAnalyzer.cbpFunction
cbp(s; <keyword arguments>)

Perform convolution band-pass filtering.

Arguments

  • s::AbstractVector
  • pad::Int64: pad with pad zeros
  • frq::Real: filter frequency
  • fs::Int64: sampling rate

Returns

  • cbp::Vector{Float64}
cbp(obj; <keyword arguments>)

Perform convolution bandpass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.cbp!Function
cbp!(obj; <keyword arguments>)

Perform convolution bandpass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64: pad the signal with pad zeros
  • frq::Tuple{Real, Real}: filter frequency

Returns

Nothing

NeuroAnalyzer.ch_zeroFunction
ch_zero(obj)

Zero channels at the beginning and at the end.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.ch_zero!Function
ch_zero!(obj)

Zero channels at the beginning and at the end.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Nothing

NeuroAnalyzer.csdFunction
csd(obj; <keyword arguments>)

Transform data using Current Source Density (CSD) transformation based on spherical spline surface Laplacian.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • m::Int64=4: positive integer constant that affects spherical spline flexibility, higher m values mean increased rigidity
  • n::Int64=8: Legendre polynomial order
  • lambda::Float64=10^-5: smoothing factor

Returns

  • obj_new::NeuroAnalyzer.NEURO: with csd channel types and µV/m² units

Source

Perrin F, Pernier J, Bertrand O, Echallier JF. Spherical splines for scalp potential and current density mapping. Electroencephalography and Clinical Neurophysiology. 1989;72(2):184-187 Kayser J, Tenke CE. Principal components analysis of Laplacian waveforms as a generic method for identifying ERP generator patterns: I. Evaluation with auditory oddball tasks. Clin Neurophysiol 2006;117(2):348-368

NeuroAnalyzer.csd!Function
csd!(obj; <keyword arguments>)

Transform data using Current Source Density (CSD) transformation based on spherical spline surface Laplacian.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • m::Int64=4: positive integer constant that affects spherical spline flexibility, higher m values mean increased rigidity
  • n::Int64=8: Legendre polynomial order
  • lambda::Float64=10^-5: smoothing factor

Returns

Nothing

Source

Perrin F, Pernier J, Bertrand O, Echallier JF. Spherical splines for scalp potential and current density mapping. Electroencephalography and Clinical Neurophysiology. 1989;72(2):184-7

NeuroAnalyzer.cw_transFunction
cw_trans(s; <keyword arguments>)

Perform continuous wavelet transformation (CWT).

Arguments

  • s::AbstractVector
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • ct::Matrix{Float64}: CWT coefficients (by rows)
cw_trans(s; <keyword arguments>)

Perform continuous wavelet transformation (CWT).

Arguments

  • s::AbstractArray
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • ct::Array{Float64, 4}: CWT coefficients (by rows)
cw_trans(obj; <keyword arguments>)

Perform continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • ct::Array{Float64, 4}: CWT coefficients (by rows)
NeuroAnalyzer.denoise_cwtFunction
denoise_cwt(s; <keyword arguments>)

Perform denoising using continuous wavelet transformation (iCWT).

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • nf::Real: noise frequency in Hz
  • w::Int64=5: width (in Hz) of the area surrounding noise (from nf - w to nf + w)
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • s_new::Vector{Float64}
denoise_cwt(s; <keyword arguments>)

Perform denoising using continuous wavelet transformation (CWT).

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • nf::Real: noise frequency in Hz
  • w::Int64=5: width (in Hz) of the area surrounding noise (from nf - w to nf + w)
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • s_new::Array{Float64, 3}
denoise_cwt(obj; <keyword arguments>)

Perform denoising using continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • nf::Real: noise frequency in Hz
  • w::Int64=5: width (in Hz) of the area surrounding noise (from nf - w to nf + w)
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_cwt!Function
denoise_cwt!(obj; <keyword arguments>)

Perform denoising using continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • nf::Real: noise frequency in Hz
  • w::Int64=5: width (in Hz) of the area surrounding noise (from nf - w to nf + w)
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

Nothing

NeuroAnalyzer.denoise_dwtFunction
denoise_dwt(s; <keyword arguments>)

Perform denoising using discrete wavelet transformation (DWT).

Arguments

  • s::AbstractVector
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets

Returns

  • s_new::Vector{Float64}
denoise_dwt(s; <keyword arguments>)

Perform denoising using discrete wavelet transformation (DWT).

Arguments

  • s::AbstractArray
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets

Returns

  • s_new::Array{Float64, 3}
denoise_dwt(obj; <keyword arguments>)

Perform denoising using discrete wavelet transformation (DWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_dwt!Function
denoise_dwt!(obj; <keyword arguments>)

Perform denoising using discrete wavelet transformation (DWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets

Returns

Nothing

NeuroAnalyzer.denoise_fftFunction
denoise_fft(s; <keyword arguments>)

Perform FFT denoising.

Arguments

  • s::AbstractVector
  • pad::Int64=0: number of zeros to add
  • t::Real=0: PSD threshold for keeping frequency components; if 0, use mean signal power value

Returns

Named tuple containing:

  • s::Vector{Float64}: denoised signal
  • f_idx::BitVector: index of components zeroed
denoise_fft(s; <keyword arguments>)

Perform FFT denoising.

Arguments

  • s::AbstractArray
  • pad::Int64=0: number of zeros to add
  • t::Real=0: PSD threshold for keeping frequency components; if 0, use mean signal power value

Returns

  • s_new::Array{Float64, 3}
denoise_fft(obj; <keyword arguments>)

Perform FFT denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add signal for FFT
  • t::Int64=100: PSD threshold for keeping frequency components

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_fft!Function
denoise_fft!(obj; <keyword arguments>)

Perform FFT denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add signal for FFT
  • t::Int64=100: PSD threshold for keeping frequency components

Returns

Nothing

NeuroAnalyzer.denoise_wienFunction
denoise_wien(s)

Perform Wiener deconvolution denoising.

Arguments

  • s::AbstractArray

Returns

  • s_new::AbstractArray
denoise_wien(obj; <keyword arguments>)

Perform Wiener deconvolution denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_wien!Function
denoise_wien!(obj; <keyword arguments>)

Perform Wiener deconvolution denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

NeuroAnalyzer.derivativeFunction
derivative(s)

Return derivative (calculated using symmetric difference quotient) of a discrete signal of the same length.

Arguments

  • s::AbstractVector

Returns

  • s_new::AbstractVector
derivative(s)

Return derivative (calculated using symmetric difference quotient) of a discrete signal of the same length.

Arguments

  • s::AbstractArray

Returns

  • s_new::Array{Float64, 3}
derivative(obj; <keyword arguments>)

Return derivative (calculated using symmetric difference quotient) of a discrete signal of the same length.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.derivative!Function
derivative!(obj; <keyword arguments>)

Return derivative (calculated using symmetric difference quotient) of a discrete signal of the same length.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

NeuroAnalyzer.detect_powerlineFunction
detect_powerline(s; <keyword arguments>)

Detect power line noise frequency.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate

Returns

  • noise_frq::Float64: peak noise frequency in Hz
detect_powerline(obj)

Detect power line noise frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • noise_frq::Array{Float64, 3}: peak noise frequency in Hz
NeuroAnalyzer.detrendFunction
detrend(s; <keyword arguments>)

Perform piecewise detrending.

Arguments

  • s::AbstractVector
  • type::Symbol=:linear:
    • :loess: fit loess approximation and subtract it from s
    • :poly: polynomial of order is subtracted from s
    • :mean: the mean of s is subtracted from s
    • :constant: offset is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
    • :linear: linear trend (1st order polynomial) is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp

Returns

  • s_new::Vector{Float64}
detrend(s; <keyword arguments>)

Perform piecewise detrending.

Arguments

  • s::AbstractArray
  • type::Symbol=:linear: detrending method
    • :loess: fit loess approximation and subtract it from s
    • :poly: polynomial of order is subtracted from s
    • :mean: the mean of s is subtracted from s
    • :constant: offset is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
    • :linear: linear trend (1st order polynomial) is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp

Returns

  • s_new::Array{Float64, 3}
detrend(obj; <keyword arguments>)

Perform piecewise detrending.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • type::Symbol=:linear: detrending method
    • :loess: fit loess approximation and subtract it from s
    • :poly: polynomial of order is subtracted from s
    • :mean: the mean of s is subtracted from s
    • :constant: offset is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
    • :linear: linear trend (1st order polynomial) is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.detrend!Function
detrend!(obj; <keyword arguments>)

Perform piecewise detrending.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • type::Symbol=:linear: detrending method
    • :loess: fit loess approximation and subtract it from s
    • :poly: polynomial of order is subtracted from s
    • :mean: the mean of s is subtracted from s
    • :constant: offset is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
    • :linear: linear trend (1st order polynomial) is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp

Returns

Nothing

NeuroAnalyzer.downsampleFunction
downsample(obj; <keyword arguments>)

Downsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.downsample!Function
downsample!(obj; <keyword arguments>)

Downsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate

Returns

Nothing

NeuroAnalyzer.dw_splitFunction
dw_split(obj; <keyword arguments>)

Split into bands using discrete wavelet transformation (DWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
  • type::Symbol: transformation type:
    • :sdwt: Stationary Wavelet Transforms
    • :acdwt: Autocorrelation Wavelet Transforms
  • n::Int64=0: number of bands, default is maximum number of bands available or total transformation

Returns

  • b::Array{Float64, 3}: bands from lowest to highest frequency (by rows)
NeuroAnalyzer.dw_transFunction
dw_trans(s; <keyword arguments>)

Perform discrete wavelet transformation (DWT).

Arguments

  • s::AbstractVector
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
  • type::Symbol: transformation type:
    • :sdwt: Stationary Wavelet Transforms
    • :acdwt: Autocorrelation Wavelet Transforms
  • l::Int64=0: number of levels, default maximum number of levels available or total transformation

Returns

  • dt::Matrix{Float64}: DWT coefficients cAl, cD1, ..., cDl (by rows)
dw_trans(s; <keyword arguments>)

Perform discrete wavelet transformation (DWT).

Arguments

  • s::AbstractArray
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
  • type::Symbol: transformation type:
    • :sdwt: Stationary Wavelet Transforms
    • :acdwt: Autocorrelation Wavelet Transforms
  • l::Int64=0: number of levels, default is maximum number of levels available or total transformation

Returns

  • dt::Array{Float64, 4}: DWT coefficients cAl, cD1, ..., cDl (by rows)
dw_trans(obj; <keyword arguments>)

Perform discrete wavelet transformation (DWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
  • type::Symbol: transformation type:
    • :sdwt: Stationary Wavelet Transforms
    • :acdwt: Autocorrelation Wavelet Transforms
  • l::Int64=0: number of levels, default is maximum number of levels available or total transformation

Returns

  • dt::Array{Float64, 4}: DWT coefficients cAl, cD1, ..., cDl (by rows)
NeuroAnalyzer.edit_montageFunction
edit_montage(file_name; <keyword arguments>)

Edit montage file in the OS editor.

Arguments

  • file_name::String: name of the file to load

Returns

Nothing

NeuroAnalyzer.fconvFunction
fconv(s; <keyword arguments>)

Perform convolution in the frequency domain.

Arguments

  • s::AbstractVector
  • kernel::AbstractVector
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data

Returns

  • s_new::Vector{ComplexF64}: convoluted signal
fconv(s; <keyword arguments>)

Perform convolution in the frequency domain.

Arguments

  • s::AbstractArray
  • kernel::AbstractVector: convolution kernel
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data

Returns

  • s_new::Array{ComplexF64, 3}: convoluted signal
fconv(obj; <keyword arguments>)

Perform convolution in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • kernel::AbstractVector: convolution kernel
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data

Returns

  • s_new::Array{ComplexF64, 3}: convoluted signal
NeuroAnalyzer.filterFunction
filter(obj; <keyword arguments>)

Apply filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • fprototype::Symbol: filter prototype:
    • :butterworth: IIR filter
    • :chebyshev1 IIR filter
    • :chebyshev2 IIR filter
    • :elliptic IIR filter
    • :iirnotch: second-order IIR notch filter
    • :fir: FIR filter
    • :firls: weighted least-squares FIR filter
    • :remez: Remez FIR filter
  • ftype::Union{Nothing, Symbol}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}=0: filter cutoff in Hz (must be a pair of frequencies for :bp and :bs)
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • dir:Symbol=:twopass: filter direction (for causal filter use :onepass):
    • :twopass
    • :onepass
    • :reverse: one pass, reverse direction
  • order::Int64=8: filter order (6 dB/octave) for IIR filters, number of taps for :remez filter, attenuation (× 4 dB) for :fir filter
  • w::Union{Nothing, AbstractVector, <:Real}=nothing: window for :fir filter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb) or weights for :firls filter
  • preview::Bool=false: plot filter response

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter!Function
filter!(obj; <keyword arguments>)

Apply filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • fprototype::Symbol: filter prototype:
    • :butterworth: IIR filter
    • :chebyshev1 IIR filter
    • :chebyshev2 IIR filter
    • :elliptic IIR filter
    • :iirnotch: second-order IIR notch filter
    • :fir: FIR filter
    • :firls: weighted least-squares FIR filter
    • :remez: Remez FIR filter
  • ftype::Union{Nothing, Symbol}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}=0: filter cutoff in Hz (must be a pair of frequencies for :bp and :bs)
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • dir:Symbol=:twopass: filter direction (for causal filter use :onepass):
    • :twopass
    • :onepass
    • :reverse: one pass, reverse direction
  • order::Int64=8: filter order (6 dB/octave) for IIR filters, number of taps for :remez filter, attenuation (× 4 dB) for :fir filter
  • w::Union{Nothing, AbstractVector, <:Real}=nothing: window for :fir filter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb) or weights for :firls filter
  • preview::Bool=false: plot filter response

Returns

Nothing

NeuroAnalyzer.filter_applyFunction
filter_apply(s; <keyword arguments>)

Apply IIR or FIR filter.

Arguments

  • s::AbstractVector
  • flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}: filter
  • dir:Symbol=:twopass: filter direction (for causal filter use :onepass):
    • :twopass
    • :onepass
    • :reverse: one pass, reverse direction

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.filter_createFunction
filter_create(; <keyword arguments>)

Create IIR or FIR filter.

Arguments

  • fprototype::Symbol: filter prototype:
    • :butterworth: IIR filter
    • :chebyshev1 IIR filter
    • :chebyshev2 IIR filter
    • :elliptic IIR filter
    • :iirnotch: second-order IIR notch filter
    • :fir: FIR filter
    • :firls: weighted least-squares FIR filter
    • :remez: Remez FIR filter
  • ftype::Union{Nothing, Symbol}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}=0: filter cutoff in Hz (must be a pair of frequencies for :bp and :bs)
  • n::Int64: signal length in samples
  • fs::Int64: sampling rate
  • order::Int64=8: filter order (6 dB/octave), number of taps for :remez, attenuation (× 4 dB) for :fir filters
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • w::Union{Nothing, AbstractVector, <:Real}=nothing: window for :fir filter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb) or weights for :firls filter

Returns

  • flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}
NeuroAnalyzer.filter_gFunction
filter_g(s, fs, pad, f, gw)

Filter using Gaussian in the frequency domain.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz

Returns

  • s_new::Vector{Float64}
filter_g(s; <keyword arguments>)

Filter using Gaussian in the frequency domain.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz

Returns

  • s_new::Array{Float64, 3}
filter_g(obj; <keyword arguments>)

Filter using Gaussian in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_g!Function
filter_g!(obj; <keyword arguments>)

Filter using Gaussian in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz

Returns

Nothing

NeuroAnalyzer.filter_mavgFunction
filter_mavg(s; <keyword arguments>)

Filter using moving average filter (with threshold).

Arguments

  • s::AbstractVector
  • k::Int64=8: window length is 2 × k + 1; for cut-off frequency f, k is sqrt(0.196202 + f^2) / f
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • s_filtered::Vector{Float64}
filter_mavg(s; <keyword arguments>)

Filter using moving average filter (with threshold).

Arguments

  • s::AbstractArray
  • k::Int64=8: window length is 2 × k + 1; for cut-off frequency f, k is sqrt(0.196202 + f^2) / f
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • s_filtered::Array{Float64, 3}
filter_mavg(obj; <keyword arguments>)

Filter using moving average filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • k::Int64=8: window length is 2 × k + 1; for cut-off frequency F, k is sqrt(0.196202 + F^2) / F, where F is a normalized frequency (F = f/fs)
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • obj_new::NeuroAnalyzer.NEURO

Source

  1. https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequency-of-a-moving-average-filter
NeuroAnalyzer.filter_mavg!Function
filter_mavg!(obj; <keyword arguments>)

Filter using moving average filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • k::Int64=8: window length is 2 × k + 1; for cut-off frequency f, k is sqrt(0.196202 + f^2) / f
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s))
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

Nothing

NeuroAnalyzer.filter_mmedFunction
filter_mmed(s; <keyword arguments>)

Filter using moving median filter (with threshold).

Arguments

  • s::AbstractVector
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • s_filtered::Vector{Float64}
filter_mmed(s; <keyword arguments>)

Filter using moving median filter (with threshold).

Arguments

  • s::AbstractArray
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • s_filtered::Array{Float64, 3}
filter_mmed(obj; <keyword arguments>)

Filter using moving median filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_mmed!Function
filter_mmed!(obj; <keyword arguments>)

Filter using moving median filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

Nothing

NeuroAnalyzer.filter_polyFunction
filter_poly(s; <keyword arguments>)

Filter using polynomial filter.

Arguments

  • s::AbstractVector
  • order::Int64=8: polynomial order
  • window::Int64=10: window length

Returns

  • s_filtered::Vector{Float64}
filter_poly(s; <keyword arguments>)

Filter using polynomial filter.

Arguments

  • s::AbstractArray
  • order::Int64=8: polynomial order
  • window::Int64=10: window length

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
filter_poly(obj; <keyword arguments>)

Filter using polynomial filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • order::Int64=8: polynomial order
  • window::Int64=10: window length

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal
NeuroAnalyzer.filter_poly!Function
filter_poly!(obj; <keyword arguments>)

Filter using polynomial filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • order::Int64=8: polynomial order
  • window::Int64=10: window length

Returns

Nothing

NeuroAnalyzer.filter_sgFunction
filter_sg(s; <keyword arguments>)

Filter using Savitzky-Golay filter.

Arguments

  • s::AbstractVector
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number

Returns

  • s_filtered::Vector{Float64}
filter_sg(s; <keyword arguments>)

Filter using Savitzky-Golay filter.

Arguments

  • s::AbstractArray
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
filter_sg(obj; <keyword arguments>)

Filter using Savitzky-Golay filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_sg!Function
filter_sg!(obj; <keyword arguments>)

Filter using Savitzky-Golay filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number

Returns

Nothing

NeuroAnalyzer.ghFunction
gh(locs; <keyword arguments>)

Generate G and H matrices.

Arguments

  • locs::DataFrame
  • m::Int64=4: positive integer constant that affects spherical spline flexibility, higher m values mean increased rigidity
  • n::Int64=8: Legendre polynomial order

Returns

Named tuple containing:

  • G::Matrix{Float64}: transformation matrix (SP spline)
  • H::Matrix{Float64}: transformation matrix (CSD spline)

Source

Perrin F, Pernier J, Bertrand O, Echallier JF. Spherical splines for scalp potential and current density mapping. Electroencephalography and Clinical Neurophysiology. 1989;72(2):184-7

NeuroAnalyzer.ica_decomposeFunction
ica_decompose(s; <keyword arguments>)

Calculate n first Independent Components using FastICA algorithm.

Arguments

  • s::AbstractMatrix
  • n::Int64: number of ICs
  • iter::Int64=100: maximum number of iterations
  • f::Symbol=:tanh: neg-entropy functor:
    • :tanh
    • :gaus

Returns

Named tuple containing:

  • ic::Matrix{Float64}: components IC(1)..IC(n) (W * data), components are sorted by decreasing variance
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n) (inv(W))
ica_decompose(obj; <keyword arguments>)

Perform independent component analysis (ICA) using FastICA algorithm.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • n::Int64=length(ch): number of ICs, default is the number of channels
  • iter::Int64=100: maximum number of iterations
  • f::Symbol=:tanh: neg-entropy functor:
    • :tanh
    • :gaus

Returns

Named tuple containing:

  • ic::Matrix{Float64}: components IC(1)..IC(n) (W * data), components are sorted by decreasing variance
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n) (inv(W))
  • ic_var::Vector{Float64}: variance of components
NeuroAnalyzer.ica_reconstructFunction
ica_reconstruct(; <keyword arguments>)

Reconstruct signal using ICA components.

Arguments

  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

  • s_new::Matrix{Float64}: reconstructed signal
ica_reconstruct(obj; <keyword arguments>)

Reconstruct signals using embedded ICA components (:ic and :ic_mw).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}: list of ICs to remove or keep or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

  • obj_new::NeuroAnalyzer.NEURO
ica_reconstruct(obj, ic, ic_mw; <keyword arguments>)

Reconstruct signals using external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_reconstruct!Function
ica_reconstruct!(obj; <keyword arguments>)

Reconstruct signals using embedded ICA components (:ic and :ic_mw).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

Nothing

ica_reconstruct!(obj, ic, ic_mw; <keyword arguments>)

Reconstruct signals using external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

Nothing

NeuroAnalyzer.ica_removeFunction
ica_remove(obj, ic, ic_mw; <keyword arguments>)

Remove external ICA components from the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove

Returns

  • obj_new::NeuroAnalyzer.NEURO
ica_remove(obj, ic; <keyword arguments>)

Remove embedded ICA components (:ic and :ic_mw).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_remove!Function
ica_remove!(obj, ic, ic_mw; <keyword arguments>)

Remove external ICA components from the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep

Returns

Nothing

ica_remove!(obj; <keyword arguments>)

Remove embedded ICA components (:ic and :ic_mw).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep

Returns

Nothing

NeuroAnalyzer.icw_transFunction
icw_trans(ct; <keyword arguments>)

Perform inverse continuous wavelet transformation (iCWT).

Arguments

  • ct::AbstractArray: CWT coefficients (by rows)
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets
  • type::Symbol=:pd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • s::AbstractArray: reconstructed signal
NeuroAnalyzer.idw_transFunction
idw_trans(dwt_coefs; <keyword arguments>)

Perform inverse discrete wavelet transformation (iDWT) of the dwt_coefs.

Arguments

  • dwt_coefs::AbstractArray: DWT coefficients cAl, cD1, ..., cDl (by rows)
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
  • type::Symbol: transformation type:
    • :sdwt: Stationary Wavelet Transforms
    • :acdwt: Autocorrelation Wavelet Transforms

Returns

  • s_new::AbstractArray: reconstructed signal
NeuroAnalyzer.intensity2odFunction
intensity2od(s)

Convert NIRS intensity (RAW data) to optical density (OD).

Arguments

  • s::AbstractArray

Returns

  • od::AbstractArray
intensity2od(obj; <keyword arguments>)

Convert NIRS intensity (RAW data) to optical density (OD).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}=get_channel(obj, type="nirs_int")): list of channels, default is NIRS intensity channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.intensity2od!Function
intensity2od!(obj; <keyword arguments>)

Convert NIRS intensity (RAW data) to optical density (OD).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}=get_channel(obj, type="nirs_int")): list of channels, default is NIRS intensity channels

Returns

Nothing

NeuroAnalyzer.invert_polarityFunction
invert_polarity(obj; <keyword arguments>)

Invert polarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.invert_polarity!Function
invert_polarity!(obj; <keyword arguments>)

Invert polarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel(s) to invert

Returns

Nothing

NeuroAnalyzer.lrinterpolate_channelFunction
lrinterpolate_channel(obj; <keyword arguments>)

Interpolate channel using linear regression.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Int64: epoch number(s) within to interpolate
  • ep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated one

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.lrinterpolate_channel!Function
lrinterpolate_channel!(obj; <keyword arguments>)

Interpolate channel using linear regression.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Int64: epoch number(s) within to interpolate
  • ep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated one

Returns

Nothing

NeuroAnalyzer.mlinterpolate_channelFunction
mlinterpolate_channel(obj; <keyword arguments>)

Interpolate channel using a machine-learning model.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Int64: epoch number within to interpolate
  • ep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated one
  • model<:MLJ.Model: MLJ regressor model

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.mlinterpolate_channel!Function
mlinterpolate_channel!(obj; <keyword arguments>)

Interpolate channel using linear regression.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Int64: epoch number within to interpolate
  • ep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated one
  • model::T where T <: DataType: MLJ regressor model

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.normalizeFunction
normalize(s, n; <keyword arguments>)

Normalize.

Arguments

  • s::AbstractVector
  • n::Real=1.0
  • method::Symbol:
    • :zscore: by z-score
    • :minmax: in [-1, +1]
    • :log: using log-transformation
    • :log10: using log10-transformation
    • :neglog: using -log-transformation
    • :neglog10: using -log10-transformation
    • :neg: in [-∞, 0]
    • :pos: in [0, +∞]
    • :perc: in percentages
    • :gauss: to Gaussian
    • :invroot: to inverse root: 1/sqrt(x)
    • :n: in [0, n], default is [0, 1]; <keyword arguments>) .+ n1`
    • :softmax: using softmax function: exp(x_i) / sum(exp(x))
    • :sigmoid: using sigmoid function: 1 / 1 + exp(-x_i)
    • :mad: by MAD
    • :rank: using tiedranks
    • :none

Returns

  • normalized::AbstractVector
normalize(s, n; <keyword arguments>)

Normalize.

Arguments

  • s::AbstractArray
  • n::Real=1.0
  • bych::Bool=false: if true, normalize each channel separately
  • method::Symbol:
    • :zscore: by z-score
    • :minmax: in [-1, +1]
    • :log: using log-transformation
    • :log10: using log10-transformation
    • :neglog: using -log-transformation
    • :neglog10: using -log10-transformation
    • :neg: in [-∞, 0]
    • :pos: in [0, +∞]
    • :perc: in percentages
    • :gauss: to Gaussian
    • :invroot: to inverse root: 1/sqrt(x)
    • :n: in [0, n], default is [0, 1]; <keyword arguments>) .+ n1`
    • :softmax: using softmax function: exp(x_i) / sum(exp(x))
    • :sigmoid: using sigmoid function: 1 / 1 + exp(-x_i)
    • :none

Returns

  • sn::AbstractArray
normalize(obj; <keyword arguments>)

Normalize channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • method::Symbol: method for normalization, see normalize() for details
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.normalize!Function
normalize!(obj; <keyword arguments>)

Normalize channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • method::Symbol: method for normalization, see normalize() for details
  • bych::Bool=false: if true, normalize each channel separately

Returns

Nothing

NeuroAnalyzer.normalize_fisherFunction
normalize_fisher(s)

Normalize using Fisher z-transform. Converts uniform distribution into normal distribution.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_fisher(s; <keyword arguments>)

Normalize using Fisher z-transform. Converts uniform distribution into normal distribution.

Arguments

  • s::AbstractArray
  • bych::Bool=false: ignored

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_gaussFunction
normalize_gauss(s)

Normalize to Gaussian.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_gauss(s; <keyword arguments>)

Normalize to Gaussian.

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_invrootFunction
normalize_invroot(s)

Normalize in inverse root (1/sqrt(x)).

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_invroot(s; <keyword arguments>)

Normalize in inverse root (1/sqrt(x)).

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_logFunction
normalize_log(s)

Normalize using log-transformation.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_log(s; <keyword arguments>)

Normalize using log-transformation.

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_log10Function
normalize_log10(s)

Normalize using log10-transformation.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_log10(s; <keyword arguments>)

Normalize using log10-transformation.

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_madFunction
normalize_mad(s)

Normalize by MAD.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_mad(s; <keyword arguments>)

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_minmaxFunction
normalize_minmax(s)

Normalize in [-1, +1]. If all elements are the same, they are normalized to +1.0.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
NeuroAnalyzer.normalize_nFunction
normalize_n(s, n)

Normalize in [0, n], default is [0, +1].

Arguments

  • s::AbstractVector
  • n::Real=1.0

Returns

  • sn::AbstractVector
normalize_n(s, n; <keyword arguments>)

Normalize in [0, n], default is [0, +1].

Arguments

  • s::AbstractArray
  • n::Real=1.0
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_negFunction
normalize_neg(s)

Normalize in [-∞, 0].

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_neg(s)

Normalize in [-∞, 0].

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_neglogFunction
normalize_neglog(s; <keyword arguments>)

Normalize to using -log-transformation.

Arguments

  • s::AbstractArray
  • bych::Bool=false: ignored

Returns

  • sn::Vector{Float64}
NeuroAnalyzer.normalize_neglog10Function
normalize_neglog10(s; <keyword arguments>)

Normalize using -log10-transformation.

Arguments

  • s::AbstractArray
  • bych::Bool=false: ignored

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_percFunction
normalize_perc(s)

Normalize in percentages.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_perc(s; <keyword arguments>)

Normalize in percentages.

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_posFunction
normalize_pos(s)

Normalize in [0, +∞].

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_pos(s; <keyword arguments>)

Normalize in [0, +∞].

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_rankFunction
normalize_rank(s)

Normalize using tiedranks.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_rank(s; <keyword arguments>)

Normalize using tiedranks.

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_sigmoidFunction
normalize_sigmoid(s; <keyword arguments>)

Normalize using sigmoid function: 1 / (1 + e^-x_i)

Arguments

  • s::AbstractArray
  • bych::Bool=false: ignored

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_softmaxFunction
normalize_softmax(s; <keyword arguments>)

Softmax normalize: exp(x_i) / sum(exp(x))

Arguments

  • s::AbstractArray
  • bych::Bool=false: ignored

Returns

  • sn::AbstractArray
NeuroAnalyzer.normalize_zscoreFunction
normalize_zscore(s)

Normalize by z-score.

Arguments

  • s::AbstractVector

Returns

  • sn::AbstractVector
normalize_zscore(s; <keyword arguments>)

Arguments

  • s::AbstractArray
  • bych::Bool=false: if true, normalize each channel separately

Returns

  • sn::AbstractArray
NeuroAnalyzer.normpowerFunction
normpower(s)

Return a signal with normalized power (amplitudes divided by the root-mean-squared value of the entire signal).

Arguments

  • s::AbstractVector

Returns

  • s_new::Vector{Float64}
normpower(s)

Return a signal with normalized power (amplitudes divided by the root-mean-squared value of the entire signal).

Arguments

  • s::AbstractArray

Returns

  • s_new::Array{Float64, 3}
normpower(obj; <keyword arguments>)

Return a signal with normalized power (amplitudes divided by the root-mean-squared value of the entire signal).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.normpower!Function
normpower!(obj; <keyword arguments>)

Return a signal with normalized power (amplitudes divided by the root-mean-squared value of the entire signal).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

NeuroAnalyzer.nplFunction
npl(obj)

Calculate non-phase-locked signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: must be ERP object

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.npl!Function
npl!(obj)

Calculate non-phase-locked signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: must be ERP object

Returns

Nothing

NeuroAnalyzer.od2concFunction
od2conc(obj; <keyword arguments>)

Convert NIRS optical density (OD) to concentration (HbO, HbR, HbT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}=get_channel(obj, type="nirs_od")): list of channels, default is NIRS intensity channels
  • ppf::Vector{Real}=ones(length(obj.header.recording[:wavelengths])): Partial path length factors for each wavelength. This is a vector of factors per wavelength. Typical value is ~6 for each wavelength if the absorption change is uniform over the volume of tissue measured. To approximate the partial volume effect of a small localized absorption change within an adult human head, this value could be as small as 0.1. Convention is becoming to set ppf=1 and to not divide by the source-detector separation such that the resultant "concentration" is in units of Molar mm (or Molar cm if those are the spatial units). This is becoming wide spread in the literature but there is no fixed citation. Use a value of 1 to choose this option.

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.od2conc!Function
od2conc!(obj; <keyword arguments>)

Convert NIRS optical density (OD) to concentration (HbO, HbR, HbT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}=get_channel(obj, type="nirs_od")): list of channels, default is NIRS intensity channels
  • ppf::Vector{Real}=ones(length(obj.header.recording[:wavelengths])): Partial path length factors for each wavelength. This is a vector of factors per wavelength. Typical value is ~6 for each wavelength if the absorption change is uniform over the volume of tissue measured. To approximate the partial volume effect of a small localized absorption change within an adult human head, this value could be as small as 0.1. Convention is becoming to set ppf=1 and to not divide by the source-detector separation such that the resultant "concentration" is in units of Molar mm (or Molar cm if those are the spatial units). This is becoming wide spread in the literature but there is no fixed citation. Use a value of 1 to choose this option.

Returns

Nothing

NeuroAnalyzer.pca_decomposeFunction
pca_decompose(s, n)

Calculate n first Primary Components (PCs).

Arguments

  • s::AbstractArray
  • n::Int64: number of PCs

Returns

Named tuple containing:

  • pc::Array{Float64, 3}: PC(1)..PC(n) × epoch
  • pcv::Matrix{Float64}: variance of PC(1)..PC(n) × epoch (% of total variance)
  • pcm::Vector{Float64}: PC mean
  • pc_model::MultivariateStats.PCA{Float64}: PC model
pca_decompose(obj; <keyword arguments>)

Calculate n first Primary Components (PCs).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • n::Int64: number of PCs to calculate

Returns

Named tuple containing:

  • pc::Array{Float64, 3}: PC(1)..PC(n) × epoch
  • pcv::Matrix{Float64}: variance of PC(1)..PC(n) × epoch (% of total variance)
  • pcm::Vector{Float64}: PC mean
  • pc_model::MultivariateStats.PCA{Float64}: PC model
NeuroAnalyzer.pca_reconstructFunction
pca_reconstruct(s, pc, pca)

Reconstructs signal using PCA components.

Arguments

  • s::AbstractArray
  • pc::AbstractArray:: IC(1)..IC(n) × epoch
  • pc_model::MultivariateStats.PCA{Float64}:: PC model

Returns

  • s_new::Array{Float64, 3}
pca_reconstruct(obj; <keyword arguments>)

Reconstruct signal using embedded PCA components (:pc) and model (:pc_model).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
pca_reconstruct(obj, pc, pc_model; <keyword arguments>)

Reconstruct signal using external PCA components (pc and pca).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • pc::Array{Float64, 3}:: PC(1)..PC(n) × epoch
  • pc_model::MultivariateStats.PCA{Float64}: PC model
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.pca_reconstruct!Function
pca_reconstruct!(obj; <keyword arguments>)

Reconstruct signal using embedded PCA components (:pc) and model (:pc_model).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

pca_reconstruct!(obj, pc, pc_model; <keyword arguments>)

Reconstruct signals using external PCA components (pc and pc_model).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • pc::Array{Float64, 3}:: PC(1)..PC(n) × epoch
  • pc_model::MultivariateStats.PCA{Float64}: PC model
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

NeuroAnalyzer.plinterpolateFunction
plinterpolate(s; <keyword arguments>)

Interpolate channel using planar interpolation.

Arguments

  • s::Matrix{Float64}: values to plot (one value per channel)
  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Int64: channel to interpolate
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • ifactor::Int64=100: interpolation quality

Returns

Named tuple containing:

  • int_s::Matrix{Float64}: interpolated signal
  • int_x::Vector{Float64}: X-axis coordinates
  • int_y::Vector{Float64}: Y-axis coordinates
NeuroAnalyzer.plinterpolate_channelFunction
plinterpolate_channel(obj; <keyword arguments>)

Interpolate channel using planar interpolation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • ifactor::Int64=100: interpolation quality

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.plinterpolate_channel!Function
plinterpolate_channel!(obj; <keyword arguments>)

Interpolate channel using planar interpolation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate
  • imethod::Symbol=:sh: interpolation method Shepard (:sh), Multiquadratic (:mq), InverseMultiquadratic (:imq), ThinPlate (:tp), NearestNeighbour (:nn), Gaussian (:ga)
  • ifactor::Int64=100: interpolation quality

Returns

Nothing

NeuroAnalyzer.reference_aFunction
reference_a(obj; <keyword arguments>)

Reference to auricular (A1, A2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of A1 and A2
    • :i: ipsilateral - A1 for left channels, A2 for right channels
    • :c: contraletral - A1 for right channels, A2 for left channels
  • med::Bool=false: use median instead of mean

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_a!Function
reference_a!(obj; <keyword arguments>)

Reference to auricular (A1, A2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of A1 and A2
    • :i: ipsilateral - A1 for left channels, A2 for right channels
    • :c: contraletral - A1 for right channels, A2 for left channels
  • med::Bool=false: use median instead of mean

Returns

Nothing

NeuroAnalyzer.reference_avgFunction
reference_avg(obj; <keyword arguments>)

Reference to averaged reference. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • exclude_fpo::Bool=false: exclude Fp1, Fp2 (due to eye blinks), O1, O2 (due to head movements) from CAR calculation
  • exclude_current::Bool=false: exclude current channel from CAR calculation
  • average::Bool=true: average reference channels prior to subtracting, otherwise add all reference channels
  • med::Bool=false: use median instead of mean
  • weighted::Bool=false: use weighted reference channels (weights depend on the distance from the current electrode)

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_avg!Function
reference_avg!(obj; <keyword arguments>)

Reference to averaged reference. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • exclude_fpo::Bool=false: exclude Fp1, Fp2 (due to eye blinks), O1, O2 (due to head movements) from CAR calculation
  • exclude_current::Bool=false: exclude current channel from CAR mean calculation
  • average::Bool=true: average reference channels prior to subtracting, otherwise add all reference channels
  • med::Bool=false: use median instead of mean
  • weighted::Bool=false: use weighted reference channels (weights depend on the distance from the current electrode)

Returns

Nothing

NeuroAnalyzer.reference_ceFunction
reference_ce(obj; <keyword arguments>)

Reference to common electrode(s). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names used as reference; if multiple channels are specified, their average is used as the reference
  • med::Bool=false: use median instead of mean

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_ce!Function
reference_ce!(obj; <keyword arguments>)

Reference to common electrode(s). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names used as reference; if multiple channels are specified, their average is used as the reference
  • med::Bool=false: use median instead of mean

Returns

Nothing

NeuroAnalyzer.reference_customFunction
reference_custom(obj; <keyword arguments>)

Reference using custom montage. Only signal channels are processed. Custom montage may be imported using import_montage().

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ref_list::Vector{String}=["Fz-Cz", "Cz-Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"]: list of channel pairs
  • ref_name::String="longitudinal-BIP": name of the montage

Returns

  • obj_new::NeuroAnalyzer.NEURO

Notes

If the reference contains a single channel (e.g. "Fz"), than the channel is copied to the referenced data. For each reference pair (e.g. "Fz-Cz"), the referenced channel is equal to the amplitude of channel 2 ("Cz") - amplitude of channel 1 ("Fz").

Examples of montages:

  • bipolar transverse: ["Fp2-Fp1", "F8-Fp2", "F8-F4", "F4-Fz", "Fz-F3", "F3-F7", "Fp1-F7", "T4-C4", "C4-Cz", "Cz-C3", "C3-T3", "T6-P4", "P4-Pz", "Pz-P3", "P3-T5", "O2-O1"], "transverse-BIP"
  • bipolar longitudinal: ["Fz-Cz", "Cz-Pz", "Pz-Oz", "Fp1-F7", "Fp1-F3", "F7-T7", "F7-T3", "T7-P7", "T7-T5", "T3-P7", "T3-T5", "P7-O1", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "F8-T8", "F8-T4", "T8-P8", "T8-T6", "T4-P8", "T4-T6", "T6-O2", "P8-O2", "Fp2-F4", "F4-C4", "C4-P4", "P4-O2"], "longitudinal-BIP"
  • bipolar longitudinal: ["Fz", "Cz", "Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"], "longitudinal-BIP"
  • bipolar longitudinal: ["FPz-Fz", "Fz-Cz", "Cz-Pz", "Pz-Oz", "Fp1-F7", "Fp1-F3", "F7-T7", "F7-T3", "T7-P7", "T7-T5", "T3-P7", "T3-T5", "P7-O1", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "F8-T8", "F8-T4", "T8-P8", "T8-T6", "T4-P8", "T4-T6", "T6-O2", "P8-O2", "Fp2-F4", "F4-C4", "C4-P4", "P4-O2"], "longitudinal-BIP"
NeuroAnalyzer.reference_custom!Function
reference_custom!(obj; <keyword arguments>)

Reference using custom montage. Only signal channels are processed. Custom montage may be imported using import_montage().

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ref_list::Vector{String}=["Fz-Cz", "Cz-Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"]: list of channel pairs
  • ref_name::String="BIP ||": name of the montage

Notes

If the reference contains a single channel (e.g. "Fz"), than the channel is copied to the referenced data. For each reference pair (e.g. "Fz-Cz"), the referenced channel is equal to the amplitude of channel 2 ("Cz") - amplitude of channel 1 ("Fz").

Examples of montages:

  • bipolar transverse: ["Fp2-Fp1", "F8-Fp2", "F8-F4", "F4-Fz", "Fz-F3", "F3-F7", "Fp1-F7", "T4-C4", "C4-Cz", "Cz-C3", "C3-T3", "T6-P4", "P4-Pz", "Pz-P3", "P3-T5", "O2-O1"], "BIP ="
  • bipolar longitudinal: ["Fz", "Cz", "Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"], "BIP ||"
  • bipolar longitudinal: ["Fp-Fz", "Fz-Cz", "Cz-Pz", "Pz-O", "Fp1-F7", "Fp1-F3", "F7-T7", "T7-P7", "P7-O1", "F3-C3", "C3-P3", "P3-O1", "Fp1-F7", "Fp2-F4", "F8-T8", "T8-P8", "P8-O2", "F4-C4", "C4-P4", "P4-O2"], "BIP ||"

Returns

Nothing

NeuroAnalyzer.reference_mFunction
reference_m(obj; <keyword arguments>)

Reference to mastoid (M1, M2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of M1 and M2
    • :i: ipsilateral - M1 for left channels, M2 for right channels
    • :c: contraletral - M1 for right channels, M2 for left channels
  • med::Bool=false: use median instead of mean

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_m!Function
reference_m!(obj; <keyword arguments>)

Reference to mastoid (M1, M2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of M1 and M2
    • :i: ipsilateral - M1 for left channels, M2 for right channels
    • :c: contraletral - M1 for right channels, M2 for left channels
  • med::Bool=false: use median instead of mean

Returns

Nothing

NeuroAnalyzer.reference_plapFunction
reference_plap(obj; <keyword arguments>)

Reference using planar Laplacian (using nn adjacent electrodes). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • nn::Int64=4: use nn adjacent electrodes
  • weighted::Bool=false: use mean of nn nearest channels if false; if true, mean of nn nearest channels is weighted by distance to the referenced channel
  • med::Bool=false: use median instead of mean

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_plap!Function
reference_plap!(obj; <keyword arguments>)

Reference using planar Laplacian (using nn adjacent electrodes). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • nn::Int64=4: use nn adjacent electrodes
  • weighted::Bool=false: use distance weights; use mean of nearest channels if false
  • med::Bool=false: use median instead of mean

Returns

Nothing

NeuroAnalyzer.remove_cwtFunction
remove_cwt(s, t; <keyword arguments>)

Remove artifacts using continuous wavelet transformation (CWT).

Arguments

  • s::AbstractVector
  • t::AbstractVector: time points
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • tseg::Tuple{Real, Real}: artifact time location
  • fseg::Tuple{Real, Real}: artifact frequency location
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • s_new::Vector{Float64}
remove_cwt(obj; <keyword arguments>)

Remove artifacts using continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • ep::Int64
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • tseg::Tuple{Real, Real}: artifact time location
  • fseg::Tuple{Real, Real}: artifact frequency location
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.remove_cwt!Function
remove_cwt!(obj; <keyword arguments>)

Remove artifacts using continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • ep::Int64
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • tseg::Tuple{Real, Real}: artifact time location
  • fseg::Tuple{Real, Real}: artifact frequency location
  • type::Symbol=:nd: inverse style type:
    • :pd: PenroseDelta
    • :nd: NaiveDelta
    • :df: DualFrames
NeuroAnalyzer.remove_dcFunction
remove_dc(s, n)

Remove mean value (DC offset).

Arguments

  • s::AbstractVector
  • n::Union{Int64, Tuple{Int64, Int64}}=0: if n is greater than 0, mean value is calculated for the first n samples or if n is a tuple greater than (0, 0), mean value is calculated for n[1] to n[2] samples

Returns

  • s_new::Vector{Float64}
remove_dc(s, n)

Remove mean value (DC offset).

Arguments

  • s::AbstractArray
  • n::Union{Int64, Tuple{Int64, Int64}}=0: if n is greater than 0, mean value is calculated for the first n samples or if n is a tuple greater than (0, 0), mean value is calculated for n[1] to n[2] samples

Returns

  • s::Array{Float64, 3}
remove_dc(obj; <keyword arguments>)

Remove mean value (DC offset).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • n::Union{Int64, Tuple{Int64, Int64}}=0: if n is greater than 0, mean value is calculated for the first n samples or if n is a tuple greater than (0, 0), mean value is calculated for n[1] to n[2] samples

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.remove_dc!Function
remove_dc!(obj; <keyword arguments>)

Remove mean value (DC offset).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • n::Union{Int64, Tuple{Int64, Int64}}=0: if n is greater than 0, mean value is calculated for the first n samples or if n is a tuple greater than (0, 0), mean value is calculated for n[1] to n[2] samples

Returns

Nothing

NeuroAnalyzer.remove_popsFunction
remove_pops(s; <keyword arguments>)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected, signal length should be ≥2 seconds.

Arguments

  • s::AbstractVector
  • r::Int64=20: detection segment length; pops are checked within pop_loc - r:pop_loc + r samples
  • repair::Bool=true: recover the segment if true

Returns

Named tuple containing:

  • s::Vector{Float64}
  • pop_loc::Int64: sample number in the signal
  • l_seg::Int64: length of segment before the pop that starts when signal crosses 0
  • r_seg::Int64: length of segment after the pop that ends when signal crosses 0
remove_pops(obj; <keyword arguments>)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected per segment, signal length should be ≈2 seconds.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • repair::Bool=true: recover the segment if true
  • window::Real=10.0: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)
  • r::Int64=sr(obj)÷2: detection segment length; pops are checked within (pop_loc - r):(pop_loc + r) samples

Returns

  • obj_new::NeuroAnalyzer.NEURO: returned if repair=true
  • pop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signal
  • l_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0
  • r_seg::Vector{Int64}: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_pops!Function
remove_pops!(obj; <keyword arguments>)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected, signal length should be ≈2 seconds.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • repair::Bool=true: recover the segment if true
  • window::Real=20.0: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)
  • r::Int64=sr(obj)÷2: detection segment length; pops are checked within pop_loc - r:pop_loc + r samples

Returns

  • pop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signal
  • l_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0
  • r_seg::Vector{Int64}: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_powerlineFunction
remove_powerline(obj; <keyword arguments>)

Remove power line noise and its peaks above power line frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pl_frq::Real=obj.header.recording[:line_frequency]: power line frequency, default is read from the OBJ header
  • method::Symbol=:iir:
    • :iir: use IIR filter
  • pr::Real=2.0: prominence of noise peaks in dB
  • d::Real=5.0: minimum distance between peaks in Hz
  • q::Real=0.1: optimization step size

Returns

  • obj_new::NeuroAnalyzer.NEURO
  • df::DataFrame: list of peaks detected
NeuroAnalyzer.remove_powerline!Function
remove_powerline!(obj; <keyword arguments>)

Remove power line noise and harmonics.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pl_frq::Real=obj.header.recording[:line_frequency]: power line frequency, default is read from the OBJ header
  • method::Symbol=:iir: use IIR filter
  • pr::Real=2.0: prominence of noise peaks in dB
  • d::Real=5.0: minimum distance between peaks in Hz
  • q::Real=0.1: optimization step size

Returns

  • df::DataFrame: list of peaks detected
NeuroAnalyzer.resampleFunction
resample(s; <keyword arguments>)

Resample to new_sr sampling frequency.

Arguments

  • s::AbstractVector
  • old_sr::Int64: old sampling rate
  • new_sr::Int64: new sampling rate

Returns

  • s_new::Vector{Float64}
resample(s; <keyword arguments>)

Resamples all channels and time vector t to new_sr sampling frequency.

Arguments

  • s::AbstractArray
  • old_sr::Int64: old sampling rate
  • new_sr::Int64: new sampling rate

Returns

  • s_new::Array{Float64, 3}
resample(obj; <keyword arguments>)

Resample (up- or down-sample).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • old_sr::Int64: old sampling rate - new_sr::Int64: new sampling rate

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.resample!Function
resample!(obj; <keyword arguments>)

Resample (up- or down-sample).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate

Returns

Nothing

NeuroAnalyzer.scaleFunction
scale(obj; <keyword arguments>)

Multiply channel(s) by factor.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • factor::Real: signal is multiplied by factor

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.scale!Function
scale!(obj; <keyword arguments>)

Multiply channel(s) by factor.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • factor::Real: signal is multiplied by factor

Returns

Nothing

NeuroAnalyzer.sort_epochsFunction
sort_epochs(obj; <keyword arguments>)

Sort epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • s::Vector{Int64}: vector of sorting indices

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.sort_epochs!Function
sort_epochs(obj; <keyword arguments>)

Sort epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • s::Vector{Int64}: vector of sorting indices

Returns

Nothing

NeuroAnalyzer.standardizeFunction
standardize(s)

Standardize channels.

Arguments

  • s::AbstractArray

Returns

  • s_new::Array{Float64, 3}:
  • scaler::Vector{ZScoreTransform{Float64, Vector{Float64}}}
standardize(obj; <keyword arguments>)

Standardize channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • obj_new::NeuroAnalyzer.NEURO
  • scaler::Vector{ZScoreTransform{Float64, Vector{Float64}}}
NeuroAnalyzer.standardize!Function
standardize!(obj; <keyword arguments>)

Standardize channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • scaler::Vector{ZScoreTransform{Float64, Vector{Float64}}}
NeuroAnalyzer.taperFunction
taper(s; <keyword arguments>)

Taper the signal.

Arguments

  • s::AbstractVector
  • t::Vector{<:Real}

Returns

  • s_new::Vector{Float64}
taper(s; <keyword arguments>)

Taper the signal.

Arguments

  • s::AbstractArray
  • t::Vector{<:Real}

Returns

  • s_new::Array{Float64, 3}
taper(obj; <keyword arguments>)

Taper the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • t::Vector{<:Real}

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.taper!Function
taper!(obj; <keyword arguments>)

Taper the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • t::Vector{<:Real}

Returns

Nothing

NeuroAnalyzer.tconvFunction
tconv(s; <keyword arguments>)

Performs convolution in the time domain.

Arguments

  • s::AbstractVector
  • kernel::AbstractVector

Returns

  • s_new::Vector{Float64}: convoluted signal
tconv(s; <keyword arguments>)

Perform convolution in the time domain.

Arguments

  • s::AbstractArray
  • kernel::AbstractVector: convolution kernel

Returns

  • s_new::Array{Float64, 3}: convoluted signal
tconv(obj; <keyword arguments>)

Perform convolution in the time domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • kernel::AbstractVector: convolution kernel

Returns

  • Union{NeuroAnalyzer.NEURO, Array{ComplexF64, 3}}: convoluted signal
NeuroAnalyzer.tconv!Function
tconv!(obj; <keyword arguments>)

Perform convolution in the time domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • kernel::AbstractVector: convolution kernel
NeuroAnalyzer.upsampleFunction
upsample(obj; <keyword arguments>)

Upsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.upsample!Function
upsample!(obj; <keyword arguments>)

Upsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate

Returns

Nothing

NeuroAnalyzer.wbpFunction
wbp(s; <keyword arguments>)

Perform wavelet band-pass filtering.

Arguments

  • s::AbstractVector
  • pad::Int64: pad with pad zeros
  • frq::Real: filter frequency
  • fs::Int64: sampling rate
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • s_new::Vector{Float64}
wbp(s; <keyword arguments>)

Perform wavelet band-pass filtering.

Arguments

  • s::AbstractArray
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • fs::Int64: sampling rate
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • s_new::Array{Float64, 3}
wbp(obj; <keyword arguments>)

Perform wavelet band-pass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.wbp!Function
wbp!(obj; <keyword arguments>)

Perform wavelet band-pass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

Nothing

Locs

NeuroAnalyzer.add_locsFunction
add_locs(obj; <keyword arguments>)

Add electrode positions from locs.

Electrode locations:

  • labels channel label
  • loc_theta polar angle
  • loc_radius polar radius
  • loc_x Cartesian x
  • loc_y Cartesian y
  • loc_z Cartesian z
  • loc_radius_sph spherical radius
  • loc_theta_sph spherical horizontal angle
  • loc_phi_sph spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • locs::DataFrame

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_locs!Function
add_locs!(obj; <keyword arguments>)

Load electrode positions from locs and return NeuroAnalyzer.NEURO object attached with channel locations data.

Electrode locations:

  • labels: channel label
  • loc_theta: polar angle
  • loc_radius: polar radius
  • loc_x: Cartesian X
  • loc_y: Cartesian Y
  • loc_z: Cartesian Z
  • loc_radius_sph: spherical radius
  • loc_theta_sph: spherical horizontal angle
  • loc_phi_sph: spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • locs::DataFrame

Returns

Nothing

NeuroAnalyzer.cart2polFunction
cart2pol(x, y)

Convert Cartesian coordinates to polar.

Arguments

  • x::Real
  • y::Real

Returns

  • radius::Float64
  • theta::Float64
NeuroAnalyzer.cart2sphFunction
cart2sph(x, y, z)

Convert spherical coordinates to Cartesian.

Arguments

  • x::Real
  • y::Real
  • z::Real

Returns

  • radius::Float64: spherical radius, the distance from the origin to the point
  • theta::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Float64: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
NeuroAnalyzer.edit_locsFunction
edit_locs(obj; <keyword arguments>)

Edit electrode.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • x::Union{Real, Nothing}=nothing: Cartesian X spherical coordinate
  • y::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinate
  • z::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinate
  • theta::Union{Real, Nothing}=nothing: polar angle
  • radius::Union{Real, Nothing}=nothing: polar radius
  • theta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the point
  • phi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
  • name::String="": channel name
  • type::String="": channel type

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_locs!Function
edit_locs!(obj; <keyword arguments>)

Edit electrode.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel number or name
  • x::Union{Real, Nothing}=nothing: Cartesian X spherical coordinate
  • y::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinate
  • z::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinate
  • theta::Union{Real, Nothing}=nothing: polar angle
  • radius::Union{Real, Nothing}=nothing: polar radius
  • theta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the point
  • phi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
  • name::String="": channel name
  • type::String="": channel type

Returns

Nothing

NeuroAnalyzer.locs_cart2polFunction
locs_cart2pol(locs)

Convert Cartesian coordinates to polar.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_cart2sphFunction
locs_cart2sph(locs)

Convert Cartesian coordinates to spherical.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_cart2sph!Function
locs_cart2sph!(locs)

Convert Cartesian coordinates to spherical.

Arguments

  • locs::DataFrame

Returns

Nothing

NeuroAnalyzer.locs_centerFunction
locs_center(locs; <keyword arguments>)

Center locs at (0, 0).

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_center!Function
locs_center!(locs; <keyword arguments>)

Center locs at X=0.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_detailsFunction
locs_details(obj; <keyword arguments>)

Return channel location details.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel name
  • out::Bool=true: if true, print details

Returns

Named tuple containing:

  • label::String: location label
  • theta_pl::Float64: polar angle
  • radius_pl::Float64: polar radius
  • x::Float64: Cartesian X spherical coordinate
  • y::Float64: Cartesian Y spherical coordinate
  • z::Float64: Cartesian Z spherical coordinate
  • theta_sph::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Float64: spherical radius, the distance from the origin to the point
  • phi_sph::Float64: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
NeuroAnalyzer.locs_flipxFunction
locs_flipx(locs; <keyword arguments>)

Flip channel locations along x axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_flipx!Function
locs_flipx!(locs; <keyword arguments>)

Flip channel locations along x axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_flipyFunction
locs_flipy(locs; <keyword arguments>)

Flip channel locations along y axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_flipy!Function
locs_flipy!(locs; <keyword arguments>)

Flip channel locations along y axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_flipzFunction
locs_flipz(locs; <keyword arguments>)

Flip channel locations along z axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_flipz!Function
locs_flipz!(locs; <keyword arguments>)

Flip channel locations along z axis.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_generateFunction
locs_generate(locs)

Generate spherical coordinates according to 10/10 system.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
locs_generate(obj)

Generate spherical coordinates according to 10/5 system.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.locs_generate!Function
locs_generate!(locs)

Generate spherical coordinates according to 10/5 system.

Arguments

  • locs::DataFrame

Returns

Nothing

locs_generate!(obj)

Generate spherical coordinates according to 10/5 system.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Nothing

NeuroAnalyzer.locs_normalizeFunction
locs_normalize(locs; <keyword arguments>)

Normalize channel locations to fit the unit sphere.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_normalize!Function
locs_normalize!(locs; <keyword arguments>)

Normalize channel locations to fit the unit sphere.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_pol2cartFunction
locs_pol2cart(locs)

Convert polar coordinates to Cartesian.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_pol2sphFunction
locs_pol2sph(locs)

Convert polar coordinates to spherical.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_pol2sph!Function
locs_pol2sph!(locs)

Convert polar coordinates to spherical.

Arguments

  • locs::DataFrame

Returns

Nothing

NeuroAnalyzer.locs_rotxFunction
locs_rotx(locs; <keyword arguments>)

Rotate channel locations around the X axis (in the YZ-plane).

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates anti-clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_rotx!Function
locs_rotx!(locs; <keyword arguments>)

Rotate channel locations around the X axis (in the YZ-plane).

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates anti-clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_rotyFunction
locs_roty(locs; <keyword arguments>)

Rotate channel locations around the Y axis (in the XZ-plane).

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_roty!Function
locs_roty!(locs; <keyword arguments>)

Rotate channel locations around the Y axis (in the XZ-plane).

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_rotzFunction
locs_rotz(locs; <keyword arguments>)

Rotate channel locations around the Z axis.

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates anti-clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_rotz!Function
locs_rotz!(locs; <keyword arguments>)

Rotate channel locations in the xy-plane.

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees); positive angle rotates anti-clockwise
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_scaleFunction
locs_scale(locs; <keyword arguments>)

Scale channel locations.

Arguments

  • locs::DataFrame
  • r::Real: scaling factor
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_scale!Function
locs_scale!(locs, r, polar, cart, spherical)

Scale channel locations.

Arguments

  • locs::DataFrame
  • r::Real: scaling factor
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.locs_sph2cartFunction
locs_sph2cart(locs)

Convert spherical coordinates to Cartesian.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_sph2cart!Function
locs_sph2cart!(locs)

Convert spherical coordinates to Cartesian.

Arguments

  • locs::DataFrame

Returns

Nothing

NeuroAnalyzer.locs_sph2polFunction
locs_sph2pol(locs)

Convert spherical coordinates to polar.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_sph2pol!Function
locs_sph2pol!(locs)

Convert Cartesian coordinates to polar.

Arguments

  • locs::DataFrame

Returns

Nothing

NeuroAnalyzer.locs_swapxyFunction
locs_swapxy(locs; <keyword arguments>)

Swap channel locations x and y axes.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.locs_swapxy!Function
locs_swapxy!(locs; <keyword arguments>)

Swap channel locations x and y axes.

Arguments

  • locs::DataFrame
  • polar::Bool=true: modify polar coordinates
  • cart::Bool=true: modify Cartesian coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

Nothing

NeuroAnalyzer.pol2cartFunction
pol2cart(radius, theta)

Convert polar coordinates to Cartesian.

Arguments

  • radius::Real: polar radius, the distance from the origin to the point, in degrees
  • theta::Real: polar angle

Returns

  • x::Float64
  • y::Float64
NeuroAnalyzer.pol2sphFunction
pol2sph(radius, theta)

Convert polar coordinates to spherical.

Arguments

  • radius::Real: polar radius, the distance from the origin to the point, in degrees
  • theta::Real: polar angle

Returns

  • radius::Float64: spherical radius, the distance from the origin to the point
  • theta::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Float64: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
NeuroAnalyzer.sph2cartFunction
sph2cart(radius, theta, phi)

Convert spherical coordinates to Cartesian.

Arguments

  • radius::Real: spherical radius, the distance from the origin to the point
  • theta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Real: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees

Returns

  • x::Float64
  • y::Float64
  • z::Float64
NeuroAnalyzer.sph2polFunction
sph2pol(radius, theta, phi)

Convert spherical coordinates to polar.

Arguments

  • radius::Real: spherical radius, the distance from the origin to the point
  • theta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Real: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees

Returns

  • radius::Real: polar radius, the distance from the origin to the point
  • theta::Real: polar horizontal angle, the angle in the xy plane with respect to the x axis, in degrees

Analyze

NeuroAnalyzer.acorFunction
acor(s; <keyword arguments>)

Calculate auto-correlation.

Arguments

  • s::AbstractVector
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating auto-correlation:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end]) ./ var(s)
    • :cor: acf = cor(s[1:end - l], s[1+l:end]), biased value is ignored
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acor(s; <keyword arguments>)

Calculate auto-correlation.

Arguments

  • s::AbstractMatrix
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating auto-correlation:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end]) ./ var(s)
    • :cor: acf = cor(s[1:end - l], s[1+l:end]), biased value is ignored
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acor(s; <keyword arguments>)

Calculate auto-correlation.

Arguments

  • s::AbstractArray
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating auto-correlation:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end]) ./ var(s)
    • :cor: acf = cor(s[1:end - l], s[1+l:end]), biased value is ignored
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acor(obj; <keyword arguments>)

Calculate auto-correlation. For ERP return trial-averaged auto-correlation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • l::Real=1: lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating auto-correlation:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end]) ./ var(s)
    • :cor: acf = cor(s[1:end - l], s[1+l:end]), biased value is ignored
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

Named tuple containing:

  • ac::Array{Float64, 3}
  • l::Vector{Float64}: lags [s]
NeuroAnalyzer.acovFunction
acov(s; <keyword arguments>)

Calculate autocovariance.

Arguments

  • s::AbstractVector
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing autocovariance
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating autocovariance:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end])
    • :cov: acf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase autocov(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acov(s; <keyword arguments>)

Calculate autocovariance.

Arguments

  • s::AbstractMatrix
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing autocovariance
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating autocovariance:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end])
    • :cor: acf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acov(s; <keyword arguments>)

Calculate autocovariance.

Arguments

  • s::AbstractArray
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing autocovariance
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating autocovariance:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end])
    • :cor: acf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

  • ac::Array{Float64, 3}
acov(obj; <keyword arguments>)

Calculate autocovariance. For ERP return trial-averaged autocovariance.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • l::Int64=1: lags range is 0:lag [samples]
  • demean::Bool=true: demean signal before computing autocovariance
  • biased::Bool=true: calculate biased or unbiased autocovariance
  • method::Symbol=:sum: method of calculating autocovariance:
    • :sum: acf = Σ(s[1:end - l] .* s[1+l:end])
    • :cor: acf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase autocor(), biased value is ignored

Returns

Named tuple containing:

  • ac::Array{Float64, 3}
  • l::Vector{Float64}: lags [s]
NeuroAnalyzer.ampFunction
amp(s)

Calculate amplitudes.

Arguments

  • s::AbstractVector

Returns

Named tuple containing:

  • p::Float64: peak amplitude
  • r::Float64: RMS amplitude
  • p2p::Float64: peak-to-peak amplitude
  • semi_p2p::Float64: half of the peak-to-peak amplitude
  • msa::Float64: mean square amplitude
  • rmsa::Float64: root mean square amplitude
  • energy::Float64: total signal energy
  • rms::Float64: root mean square
amp(s)

Calculate amplitudes.

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • p::Matrix{Float64}: peak amplitude
  • r::Matrix{Float64}: RMS amplitude
  • p2p::Matrix{Float64}: peak-to-peak amplitude
  • semi_p2p::Matrix{Float64}: half of the peak-to-peak amplitude
  • msa::Matrix{Float64}: mean square amplitude
  • rmsa::Matrix{Float64}: root mean square amplitude
  • energy::Matrix{Float64}: total signal energy
amp(obj; <keyword arguments>)

Calculate amplitudes.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • p::Matrix{Float64}: peak amplitude
  • r::Matrix{Float64}: RMS amplitude
  • p2p::Matrix{Float64}: peak-to-peak amplitude
  • semi_p2p::Matrix{Float64}: half of the peak-to-peak amplitude
  • msa::Matrix{Float64}: mean square amplitude
  • rmsa::Matrix{Float64}: root mean square amplitude
  • energy::Matrix{Float64}: total signal energy
NeuroAnalyzer.amp_atFunction
amp_at(obj; <keyword arguments>)

Calculate amplitude at given time.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Real: time in seconds

Returns

  • p::Matrix{Float64}: amplitude for each channel per epoch
NeuroAnalyzer.ampdiffFunction
ampdiff(s; <keyword arguments>)

Calculate amplitude difference between each channel and mean amplitude of reference channels.

Arguments

  • s::AbstractArray
  • ch::Union{Int64, Vector{Int64}}=size(s, 1): index of reference channels, default is all channels except the analyzed one

Returns

  • ad::Array{Float64, 3}
ampdiff(obj; <keyword arguments>)

Calculate amplitude difference between each channel and mean amplitude of reference channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: index of reference channels

Returns

  • ad::Array{Float64, 3}
NeuroAnalyzer.avgamp_atFunction
avgamp_at(obj; <keyword arguments>)

Calculate average amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64}: mean amplitude for each channel per epoch
NeuroAnalyzer.axc2frqFunction
axc2frq(c, l)

Detect peaks in auto-/cross- correlation/covariance and transform them into frequencies.

Arguments

  • c::AbstractVector: auto-/cross- correlation/covariance values
  • l::AbstractVector: lags

Returns

  • frq::Vector{Float64}: list of frequencies dominating in the auto-/cross- correlation/covariance
NeuroAnalyzer.band_asymmetryFunction
band_asymmetry(obj; <keyword arguments>)

Calculate band asymmetry: ln(channel 1 band power) - ln(channel 2 band power).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels, e.g. left frontal channels
  • ch2::Union{String, Vector{String}}: list of channels, e.g. right frontal channels
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • ba::Float64: band asymmetry
  • ba_norm::Float64: normalized band asymmetry
NeuroAnalyzer.band_mpowerFunction
band_mpower(s; <keyword arguments>)

Calculate mean and maximum band power and its frequency.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • mbp::Float64: mean band power
  • maxfrq::Float64: frequency of maximum band power
  • maxbp::Float64: power at maximum band frequency
band_mpower(s; <keyword arguments>)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • mbp::Matrix{Float64}: mean band power per channel per epoch
  • maxfrq::Matrix{Float64}: frequency of maximum band power per channel per epoch
  • maxbp::Matrix{Float64}: power at maximum band frequency per channel per epoch
band_mpower(obj; <keyword arguments>)

Calculate mean and maximum band power and its frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • mbp::Matrix{Float64}: mean band power per channel per epoch
  • maxfrq::Matrix{Float64}: frequency of maximum band power per channel per epoch
  • maxbp::Matrix{Float64}: power at maximum band frequency per channel per epoch
NeuroAnalyzer.band_powerFunction
band_power(s; <keyword arguments>)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • bp::Float64: band power
band_power(s; <keyword arguments>)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • bp::Matrix{Float64}: band power
band_power(obj; <keyword arguments>)

Calculate absolute band power between two frequencies.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • frq_lim::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • bp::Matrix{Float64}: band power
NeuroAnalyzer.coherenceFunction
coherence(s1, s2; <keyword arguments>)

Calculate coherence and MSC (magnitude-squared coherence).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds
  • demean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • coh::Vector{Float64}: coherence
  • mscoh::Vector{Float64}: magnitude-squared coherence
  • f::Vector{Float64}: frequencies
coherence(s1, s2; <keyword arguments>)

Calculate coherence and MSC (magnitude-squared coherence).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds
  • demean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

  • coh::Array{Float64, 3}: coherence
  • mscoh::Array{Float64, 3}: magnitude-squared coherence
  • f::Vector{Float64}: frequencies
coherence(obj1, obj2; <keyword arguments>)

Calculate coherence and MSC (magnitude-squared coherence).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds
  • demean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

  • coh::Array{Float64, 3}: coherence
  • mscoh::Array{Float64, 3}: magnitude-squared coherence
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.cormFunction
corm(s; <keyword arguments>)

Calculate correlation matrix of s * s'.

Arguments

  • s::AbstractVector
  • norm::Bool: normalize correlation matrix

Returns

  • cm::Matrix{Float64}
corm(s1, s2; <keyword arguments>)

Calculate correlation matrix of s1 * s2'.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • norm::Bool: normalize correlation matrix

Returns

  • cm::Matrix{Float64}
corm(s; <keyword arguments>)

Calculate correlation matrix.

Arguments

  • s::AbstractArray
  • norm::Bool=false: normalize covariance

Returns

  • cm::Array{Float64, 4}
 corm(obj; <keyword arguments>)

Calculate correlation matrix.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels
  • norm::Bool=true: normalize matrix

Returns

  • cm::Array{Float64, 4}: correlation matrix for each epoch
NeuroAnalyzer.covmFunction
covm(s; <keyword arguments>)

Calculate covariance matrix of s * s'.

Arguments

  • s::AbstractVector
  • norm::Bool=false: normalize covariance

Returns

  • cm::Matrix{Float64}: covariance matrix
covm(s1, s2; <keyword arguments>)

Calculate covariance matrix of s1 * s2'.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • norm::Bool=false: normalize covariance

Returns

  • cm::Matrix{Float64}: covariance matrix
covm(s; <keyword arguments>)

Calculate covariance matrix.

Arguments

  • s::AbstractArray
  • norm::Bool=false: normalize covariance

Returns

  • cm::Array{Float64, 4}: covariance matrix
covm(obj; <keyword arguments>)

Calculate covariance matrix of signal * signal'.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels
  • norm::Bool=false: normalize matrix

Returns

  • cm::Array{Float64, 4}: covariance matrix for each epoch
NeuroAnalyzer.cphFunction
cph(s1, s2; <keyword arguments>)

Calculate cross-phases.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Vector{Float64}: cross-power spectrum phase (in radians)
  • f::Vector{Float64}: cross-power spectrum frequencies
cph(s; <keyword arguments>)

Calculate cross-phases.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Array{Float64, 4}: cross-power spectrum phase (in radians)
  • f::Vector{Float64}: cross-power spectrum frequencies
cph(s1, s2; <keyword arguments>)

Calculate cross-phases.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Array{Float64, 3}: cross-power spectrum phase (in radians)
  • f::Vector{Float64}: cross-power spectrum frequencies
cph(obj; <keyword arguments>)

Calculate cross-phases.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • ph::Array{Float64, 4}: cross-power spectrum phase (in radians)
  • f::Vector{Float64}: cross-power spectrum frequencies
cph(obj1, obj2; <keyword arguments>)

Calculate cross-phases.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • ph::Array{Float64, 3}: cross-power spectrum phase (in radians)
  • f::Vector{Float64}: cross-power spectrum frequencies
NeuroAnalyzer.cpsdFunction
cpsd(s1, s2; <keyword arguments>)

Calculate cross power spectral density (CPSD).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds
  • demean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • db::Bool=false: normalize do dB

Returns

Named tuple containing:

  • pxy::Vector{Float64}: cross-power spectrum
  • f::Vector{Float64}: frequencies
cpsd(s1, s2; <keyword arguments>)

Calculate cross power spectral density (CPSD).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds
  • demean::Bool=false: if true, the channelwise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • db::Bool=false: normalize do dB

Returns

Named tuple containing:

  • pxy::Array{Float64, 3}: cross-power spectrum
  • f::Vector{Float64}: frequencies
cpsd(obj1, obj2; <keyword arguments>)

Calculate cross power spectral density (CPSD).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
  • method::Symbol=:mt: method used to calculate CPSD:
    • :mt: multi-tapered cross-power spectra
    • :fft: fast Fourier transformation
  • frq_lim::Tuple{Real, Real}=(0, sr(obj1) / 2): frequency bounds
  • demean::Bool=false: if true, the channelwise mean will be subtracted from the input signals before the cross spectral powers are computed
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj1): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • db::Bool=false: normalize do dB

Returns

Named tuple containing:

  • pxy::Array{Float64, 3}: cross-power spectrum
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.cwtpsdFunction
cwtpsd(s; <keyword arguments>)

Calculate power spectrum using continuous wavelet transformation (CWT).

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
  • norm::Bool=true: normalize scaleogram to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal

Returns

Named tuple containing:

  • p::Vector{Float64}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.cwtspectrogramFunction
cwtspectrogram(s; <keyword arguments>)

Calculate scaleogram using continuous wavelet transformation (CWT).

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
  • norm::Bool=true: normalize scaleogram to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal

Returns

Named tuple containing:

  • p::Matrix{Float64}: powers
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time
NeuroAnalyzer.dissFunction
diss(s1, s2)

Calculate DISS (global dissimilarity) and spatial correlation between s1 and s2.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • gd::Float64: global dissimilarity
  • sc::Float64: spatial correlation
diss(s)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
diss(s1, s2)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

Named tuple containing:

  • gd::Matrix{Float64}: global dissimilarity
  • sc::Matrix{Float64}: spatial correlation
diss(obj; <keyword arguments>)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
diss(obj1, obj2; <keyword arguments>)

Calculate DISS (global dissimilarity) and spatial correlation (ch1 of obj1 vs ch2 of obj2)..

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
NeuroAnalyzer.entropyFunction
entropy(s)

Calculate entropy.

Arguments

  • s::AbstractVector

Returns

Named tuple containing:

  • ent::Float64
  • sent::Float64: Shanon entropy
  • leent::Float64: log energy entropy
entropy(s)

Calculate entropy.

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • ent::Matrix{Float64}
  • sent::Matrix{Float64}: Shanon entropy
  • leent::Matrix{Float64}: log energy entropy
entropy(obj; <keyword arguments>)

Calculate entropy.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • ent::Matrix{Float64}
  • sent::Matrix{Float64}: Shanon entropy
  • leent::Matrix{Float64}: log energy entropy
NeuroAnalyzer.env_corFunction
env_cor(env1, env2)

Calculate envelope correlation.

Arguments

  • env1::Array{Float64, 3}
  • env2::Array{Float64, 3}

Returns

Named tuple containing:

  • ec::Vector{Float64}: power correlation value
  • p::Vector{Float64}: p-value
NeuroAnalyzer.env_loFunction
env_lo(s, x; <keyword arguments>)

Calculate lower envelope.

Arguments

  • s::AbstractVector: signal
  • x::AbstractVector: x-axis points
  • d::Int64=32: distance between peeks in points, lower values get better envelope fit

Returns

  • e::Vector{Float64}: envelope
NeuroAnalyzer.env_upFunction
env_up(s, x; <keyword arguments>)

Calculate upper envelope.

Arguments

  • s::AbstractVector: signal
  • x::AbstractVector: x-axis points
  • d::Int64=32: distance between peeks in points, lower values get better envelope fit

Returns

  • e::Vector{Float64}: envelope
NeuroAnalyzer.eropFunction
erop(obj; <keyword arguments>)

Calculate ERO (Event-Related Oscillations) power-spectrum. If obj is ERP, erop() returns two epochs: ERP power-spectrum (s[:, 1]) and averaged power-spectra of all ERP epochs (s[:, 2]). Otherwise, erop() returns averaged power-spectra of all obj epochs (s[:, 1])

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to analyze
  • method::Symbol=:welch: method of calculating power-spectrum:
    • :welch: Welch's periodogram
    • :stft: short time Fourier transform
    • :mt: multi-tapered periodogram
    • :fft: Fast Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • db::Bool=true: normalize powers to dB
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • p::Matrix{Float64}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.erosFunction
eros(obj; <keyword arguments>)

Calculate ERO (Event-Related Oscillations) spectrogram. If obj is ERP, eros() returns two epochs: ERP spectrogram (s[:, :, 1]) and averaged spectrograms of all ERP epochs (s[:, :, 2]). Otherwise, eros() returns averaged spectrograms of all obj epochs (s[:, :, 1])

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to analyze
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length, default is 4 seconds
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • pad::Int64=0: number of zeros to add
  • db::Bool=true: normalize powers to dB
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • s::Array{Float64, 3}: spectrogram(s)
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time
NeuroAnalyzer.erp_peaksFunction
erp_peaks(obj)

Detect a pair of positive and negative peaks of ERP.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • p::Matrix{Int64}: peaks: channels × positive peak position, negative peak position
NeuroAnalyzer.frqinstFunction
frqinst(s; <keyword arguments>)

Calculate instantaneous frequency.

Arguments

  • s::AbstractVector

Returns

  • f::Vector{Float64}
frqinst(s; <keyword arguments>)

Calculate instantaneous frequency.

Arguments

  • s::AbstractVector

Returns

  • f::Array{Float64, 3}
frqinst(obj; <keyword arguments>)

Calculate instantaneous frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • f::Array{Float64, 3}
NeuroAnalyzer.gedFunction
ged(s1, s2)

Perform generalized eigendecomposition.

Arguments

  • s1::AbstractMatrix: signal to be analyzed
  • s2::AbstractMatrix: original signal

Returns

Named tuple containing:

  • sged::Matrix{Float64}
  • ress::Vector{Float64}
  • ress_norm::Vector{Float64}: RESS normalized to -1..1
ged(obj1, obj2; <keyword arguments>)

Perform generalized eigendecomposition.

Arguments

  • obj1::NeuroAnalyzer.NEURO: signal data to be analyzed
  • obj2::NeuroAnalyzer.NEURO: original signal data
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • sged::Array{Float64, 3}
  • ress::Matrix{Float64}
  • ress_norm::Matrix{Float64}: RESS normalized to -1..1
NeuroAnalyzer.gfpFunction
gfp(s)

Calculate GFP (Global Field Power).

Arguments

  • s::AbstractVector

Returns

  • gfp::Float64
NeuroAnalyzer.gfp_normFunction
gfp_norm(s)

Calculate signal normalized for GFP (Global Field Power).

Arguments

  • s::AbstractVector

Returns

  • gfp_norm::Vector{Float64}
NeuroAnalyzer.ghpsdFunction
ghpsd(s; <keyword arguments>)

Calculate power spectrum using Gaussian and Hilbert transform.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • db::Bool=true: normalize powers to dB
  • gw::Real=5: Gaussian width in Hz
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • p::Vector{Float64}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.ghspectrogramFunction
ghspectrogram(s; <keyword arguments>)

Calculate spectrogram using Gaussian and Hilbert transform.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • db::Bool=true: normalize powers to dB
  • gw::Real=5: Gaussian width in Hz
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • p::Matrix{Float64}: powers
  • ph::Matrix{Float64}: phases
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time
NeuroAnalyzer.henvFunction
henv(obj; <keyword arguments>)

Calculate Hilbert spectrum amplitude envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env::Array{Float64, 3}: Hilbert spectrum amplitude envelope
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_loFunction
henv_lo(s)

Calculate lower envelope using Hilbert transform.

Arguments

  • s::AbstractVector: signal

Returns

  • e::Vector{Float64}: envelope
NeuroAnalyzer.henv_meanFunction
henv_mean(obj; <keyword arguments>)

Calculate Hilbert spectrum amplitude envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env_m::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: mean
  • h_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper bound
  • h_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_medianFunction
henv_median(obj; <keyword arguments>)

Calculate Hilbert spectrum amplitude envelope of obj: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env_m::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: median
  • h_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper bound
  • h_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_upFunction
henv_up(s)

Calculate upper envelope using Hilbert transform.

Arguments

  • s::AbstractVector: signal

Returns

  • e::Vector{Float64}: envelope
NeuroAnalyzer.hjorthFunction
hjorth(s)

Calculate Hjorths parameters.

Arguments

  • s::AbstractVector

Returns

Named tuple containing:

  • h_act::Float64: activity
  • h_mob::Float64: mobility
  • h_comp::Float64: complexity

Notes:

  • Activity: the total power of the signal
  • Mobility: an estimate of the mean frequency
  • Complexity: indicates the similarity of the shape of the signal to a pure sine wave
hjorth(s)

Calculate Hjorths parameters.

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • h_act::Matrix{Float64}: activity
  • h_mob::Matrix{Float64}: mobility
  • h_comp::Matrix{Float64}: complexity

Notes:

  • Activity: the total power of the signal
  • Mobility: an estimate of the mean frequency
  • Complexity: indicates the similarity of the shape of the signal to a pure sine wave
hjorth(obj)

Calculate Hjorths parameters.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • h_act::Matrix{Float64}: activity
  • h_mob::Matrix{Float64}: mobility
  • h_comp::Matrix{Float64}: complexity

Notes:

  • Activity: the total power of the signal
  • Mobility: an estimate of the mean frequency
  • Complexity: indicates the similarity of the shape of the signal to a pure sine wave
NeuroAnalyzer.hrv_analyzeFunction
hrv_analyze(nn_seg)

Analyze heart rate variability (HRV).

Arguments

  • nn_seg::Vector{Float64}: list of NN segments [msec]

Returns

Named tuple containing:

  • menn::Float64: the mean of NN segments
  • mdnn::Float64: the median of NN segments
  • vnn::Float64: the variance of NN segments
  • sdnn::Float64: the standard deviation of NN segments
  • rmssd::Float64: ("root mean square of successive differences"), the square root of the mean of the squares of the successive differences between adjacent NNs
  • sdsd::Float64: ("standard deviation of successive differences"), the standard deviation of the successive differences between adjacent NNs
  • nn50::Float64: the number of pairs of successive NNs that differ by more than 50 ms
  • pnn50::Float64, the proportion of NN50 divided by total number of NNs
  • nn20::Float64, the number of pairs of successive NNs that differ by more than 20 ms
  • pnn20::Float64, the proportion of NN20 divided by total number of NNs
NeuroAnalyzer.hrv_detectFunction
hrv_detect(obj)

Detect heart rate variability (HRV). Requires ECG channel (which will be automatically detected based on channel_type field).

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • nn_seg::Vector{Float64}: list of NN segments [msec]
  • r_idx::Vector{Float64}: index of R peaks
NeuroAnalyzer.hspectrumFunction
hspectrum(s; <keyword arguments>)

Calculate amplitudes, powers and phases using Hilbert transform.

Arguments

  • s::AbstractVector
  • pad::Int64: number of zeros to add at the end of the signal
  • db::Bool=false: normalize powers to dB

Returns

Named tuple containing:

  • c::Vector{ComplexF64}: Hilbert components
  • a::Vector{Float64}: amplitudes
  • p::Vector{Float64}: powers
  • ph::Vector{Float64}: phases
hspectrum(s; <keyword arguments>)

Calculate amplitudes, powers and phases using Hilbert transform.

Arguments

  • s::AbstractArray
  • pad::Int64: number of zeros to add at the end of the signal
  • db::Bool=false: normalize powers to dB

Returns

Named tuple containing:

  • c::Array{ComplexF64, 3}: Hilbert components
  • a::Array{Float64, 3}: amplitudes
  • p::Array{Float64, 3}: powers
  • ph::Array{Float64, 3}: phases
NeuroAnalyzer.ispcFunction
ispc(s1, s2)

Calculate ISPC (Inter-Site-Phase Clustering) between s1 and s2.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • ispc_val::Float64: ISPC value
  • ispc_ang::Float64: ISPC angle
  • s_diff::Vector{Float64}: signal difference (s2 - s1)
  • ph_diff::Vector{Float64}: phase difference (s2 - s1)
  • s1_phase::Vector{Float64}: signal 1 phase
  • s2_phase::Vector{Float64}: signal 2 phase
ispc(obj; <keyword arguments>)

Calculate ISPCs (Inter-Site-Phase Clustering).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • ispc_val::Array{Float64, 3}: ISPC value matrices over epochs
  • ispc_ang::Array{Float64, 3}: ISPC angle matrices over epochs
ispc(obj1, obj2; <keyword arguments>)

Calculate ISPC (Inter-Site-Phase Clustering).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • ispc_val::Matrix{Float64}: ISPC value
  • ispc_ang::Matrix{Float64}: ISPC angle
  • s_diff::Array{Float64, 3}: signal difference (s2 - s1)
  • ph_diff::Array{Float64, 3}: phase difference (s2 - s1)
  • s1_phase::Array{Float64, 3}: signal 1 phase
  • s2_phase::Array{Float64, 3}: signal 2 phase
NeuroAnalyzer.itpcFunction
itpc(s; <keyword arguments>)

Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.

Arguments

  • s::AbstractArray: one channel over epochs
  • t::Int64: time point (sample number) at which ITPC is calculated
  • w::Union{AbstractVector, Nothing}: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_val::Float64: ITPC value
  • itpcz_val::Float64: Rayleigh's ITPC z value
  • itpc_ang::Float64: ITPC angle
  • itpc_ph::Vector{Float64}: phases at time t averaged across trials/epochs
itpc(obj; <keyword arguments>)

Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • t::Int64: time point (sample number) at which ITPC is calculated
  • w::Union{Vector{<:Real}, Nothing}=nothing: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_val::Vector{Float64}: ITPC or wITPC value
  • itpcz_val::Vector{Float64}: Rayleigh's ITPC z value
  • itpc_ang::Vector{Float64}: ITPC angle
  • itpc_ph::Matrix{Float64}: phase difference (channel2 - channel1)
NeuroAnalyzer.itpc_specFunction
itpc_spec(s; <keyword arguments>)

Calculate spectrogram of ITPC (Inter-Trial-Phase Clustering).

Arguments

  • s::AbstractArray: one channel over epochs
  • w::Union{AbstractVector, Nothing}: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_val::Vector{Float64}: ITPC values
  • itpcz_val::Vector{Float64}: Rayleigh's ITPC z values
  • itpc_ang::Vector{Float64}: ITPC angles
  • itpc_ph::Matrix{Float64}: phases at time t averaged across trials/epochs
itpc_spec(obj; <keyword arguments>)

Calculate spectrogram of ITPC (Inter-Trial-Phase Clustering).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::String: channel to analyze
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds for the spectrogram
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies scaling
  • w::Union{Vector{<:Real}, Nothing}=nothing: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_s::Matrix{Float64}: spectrogram of ITPC values
  • itpcz_s::Matrix{Float64}: spectrogram of ITPCZ values
  • itpc_f::Vector{Float64}: frequencies list
NeuroAnalyzer.maxamp_atFunction
maxamp_at(obj; <keyword arguments>)

Calculate maximum amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64}: maximum amplitude for each channel per epoch
NeuroAnalyzer.mep_peaksFunction
mep_peaks(obj)

Detect a pair of positive and negative peaks of MEP.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • p::Matrix{Int64}: peaks: channels × positive peak position, negative peak position
NeuroAnalyzer.minamp_atFunction
minamp_at(obj; <keyword arguments>)

Calculate minimum amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64}: minimum amplitude for each channel per epoch
NeuroAnalyzer.mutual_informationFunction
mutual_information(s1, s2)

Calculate mutual information.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

  • mutual_information::Float64
mutual_information(s1, s2)

Calculate mutual information (channels of s1 vs channels of s2).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • m::Matrix{Float64}
mutual_information(s)

Calculate mutual information (channels vs channels).

Arguments

  • s::AbstractArray

Returns

  • m::Array{Float64, 3}
mutual_information(obj; <keyword arguments>)

Calculate mutual information between channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels

Returns

  • m::Array{Float64, 3}
mutual_information(obj1, obj2; <keyword arguments>)

Calculate mutual information between two channels.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

  • m::Matrix{Float64}
NeuroAnalyzer.mwpsdFunction
mwpsd(s; <keyword arguments>)

Calculate power spectrum using Morlet wavelet convolution.

Arguments

  • s::AbstractVector
  • pad::Int64=0: pad with pad zeros
  • db::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • p::Vector{Float64}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.mwspectrogramFunction
mwspectrogram(s; <keyword arguments>)

Calculate spectrogram using wavelet convolution.

Arguments

  • s::AbstractVector
  • pad::Int64: pad with pad zeros
  • db::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • cs::Matrix{ComplexF64}: convoluted signal
  • p::Matrix{Float64}: powers
  • ph::Matrix{Float64}: phases
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time
NeuroAnalyzer.negentropyFunction
negentropy(signal)

Calculate negentropy.

Arguments

  • signal::AbstractVector

Returns

  • negent::Float64
negentropy(s)

Calculate negentropy.

Arguments

  • s::AbstractArray

Returns

  • ne::Matrix{Float64}
negentropy(obj; <keyword arguments>)

Calculate negentropy.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • ne::Matrix{Float64}
NeuroAnalyzer.pacorFunction
pacor(s; <keyword arguments>)

Calculate partial auto-correlation.

Arguments

  • s::AbstractVector
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • method::Symbol=:yw: method of calculating auto-correlation:
    • :yw: computes the partial autocorrelations using the Yule-Walker equations
    • :reg: computes the partial autocorrelations via successive regression models

Returns

  • pac::Array{Float64, 3}

Notes

If you get ERROR: PosDefException: matrix is not positive definite; Cholesky factorization failed., try lowering l value or change method to :yw.

pacor(s; <keyword arguments>)

Calculate partial auto-correlation.

Arguments

  • s::AbstractMatrix
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • method::Symbol=:yw: method of calculating auto-correlation:
    • :yw: computes the partial autocorrelations using the Yule-Walker equations
    • :reg: computes the partial autocorrelations via successive regression models

Returns

  • pac::Array{Float64, 3}
pacor(s; <keyword arguments>)

Calculate partial auto-correlation.

Arguments

  • s::AbstractArray
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • method::Symbol=:yw: method of calculating auto-correlation:
    • :yw: computes the partial autocorrelations using the Yule-Walker equations
    • :reg: computes the partial autocorrelations via successive regression models

Returns

  • pac::Array{Float64, 3}
pacor(obj; <keyword arguments>)

Calculate partial auto-correlation. For ERP return trial-averaged auto-correlation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • l::Real=1: lags range is -l:l
  • demean::Bool=true: demean signal before computing auto-correlation
  • method::Symbol=:yw: method of calculating auto-correlation:
    • :yw: computes the partial autocorrelations using the Yule-Walker equations
    • :reg: computes the partial autocorrelations via successive regression models

Returns

Named tuple containing:

  • pac::Array{Float64, 3}
  • l::Vector{Float64}: lags [s]
NeuroAnalyzer.peak_frqFunction
peak_frq(s; <keyword arguments>)

Calculate peak frequency in a band.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)

Returns

  • pf::Float64: peak frequency
peak_frq(s; <keyword arguments>)

Calculate peak frequency in a band.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)

Returns

  • pf::Matrix{Float64}: peak frequency
peak_frq(obj; <keyword arguments>)

Calculate peak frequency in a band.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)

Returns

  • pf::Matrix{Float64}: peak frequency
NeuroAnalyzer.penvFunction
penv(obj; <keyword arguments>)

Calculate power (in dB) envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)

Returns

Named tuple containing:

  • p_env::Array{Float64, 3}: power spectrum envelope
  • p_env_frq::Vector{Float64}: frequencies for each envelope
NeuroAnalyzer.penv_meanFunction
penv_mean(obj; <keyword arguments>)

Calculate power (in dB) envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)

Returns

Named tuple containing:

  • p_env_m::Array{Float64, 3}: power spectrum envelope: mean
  • p_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper bound
  • p_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower bound
  • p_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.penv_medianFunction
penv_median(obj; <keyword arguments>)

Calculate power (in dB) envelope: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: median over channels (dims = 1) or epochs (dims = 2)
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)

Returns

Named tuple containing:

  • p_env_m::Array{Float64, 3}: power spectrum envelope: median
  • p_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper bound
  • p_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower bound
  • p_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.phdiffFunction
phdiff(s1, s2; <keyword arguments>)

Calculate phase difference between signals.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • pad::Int64=0: number of zeros to add
  • h::Bool=false: use FFT or Hilbert transformation (if h=true)

Returns

Named tuple containing:

  • phd::Vector{Float64}: phase differences in radians
phdiff(s; <keyword arguments>)

Calculate phase difference between channels and mean phase of reference ch.

Arguments

  • s::AbstractArray
  • ch::Union{Int64, Vector{Int64}}=_c(size(s, 1)): index of reference channels, default is all channels except the analyzed one
  • avg::Symbol=:phase: method of averaging:
    • :phase: phase is calculated for each reference channel separately and then averaged
    • :signal: signals are averaged prior to phase calculation
  • pad::Int64=0: pad signals with 0s
  • h::Bool=false: use FFT or Hilbert transformation

Returns

  • phd::Array{Float64, 3}
phdiff(obj; <keyword arguments>)

Calculate phase difference between channels and mean phase of reference ch.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: index of reference channels
  • avg::Symbol=:phase: method of averaging:
    • :phase: phase is calculated for each reference channel separately and then averaged
    • :signal: signals are averaged prior to phase calculation
  • pad::Int64=0: pad signals with 0s
  • h::Bool=false: use FFT or Hilbert transformation

Returns

  • phd::Array{Float64, 3}
NeuroAnalyzer.phsdFunction
phsd(s; <keyword arguments>)

Calculate phase spectral density.

Arguments

  • s::Vector{Float64}
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Vector{Float64}: phases
  • f::Vector{Float64}: frequencies
phsd(s; <keyword arguments>)

Calculate phase spectral density.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Matrix{Float64}: phases
  • f::Vector{Float64}: frequencies
phsd(s; <keyword arguments>)

Calculate phase spectral density.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • ph::Array{Float64, 3}: phases
  • f::Vector{Float64}: frequencies
phsd(obj; <keyword arguments>)

Calculate phase spectral density.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Named tuple containing:

  • ph::Array{Float64, 3}: phases
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.pliFunction
pli(s1, s2)

Calculate PLI (Phase-Lag Index).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • pv::Float64: PLI value
  • sd::Vector{Float64}: signal difference (s2 - s1)
  • phd::Vector{Float64}: phase difference (s2 - s1)
  • s1ph::Vector{Float64}: signal 1 phase
  • s2ph::Vector{Float64}: signal 2 phase
pli(obj1, obj2; <keyword arguments>)

Calculate PLI (Phase Lag Index).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • pv::Matrix{Float64}: PLI value
  • sd::Array{Float64, 3}: signal difference (s2 - s1)
  • phd::Array{Float64, 3}: phase difference (s2 - s1)
  • s1ph::Array{Float64, 3}: signal 1 phase
  • s2ph::Array{Float64, 3}: signal 2 phase
pli(obj; <keyword arguments>)

Calculate PLIs (Phase Lag Index).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • pv::Array{Float64, 3}: PLI value matrices over epochs
NeuroAnalyzer.psdFunction
psd(s; <keyword arguments>)

Calculate power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::Vector{Float64}
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB; for CWT power spectrum: normalize to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • p::Vector{Float64}: powers
  • f::Vector{Float64}: frequencies
psd(s; <keyword arguments>)

Calculate power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • p::Matrix{Float64}: powers
  • f::Vector{Float64}: frequencies
psd(s; <keyword arguments>)

Calculate power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • p::Array{Float64, 3}: powers
  • f::Vector{Float64}: frequencies
psd(obj; <keyword arguments>)

Calculate power spectrum density. Default method is Welch's periodogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • p::Array{Float64, 3}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.psd_relFunction
psd_rel(s; <keyword arguments>)

Calculate relative power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • pw::Vector{Float64}: powers
  • pf::Vector{Float64}: frequencies
psd_rel(s; <keyword arguments>)

Calculate relative power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
psd_rel(s; <keyword arguments>)

Calculate relative power spectrum density. Default method is Welch's periodogram.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • db::Bool=false: normalize do dB
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
psd_rel(obj::NeuroAnalyzer.NEURO; <keyword arguments>) where {T <: CWT}

Calculate relative power spectrum density. Default method is Welch's periodogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • db::Bool=false: normalize do dB
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Array{Float64, 3}: frequencies
NeuroAnalyzer.psd_slopeFunction
psd_slope(s; <keyword arguments>)

Calculate PSD linear fit and slope. Default method is Welch's periodogram.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency range frq_lim[1] to frq_lim[2]
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • lf::Vector{Float64}: linear fit
  • ls::Float64: slopes of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
psd_slope(s; <keyword arguments>)

Calculate PSD linear fit and slope. Default method is Welch's periodogram.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency range frq_lim[1] to frq_lim[2]
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • lf::Matrix{Float64}: linear fit
  • s::Vector{Float64}: slope of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
psd_slope(obj; <keyword arguments>)

Calculate PSD linear fit and slope. Default method is Welch's periodogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): calculate slope of the total power (default) or frequency range frqlim[1] to frqlim[2]
  • db::Bool=false: normalize do dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • lf::Array{Float64, 3}: linear fit
  • ls::Matrix{Float64}: slope of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
NeuroAnalyzer.rmseFunction
rmse(s1, s2)

Calculate Root Mean Square Error (RMSE).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

  • r::Float64: RMSE
rmse(s1, s2)

Calculate Root Mean Square Error (RMSE).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • r::Matrix{Float64}: RMSE
rmse(obj1, obj2; <keyword arguments>)

Calculate Root Mean Square Error (RMSE).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch1::Union{String, Vector{String}}: list of channels
  • `ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

  • r::Matrix{Float64}: RMSE
NeuroAnalyzer.sefFunction
sef(s; <keyword arguments>)

Calculate spectral edge frequency (SEF) – the frequency below which x percent of the total power of a given signal are located; typically, x is in the range 75 to 95.

Arguments

  • s::AbstractVector
  • x::Float64=0.95: threshold
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}=(0, fs / 2): lower and upper frequency bounds, default is total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)

Returns

  • sef_frq::Float64: spectral edge frequency
sef(s; <keyword arguments>)

Calculate spectral edge frequency (SEF) – the frequency below which x percent of the total power of a given signal are located; typically, x is in the range 75 to 95.

Arguments

  • s::AbstractArray
  • x::Float64=0.95: threshold
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}=(0, fs / 2): lower and upper frequency bounds, default is total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)

Returns

  • sef_frq::Matrix{Float64}: spectral edge frequency
sef(obj; <keyword arguments>)

Calculate spectral edge frequency (SEF) – the frequency below which x percent of the total power of a given signal are located; typically, x is in the range 75 to 95.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • x::Float64=0.95: threshold
  • f::Tuple{Real, Real}=(0, sr(obj) / 2): lower and upper frequency bounds, default is total power
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)

Returns

  • sef_frq::Matrix{Float64}: spectral edge frequency
NeuroAnalyzer.senvFunction
senv(obj; <keyword arguments>)

Calculate spectral envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • pad::Int64=0: number of zeros to add
  • db::Bool=true: normalize powers to dB
  • nt::Int64=7: number of Slepian tapers
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • s_env::Array{Float64, 3}: spectral envelope
  • s_env_t::Vector{Float64}: spectrogram time
NeuroAnalyzer.senv_meanFunction
senv_mean(obj; <keyword arguments>)

Calculate spectral envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • pad::Int64=0: number of zeros to add
  • db::Bool=true: normalize powers to dB
  • nt::Int64=7: number of Slepian tapers
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • s_env_m::Array{Float64, 3}: spectral envelope: mean
  • s_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bound
  • s_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bound
  • s_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.senv_medianFunction
senv_median(obj; <keyword arguments>)

Calculate spectral envelope: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • pad::Int64=0: number of zeros to add
  • db::Bool=true: normalize powers to dB
  • nt::Int64=7: number of Slepian tapers
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • s_env_m::Array{Float64, 3}: spectral envelope: median
  • s_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bound
  • s_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bound
  • s_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.snrFunction
snr(s)

Calculate mean-based SNR.

Arguments

  • s::AbstractVector

Returns

  • snr::Float64: SNR

Source

D. J. Schroeder (1999). Astronomical optics (2nd ed.). Academic Press. ISBN 978-0-12-629810-9, p.278

snr(s; <keyword arguments>)

Calculate SNR.

Arguments

  • s::AbstractArray
  • t::Vector{Float64}: epoch time
  • type::Symbol=:rms: SNR type:
    • :mean: mean-based
    • :rms: RMS-based

Returns

Named tuple containing:

  • sn::Matrix{Float64}: SNR for each channel over frequencies 1:Nyquist
  • f::Vector{Float64}: frequencies
snr(obj; <keyword arguments>)

Calculate SNR.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • type::Symbol=:rms: SNR type:
    • :mean: mean-based
    • :rms: RMS-based

Returns

Named tuple containing:

  • sn::Matrix{Float64}: SNR for each channel over frequencies 1:Nyquist
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.snr2Function
snr2(s)

Calculate RMS-based SNR.

Arguments

  • s::AbstractVector

Returns

  • snr2::Float64: SNR
NeuroAnalyzer.spectrogramFunction
spectrogram(s; <keyword arguments>)

Calculate spectrogram. Default method is short time Fourier transform.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling frequency
  • db::Bool=true: normalize powers to dB
  • method::Symbol=:stft: method used to calculate PSD:
    • :stft: short time Fourier transform
    • :mt: multi-tapered periodogram
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length, default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • p::Matrix{Float64}: powers
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time
spectrogram(obj; <keyword arguments>)

Calculate spectrogram. Default method is short time Fourier transform.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • db::Bool=true: normalize powers to dB; for CWT scaleogram: normalize to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal
  • nt::Int64=7: number of Slepian tapers
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window

Returns

Named tuple containing:

  • p::Array{Float64, 4}: powers
  • f::Vector{Float64}: frequencies
  • t::Vector{Float64}: time points
NeuroAnalyzer.spectrumFunction
spectrum(s; <keyword arguments>)

Calculate FFT, amplitudes, powers and phases.

Arguments

  • s::AbstractVector
  • pad::Int64=0: number of zeros to add at the end of the signal
  • db::Bool=false: normalize powers to dB

Returns

Named tuple containing:

  • ft::Vector{ComplexF64}: Fourier transforms
  • a::Vector{Float64}: amplitudes
  • p::Vector{Float64}: powers
  • ph::Vector{Float64}: phases
spectrum(s; <keyword arguments>)

Calculate FFT/Hilbert transformation components, amplitudes, powers and phases.

Arguments

  • s::AbstractArray
  • pad::Int64=0: number of zeros to add signal for FFT
  • h::Bool=false: use Hilbert transform for calculations instead of FFT
  • db::Bool=false: normalize powers to dB

Returns

Named tuple containing:

  • c::Array{ComplexF64, 3}: Fourier or Hilbert components
  • a::Array{Float64, 3}: amplitudes
  • p::Array{Float64, 3}: powers
  • `ph::Array{Float64, 3}: phase angles
spectrum(obj; <keyword arguments>)

Calculate FFT/Hilbert transformation components, amplitudes, powers and phases.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • pad::Int64=0: number of zeros to add signal for FFT
  • h::Bool=false: use Hilbert transform for calculations instead of FFT
  • db::Bool=false: normalize powers to dB

Returns

Named tuple containing:

  • c::Array{ComplexF64, 3}: Fourier or Hilbert components
  • a::Array{Float64, 3}: amplitudes
  • p::Array{Float64, 3}: powers
  • `ph::Array{Float64, 3}: phase angles
NeuroAnalyzer.stationarityFunction
stationarity(obj; <keyword arguments>)

Calculate stationarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels
  • window::Int64=10: time window in samples
  • method::Symbol=:euclid: stationarity method:
    • :mean: mean across window-long windows
    • :var: variance across window-long windows
    • :cov: covariance stationarity based on Euclidean distance between covariance matrix of adjacent time windows
    • :hilbert: phase stationarity using Hilbert transformation
    • :adf: Augmented Dickey–Fuller test; returns ADF-test value and p-value (H0: signal is non-stationary; p-value < alpha means that signal is stationary)

Returns

  • s::Union{Matrix{Float64}, Array{Float64, 3}}
NeuroAnalyzer.stationarity_hilbertFunction
stationarity_hilbert(s)

Calculate phase stationarity using Hilbert transformation.

Arguments

  • s::AbstractVector

Returns

  • stph::Vector{Float64}
NeuroAnalyzer.stationarity_meanFunction
stationarity_mean(s; <keyword arguments>)

Calculate mean stationarity. Signal is split into window-long windows and averaged across windows.

Arguments

  • s::AbstractVector
  • window::Int64: time window in samples

Returns

  • stm::Vector{Float64}
NeuroAnalyzer.stationarity_varFunction
stationarity_var(s; <keyword arguments>)

Calculate variance stationarity. Signal is split into window-long windows and variance is calculated across windows.

Arguments

  • s::AbstractVector
  • window::Int64: time window in samples

Returns

  • stv::Vector{Float64}
NeuroAnalyzer.symmetryFunction
symmetry(s)

Calculate signal symmetry (ratio of positive to negative amplitudes). Perfectly symmetrical signal has symmetry of 1.0. Symmetry above 1.0 indicates there are more positive amplitudes.

Arguments

  • s::AbstractVector

Returns

  • sym::Float64: signal symmetry
symmetry(s)

Calculate signal symmetry (ratio of positive to negative amplitudes). Perfectly symmetrical signal has symmetry of 1.0. Symmetry above 1.0 indicates there are more positive amplitudes.

Arguments

  • s::AbstractArray

Returns

  • sym::Matrix{Float64}: signal symmetry
symmetry(obj; <keyword arguments>)

Calculate signal symmetry (ratio of positive to negative amplitudes). Perfectly symmetrical signal has symmetry of 1.0. Symmetry above 1.0 indicates there are more positive amplitudes.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

  • sym::Matrix{Float64}: signal symmetry
NeuroAnalyzer.tenvFunction
tenv(obj; <keyword arguments>)

Calculate temporal envelope (amplitude).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env::Array{Float64, 3}: temporal envelope
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_meanFunction
tenv_mean(obj; <keyword arguments>)

Calculate temporal envelope (amplitude): mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env_m::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: mean
  • t_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper bound
  • t_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_medianFunction
tenv_median(obj; <keyword arguments>)

Calculate temporal envelope (amplitude): median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env_m::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: median
  • t_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper bound
  • t_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.tkeoFunction
tkeo(s, t; <keyword arguments>)

Calculate Teager-Kaiser energy-tracking operator.

Arguments

  • s::AbstractVector: signal
  • t::AbstractVector=collect(1:length(s)): time points
  • method::Symbol=:pow:
    • :pow: TKEO = x(t)^2 - x(t-1) × x(t+1)
    • :der: TKEO = f'(t) - f(t) × f''(t)
    • :amp: TKEO = envelope(amplitude)^2

Returns

  • tk::Vector{Float64}
tkeo(s, t; <keyword arguments>)

Calculate Teager-Kaiser energy-tracking operator

Arguments

  • s::AbstractArray: signal
  • t::AbstractArray=collect(1:length(s)): time points
  • method::Symbol=:pow:
    • :pow: TKEO = x(t)^2 - x(t-1) × x(t+1)
    • :der: TKEO = f'(t) - f(t) × f''(t)
    • :amp: TKEO = envelope(amplitude)^2

Returns

  • tk::Array{Float64, 3}
tkeo(obj; <keyword arguments>)

Calculate Teager-Kaiser energy-tracking operator.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels
  • method::Symbol=:pow:
    • :pow: TKEO = x(t)^2 - x(t-1) × x(t+1)
    • :der: TKEO = f'(t) - f(t) × f''(t)
    • :amp: TKEO = envelope(amplitude)^2

Returns

  • tk::Array{Float64, 3}
NeuroAnalyzer.total_powerFunction
total_power(s; <keyword arguments>)

Calculate total power.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • tp::Float64: total power
total_power(s; <keyword arguments>)

Calculate total power.

`# Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(fs / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • tp::Matrix{Float64}: total power
total_power(obj, ch, method, nt, wlen, woverlap, w, ncyc, gw, wt)

Calculate total power.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • tp::Matrix{Float64}: total power
NeuroAnalyzer.xcorFunction
xcor(s1, s2; <keyword arguments>)

Calculate cross-correlation.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • l::Int64=round(Int64, min(length(s1) - 1, 10 * log10(length(s1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-correlation
  • biased::Bool=true: calculate biased or unbiased cross-correlation
  • method::Symbol=:sum: method of calculating cross-correlation:
    • :sum: acf = Σ(s1[1:end - l] .* s1[1+l:end]) ./ (std(s1) × std(s2))
    • :cor: acf = cor(s1[1:end - l], s2[1+l:end]), biased value is ignored
    • :stat: use StatsBase crosscor(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcor(s1, s2; <keyword arguments>)

Calculate cross-correlation.

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • l::Int64=round(Int64, min(size(s1[1, :, 1], 1) - 1, 10 * log10(size(s1[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-correlation
  • biased::Bool=true: calculate biased or unbiased cross-correlation
  • method::Symbol=:sum: method of calculating cross-correlation:
    • :sum: acf = Σ(s1[1:end - l] .* s1[1+l:end]) ./ var(s)
    • :cor: acf = cor(s1[1:end - l], s2[1+l:end])
    • :stat: use StatsBase crosscor(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcor(s1, s2; <keyword arguments>)

Calculate cross-correlation.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • l::Int64=round(Int64, min(size(s1[1, :, 1], 1) - 1, 10 * log10(size(s1[1, :, 1], 1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-correlation
  • biased::Bool=true: calculate biased or unbiased cross-correlation
  • method::Symbol=:sum: method of calculating cross-correlation:
    • :sum: acf = Σ(s1[1:end - l] .* s1[1+l:end]) ./ var(s)
    • :cor: acf = cor(s1[1:end - l], s2[1+l:end])
    • :stat: use StatsBase crosscor(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcor(obj1, obj2; <keyword arguments>)

Calculate cross-correlation. For ERP return trial-averaged cross-correlation.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
  • l::Real=1: lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-correlation
  • biased::Bool=true: calculate biased or unbiased cross-correlation
  • method::Symbol=:sum: method of calculating cross-correlation:
    • :sum: acf = Σ(s1[1:end - l] .* s1[1+l:end]) ./ var(s)
    • :cor: acf = cor(s1[1:end - l], s2[1+l:end])
    • :stat: use StatsBase crosscor(), biased value is ignored

Returns

Named tuple containing:

  • xc::Array{Float64, 3}: cross-correlation
  • l::Vector{Float64}: lags [s]
NeuroAnalyzer.xcovFunction
xcov(s1, s2; <keyword arguments>)

Calculate cross-covariance.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • l::Int64=round(Int64, min(length(s1) - 1, 10 * log10(length(s1)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-covariance
  • biased::Bool=true: calculate biased or unbiased cross-covariance
  • method::Symbol=:sum: method of calculating cross-covariance:
    • :sum: xcf = Σ(s[1:end - l] .* s[1+l:end])
    • :cov: xcf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase crosscov(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcov(s1, s2; <keyword arguments>)

Calculate cross-covariance.

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-covariance
  • biased::Bool=true: calculate biased or unbiased cross-covariance
  • method::Symbol=:sum: method of calculating cross-covariance:
    • :sum: xcf = Σ(s[1:end - l] .* s[1+l:end])
    • :cov: xcf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase crosscov(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcov(s1, s2; <keyword arguments>)

Calculate cross-covariance.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2)))): lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-covariance
  • biased::Bool=true: calculate biased or unbiased cross-covariance
  • method::Symbol=:sum: method of calculating cross-covariance:
    • :sum: xcf = Σ(s[1:end - l] .* s[1+l:end])
    • :cov: xcf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase crosscov(), biased value is ignored

Returns

  • xc::Array{Float64, 3}
xcov(obj1, obj2; <keyword arguments>)

Calculate cross-covariance. For ERP return trial-averaged cross-covariance.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
  • l::Real=1: lags range is -l:l
  • demean::Bool=true: demean signal before computing cross-covariance
  • biased::Bool=true: calculate biased or unbiased cross-covariance
  • method::Symbol=:sum: method of calculating cross-covariance:
    • :sum: xcf = Σ(s[1:end - l] .* s[1+l:end])
    • :cov: xcf = cov(s[1:end - l], s[1+l:end])
    • :stat: use StatsBase crosscov(), biased value is ignored

Returns

Named tuple containing:

  • xc::Array{Float64, 3}: cross-covariance
  • l::Vector{Float64}: lags [s]

Plot

NeuroAnalyzer.add_plot_locsFunction
add_plot_locs(p1, p2; <keyword arguments>)

Add locations to a plot. Locations are placed in the top right corner. If file_name is provided, the plot is saved as PNG file.

Arguments

  • p1::Plots.Plot{Plots.GRBackend}: signal plot
  • p2::Plots.Plot{Plots.GRBackend}: locations plot
  • view::Bool=true: view the output image
  • file_name::String="": output image filename

Returns

  • c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.add_to_canvasFunction
add_to_canvas(c1, c2; <keyword arguments>)

Place CairoSurfaceBase at another canvas at x, y. If file_name is provided, the plot is saved as PNG file.

Arguments

  • c1::Cairo.CairoSurfaceBase{UInt32}
  • c2::Cairo.CairoSurfaceBase{UInt32}
  • x::Int64
  • y::Int64
  • title::String="": title of the subplot
  • view::Bool=true: view the output image
  • file_name::String="": output image filename

Returns

  • c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.add_topmargin_canvasFunction
add_topmargin_canvas(c1, c2)

Resize CairoSurfaceBase to make space for another canvas

Arguments

  • c1::Cairo.CairoSurfaceBase{UInt32}
  • c2::Cairo.CairoSurfaceBase{UInt32}

Returns

  • c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.plotFunction
plot(obj; <keyword arguments>)

Plot signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title
  • mono::Bool=false: use color or gray palette
  • emarkers::Bool: draw epoch markers if available
  • markers::Bool: draw markers if available
  • scale::Bool=true: draw scale
  • type::Symbol=:normal: plot type:
    • :normal
    • :mean: mean ± 95%CI
    • :butterfly: butterfly plot
  • avg::Bool=false: plot average EDA
  • bad::Bool=false: plot bad channels
  • s_pos::Tuple{Real, Real}=(0, 0): draw segment borders if different than (0, 0), used by iedit()
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot(obj, c; <keyword arguments>)

Plot embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title
  • mono::Bool=false: use color or gray palette
  • emarkers::Bool: draw epoch markers if available
  • scale::Bool=true: draw scale
  • type::Symbol=:normal: plot type:
    • :normal
    • :mean: mean ± 95%CI
    • :butterfly: butterfly plot
  • avg::Bool=false: plot average EDA
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot(obj1, obj2; <keyword arguments>)

Plot signal.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title
  • scale::Bool=true: draw scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot2canvasFunction
plot2canvas(c)

Convert Plots.Plot to CairoSurfaceBase.

Arguments

  • p::Plots.Plot{Plots.GRBackend}

Returns

  • c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.plot_barFunction
plot_bar(s; <keyword arguments>)

Bar plot.

Arguments

  • s::AbstractVector
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_boxFunction
plot_box(s; <keyword arguments>)

Box plot.

Arguments

  • s::AbstractArray
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_ciFunction
plot_ci(s, s_ci_l, s_ci_h; <keyword arguments>)

Dots plot.

Arguments

  • s::AbstractVector: signal
  • s_l::AbstractVector: CI lower bound
  • s_u::AbstractVector: CI upper bound
  • t::AbstractVector: time points
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_coherenceFunction
plot_coherence(coh, f; <keyword arguments>)

Plot coherence.

Arguments

  • coh::Vector{Float64}: coherence
  • f::Vector{Float64}: frequencies
  • frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axis
  • xlabel::String="Frequency [Hz]": x-axis label
  • ylabel::String="Coherence": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling:
    • :linlin: linear-linear
    • :loglin: log10-linear
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_coherence(coh, f; <keyword arguments>)

Plot multi-channel coherence.

Arguments

  • coh::Matrix{Float64}: coherence
  • f::Vector{Float64}: frequencies
  • clabels::Vector{String}=[""]: channel pairs labels vector
  • frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axis
  • xlabel::String="Frequency [Hz]": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling:
    • :linlin: linear-linear
    • :loglin: log10-linear
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_coherence_avgFunction
plot_coherence_avg(coh, f; <keyword arguments>)

Plot coherence mean and ±95% CI of averaged channels.

Arguments

  • coh::Matrix{Float64}: coherence
  • f::Vector{Float64}: frequencies
  • clabels::Vector{String}=[""]: channel pairs labels vector
  • frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axis
  • xlabel::String="Frequency [Hz]": x-axis label
  • ylabel::String="Coherence": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling:
    • :linlin: linear-linear
    • :loglin: log10-linear
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_coherence_butterflyFunction
plot_coherence_butterfly(coh, f; <keyword arguments>)

Butterfly PSD plot.

Arguments

  • coh::Array{Float64, 3}: coherence
  • f::Vector{Float64}: frequencies
  • clabels::Vector{String}=[""]: signal channel labels vector
  • `frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the x-axis
  • xlabel::String="Frequency [Hz]": x-axis label
  • ylabel::String="Coherence": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling:
    • :linlin: linear-linear
    • :loglin: log10-linear
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_composeFunction
plot_compose(p; <keyword arguments>)

Compose a complex plot of various plots contained in vector p using layout layout. Layout scheme is:

  • (2, 2): 2 × 2 plots, regular layout
  • grid(4, 1, heights=[0.6, 0.1, 0.1, 0.1]: 4 × 1 plots, irregular layout
  • @layout [a{0.2w} b{0.8w};_ c{0.6}]: complex layout using Plots.jl @layout macro

Arguments

  • p::Vector{Plots.Plot{Plots.GRBackend}}: vector of plots
  • layout::Union(Matrix{Any}, Tuple{Int64, Int64}, Plots.GridLayout}: layout
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for p vector plots

Returns

  • pc::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_dipole2dFunction
plot_dipole2d(d; <keyword arguments>)

Plot dipole in 2D.

Arguments

  • d::NeuroAnalyzer.DIPOLE

Returns

  • p::Plots.Plot{Plots.GRBackend}

Notes

Brain volume is within -1.0 to +1.0 (X-, Y- and Z-axis)

NeuroAnalyzer.plot_dipole3dFunction
plot_dipole3d(d; <keyword arguments>)

Plot dipole in 3D.

Arguments

  • d::NeuroAnalyzer.DIPOLE
  • project::Bool=true: plot lines projected onto X, Y and Z axes

Returns

  • p::Plots.Plot{Plots.GRBackend}

Notes

Brain volume is within -1.0 to +1.0 (X-, Y- and Z-axis)

NeuroAnalyzer.plot_dotsFunction
plot_dots(s; <keyword arguments>)

Dots plot.

Arguments

  • s::Vector{Vector{Float64}}
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_edaFunction
plot_eda(t, s, bad; <keyword arguments>)

Plot EDA.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractVector: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_eda(t, s, bad; <keyword arguments>)

Plot EDA.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractMatrix: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eda_avgFunction
plot_eda_avg(t, s; <keyword arguments>)

Plot EDA amplitude mean and ±95% CI.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eda_butterflyFunction
plot_eda_butterfly(t, s; <keyword arguments>)

Butterfly plot of EDA.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • avg::Bool=false: plot average EDA
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_emptyFunction
plot_empty()

Return an empty plot, useful for filling matrices of plots.

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eropFunction
plot_erop(p, f; <keyword arguments>)

Plot ERO (Event-Related Oscillations) power-spectrum.

Arguments

  • p::AbstractArray: ERO powers
  • f::AbstractVector: ERO frequencies
  • db::Bool=true: whether ERO powers are normalized to dB
  • xlabel::String="default"
  • ylabel::String="default"
  • title::String="default"
  • frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the Y-axis
  • ax::Symbol=:linlin: type of axes scaling:
    • :linlin: linear-linear
    • :loglin: log10-linear
    • :linlog: linear-log10
    • :loglog: log10-log10
  • units::String="μV"
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erosFunction
plot_eros(s, f, t; <keyword arguments>)

Plot ERO (Event-Related Oscillations) spectrogram.

Arguments

  • s::AbstractArray: ERO spectrogram
  • f::AbstractVector: ERO frequencies
  • t::AbstractVector: ERO time
  • db::Bool=true: whether ERO powers are normalized to dB
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the Y-axis
  • tm::Union{Int64, Vector{Int64}}=0: time markers (in milliseconds) to be plot as vertical lines, useful for adding topoplots at these time points
  • xlabel::String="default"
  • ylabel::String="default"
  • title::String="default"
  • cb::Bool=true: draw color bar
  • mono::Bool=false: use color or gray palette
  • units::String="μV"
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erpFunction
plot_erp(t, s, bad; <keyword arguments>)

Plot ERP/ERF.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractVector: data to plot
  • rt::Union{Nothing, Real}=nothing:: response time value
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_erp(obj; <keyword arguments>)

Plot ERP/ERF.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • tm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time points
  • xlabel::String="default": x-axis label, default is Time [ms]
  • ylabel::String="default": y-axis label, default is Amplitude [units]
  • title::String="default": plot title, default is ERP amplitude [channel: 1, epochs: 1:2, time window: -0.5 s:1.5 s]
  • cb::Bool=true: plot color bar
  • cb_title::String="default": color bar title, default is Amplitude [units]
  • mono::Bool=false: use color or gray palette
  • peaks::Bool=true: draw peaks
  • channel_labels::Bool=true: draw labels legend (using channel labels) for multi-channel :butterfly plot
  • type::Symbol=:normal: plot type:
    • :normal
    • :butterfly: butterfly plot
    • :topo: topographical plot of ERPs
    • :stack: stacked epochs/channels
  • yrev::Bool=false: reverse Y axis
  • avg::Bool=false: plot average ERP for :butterfly plot
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • rt::Union{Nothing, Real, AbstractVector}=nothing: response time for each epoch; if provided, the response time line will be plotted over the :stack plot
  • sort_epochs::Bool=false:: sort epochs by rt vector
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_avgFunction
plot_erp_avg(t, s; <keyword arguments>)

Plot ERP/ERF amplitude mean and ±95% CI.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • rt::Union{Nothing, Real}=nothing:: response time value
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_butterflyFunction
plot_erp_butterfly(t, s; <keyword arguments>)

Butterfly plot of ERP.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • rt::Union{Nothing, Real}=nothing:: response time value
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • avg::Bool=false: plot average ERP
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_stackFunction
plot_erp_stack(s; <keyword arguments>)

Plot EPRs stacked by channels or by epochs.

Arguments

  • t::AbstractVector: x-axis values
  • s::AbstractArray
  • rt::Union{Nothing, AbstractVector}=nothing: response time for each epoch; if provided, the response time line will be plotted over the :stack plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • cb::Bool=true: plot color bar
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or gray palette
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_topoFunction
plot_erp_topo(locs, t, s; <keyword arguments>)

Plot topographical map ERPs.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • t::Vector{Float64}: time vector
  • s::Matrix{Float64}: ERPs
  • ch::Union{Vector{Int64}, AbstractRange}: which channels to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • yrev::Bool=false: reverse Y axis
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_filter_responseFunction
plot_filter_response(<keyword arguments>)

Plot filter response.

Arguments

  • fs::Int64: sampling rate
  • fprototype::Symbol: filter prototype:
    • :butterworth
    • :chebyshev1
    • :chebyshev2
    • :elliptic
    • :fir
    • :iirnotch: second-order IIR notch filter
    • :remez: Remez FIR filter
  • ftype::Union{Symbol, Nothing}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}: filter cutoff in Hz (tuple for :bp and :bs)
  • n::Int64=2560: signal length in samples
  • fs::Int64: sampling rate
  • order::Int64=8: filter order (6 dB/octave), number of taps for :remez, attenuation (× 4 dB) for :fir filters
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • w::Union{Nothing, AbstractVector, Int64}=nothing: window for :fir filter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb) or weights for :firls filter
  • mono::Bool=false: use color or gray palette
  • `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the Y-axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_histogramFunction
plot_histogram(s; <keyword arguments>)

Plot histogram.

Arguments

  • s::AbstractVector
  • x::Union{Nothing, Real}=nothing: value to plot against the histogram
  • type::Symbol: type of histogram: regular (:hist) or kernel density (:kd)
  • bins::Union{Int64, Symbol, AbstractVector}=(length(s) ÷ 10): histogram bins: number of bins, range or :sturges, :sqrt, :rice, :scott or :fd)
  • label::String="": channel label
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • draw_mean::Bool=true
  • draw_median::Bool=true
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_icatopoFunction
plot_icatopo(obj; <keyword arguments>)

Topographical plot of embedded ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_icatopo(obj, ic, ic_mw; <keyword arguments>)

Topographical plot of external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_lineFunction
plot_line(s; <keyword arguments>)

Line plot.

Arguments

  • s::AbstractVector
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_line(s; <keyword arguments>)

Line plot.

Arguments

  • s::AbstractArray
  • rlabels::Vector{String}: signal rows labels
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locsFunction
plot_locs(locs; <keyword arguments>)

Preview channel locations.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}, AbstractRange}=1:nrow(locs): list of locations to plot, default is all locations
  • selected::Union{Int64, Vector{Int64}, AbstractRange}=0: which channels should be highlighted
  • ch_labels::Bool=true: plot locations labels
  • head::Bool=true: draw head
  • head_labels::Bool=false: plot head labels
  • mono::Bool=false: use color or gray palette
  • grid::Bool=false: draw grid, useful for locating positions
  • large::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plot
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • plane::Symbol=:xy: which plane to plot:
    • :xy: horizontal (top)
    • :xz: coronary (front)
    • :yz: sagittal (side)
  • transparent::Bool=false: if true, do not paint the background
  • connections::Matrix{<:Real}=[0 0; 0 0]: matrix of connections weights (channels by channels)
  • threshold::Real=0: threshold for plotting, see below
  • threshold_type::Symbol=:neq: rule for thresholding:
    • :eq: plot if connection weight is equal to threshold
    • :neq: plot if connection weight is not equal to threshold
    • :geq: plot if connection weight is ≥ to threshold
    • :leq: plot if connection weight is ≤ to threshold
    • :g: plot if connection weight is > to threshold
    • :l: plot if connection weight is < to threshold
  • weights::Union{Bool, Vector{<:Real}}=true: weight line widths and alpha based on connection value, if false connections values will be drawn or vector of weights

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_locs(obj; <keyword arguments>)

Preview of channel locations.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • selected::Union{String, Vector{String}}: which channels should be highlighted
  • ch_labels::Bool=true: plot channel labels
  • src_labels::Bool=false: plot source labels
  • det_labels::Bool=false: plot detector labels
  • opt_labels::Bool=false: plot optode type (S for source, D for detector) and number
  • head::Bool=true: draw head
  • head_labels::Bool=false: plot head labels
  • threed::Bool=false: 3-dimensional plot
  • mono::Bool=false: use color or gray palette
  • grid::Bool=false: draw grid, useful for locating positions
  • large::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plot
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • plane::Symbol=:xy: which plane to plot:
    • :xy: horizontal (top)
    • :xz: coronary (front)
    • :yz: sagittal (side)
  • interactive::Bool=true: if true, use interactive 3-dimensional plot
  • transparent::Bool=false: if true, do not paint the background
  • connections::Matrix{<:Real}=[0 0; 0 0]: matrix of connections weights (channels by channels)
  • threshold::Real=0: threshold for plotting, see below
  • threshold_type::Symbol=:neq: rule for thresholding:
    • :eq: plot if connection weight is equal to threshold
    • :neq: plot if connection weight is not equal to threshold
    • :geq: plot if connection weight is ≥ to threshold
    • :leq: plot if connection weight is ≤ to threshold
    • :g: plot if connection weight is > to threshold
    • :l: plot if connection weight is < to threshold
  • weights::Union{Bool, Vector{<:Real}}=true: weight line widths and alpha based on connection value, if false connections values will be drawn or vector of weights

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs3dFunction
plot_locs3d(locs; <keyword arguments>)

3D preview of channel locations.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}}=1:nrow(locs): list of channels, default is all channels
  • selected::Union{Int64, Vector{Int64}, AbstractRange}=0: which channel should be highlighted
  • ch_labels::Bool=true: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or gray palette
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinates
  • camera::Tuple{Real, Real}=(20, 45): camera position – (XY plane angle, XZ plane angle)

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs_nirsFunction
plot_locs_nirs(locs; <keyword arguments>)

Preview of NIRS optodes and channel locations. It uses Cartesian :loc_x and :loc_y locations.

Arguments

  • locs::DataFrame: columns: labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • opt_pairs::Matrix{Int64}: pairs of source and detector
  • src_n::Int64: number of sources
  • det_n::Int64: number of detectors
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • src_labels::Bool=false: plot source labels
  • det_labels::Bool=false: plot detector labels
  • opt_labels::Bool=false: plot optode type (S for source, D for detector) and number
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or gray palette
  • grid::Bool=false: draw grid, useful for locating positions
  • plot_size::Int64=400: plot dimensions in pixels (size × size)

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_matrixFunction
plot_matrix(m; <keyword arguments>)

Plot matrix.

Arguments

  • m::Array{<:Real, 2}
  • xlabels::Vector{String}
  • ylabels::Vector{String}
  • xlabel::String=""
  • ylabel::String=""
  • title::String=""
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mepFunction
plot_mep(t, s, bad; <keyword arguments>)

Plot MEP.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractVector: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_mep(obj; <keyword arguments>)

Plot MEP.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • tm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time points
  • xlabel::String="default": x-axis label, default is Time [ms]
  • ylabel::String="default": y-axis label, default is Amplitude [units]
  • title::String="default": plot title, default is MEP amplitude [channel: 1, epochs: 1:2, time window: -0.5 s:1.5 s]
  • cb::Bool=true: plot color bar
  • cb_title::String="default": color bar title, default is Amplitude [units]
  • mono::Bool=false: use color or gray palette
  • peaks::Bool=true: draw peaks
  • peaks_detect::Bool=true: if true, detect MEP peaks, otherwise use embedded
  • channel_labels::Bool=true: draw labels legend (using channel labels) for multi-channel :butterfly plot
  • type::Symbol=:normal: plot type: :normal, butterfly plot (:butterfly), topographical plot of ERPs (:topo) or stacked epochs/channels (:stack)
  • yrev::Bool=false: reverse Y axis
  • avg::Bool=false: plot average MEP for :butterfly plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_avgFunction
plot_mep_avg(t, s; <keyword arguments>)

Plot MEP amplitude mean and ±95% CI.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_butterflyFunction
plot_mep_butterfly(t, s; <keyword arguments>)

Butterfly plot of MEP.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • avg::Bool=false: plot average MEP
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_stackFunction
plot_mep_stack(s; <keyword arguments>)

Plot EPRs stacked by channels or by epochs.

Arguments

  • t::AbstractVector: x-axis values
  • s::AbstractArray
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • cb::Bool=true: plot color bar
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_pairedFunction
plot_paired(signal; <keyword arguments>)

Plot paired data.

Arguments

  • signal::Vector{Vector{Float64}}
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsdFunction
plot_phsd(sf, sp; <keyword arguments>)

Plot PHSD (phase spectral density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Vector{Float64}:phases
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_phsd(sf, sp; <keyword arguments>)

Plot multi-channel PHSD (phase spectral density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Matrix{Float64}:phases
  • clabels::Vector{String}=[""]: signal channel labels vector
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_phsd(obj; <keyword arguments>)

Plot phase spectral density.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Phase [rad]
  • zlabel::String="default": z-axis label for 3-d plots, default is Phase [rad]
  • title::String="default": plot title, default is PHSD [frequency limit: 0-128 Hz] [channel: 1, epoch: 1, time window: 0 ms:10 s]
  • mono::Bool=false: use color or gray palette
  • type::Symbol=:normal: plot type: :normal, :butterfly, :mean, 3-d waterfall (:w3d), 3-d surface (:s3d), topographical (:topo)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_phsd(obj; <keyword arguments>)

Plot phase spectral density of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Phase [rad]
  • zlabel::String="default": z-axis label for 3-d plots, default is Phase [rad]
  • title::String="default": plot title, default is PHSD [frequency limit: 0-128 Hz] [channel: 1, epoch: 1, time window: 0 ms:10 s]
  • mono::Bool=false: use color or gray palette
  • type::Symbol=:normal: plot type: :normal, :butterfly, :mean, 3-d waterfall (:w3d), 3-d surface (:s3d), topographical (:topo)
  • units::String=""
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsd_3dFunction
plot_phsd_w3d(sf, sp; <keyword arguments>)

Plot 3-d waterfall PHSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}:phases
  • clabels::Vector{String}=[""]: signal channel labels vector
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • zlabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • variant::Symbol: waterfall (:w) or surface (:s)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsd_avgFunction
plot_phsd_avg(sf, sp; <keyword arguments>)

Plot PHSD mean and ±95% CI of averaged channels.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}:phases
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsd_butterflyFunction
plot_phsd_butterfly(sf, sp; <keyword arguments>)

Butterfly PHSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}:phases
  • clabels::Vector{String}=[""]: signal channel labels vector
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsd_topoFunction
plot_phsd_topo(locs, sf, sp; <keyword arguments>)

Plot topographical map PHSDs.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}:phases
  • ch::Union{Vector{Int64}, AbstractRange}: which channels to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin)
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_polarFunction
plot_polar(s; <keyword arguments>)

Polar plot.

Arguments

  • s::Union{AbstractVector, AbstractArray}
  • m::Tuple{Real, Real}=(0, 0): major value to plot
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psdFunction
plot_psd(sf, sp; <keyword arguments>)

Plot PSD (power spectrum density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Vector{Float64}: powers
  • db::Bool=true: whether powers are normalized to dB
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_psd(sf, sp; <keyword arguments>)

Plot multi-channel PSD (power spectrum density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Matrix{Float64}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • db::Bool=true: whether powers are normalized to dB
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_psd(obj; <keyword arguments>)

Plot power spectrum density.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • db::Bool=true: normalize powers to dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
  • ref::Symbol=:abs: type of PSD reference: absolute power (no reference) (:abs) or relative to: total power (:total), :delta, :theta, :alpha, :beta, :beta_high, :gamma, :gamma_1, :gamma_2, :gamma_lower or :gamma_higher
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Power [dB units^2/Hz] or Power [units^2/Hz]
  • zlabel::String="default": z-axis label for 3-d plots, default is Power [dB units^2/Hz] or Power [units^2/Hz]
  • title::String="default": plot title, default is PSD [frequency limit: 0-128 Hz] [channel: 1, epoch: 1, time window: 0 ms:10 s]
  • mono::Bool=false: use color or gray palette
  • type::Symbol=:normal: plot type:
    • :normal
    • :butterfly
    • :mean
    • :w3d: 3-d waterfall
    • :s3d: 3-d surface
    • :topo: topographical
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_psd(obj; <keyword arguments>)

Plot power spectrum density of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • db::Bool=true: normalize powers to dB
  • method::Symbol=:welch: method used to calculate PSD:
    • :welch: Welch's periodogram
    • :fft: fast Fourier transform
    • :mt: multi-tapered periodogram
    • :stft: short time Fourier transform
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=fs: window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • gw::Real=5: Gaussian width in Hz
  • wt::T where {T <: CWT}=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
  • ref::Symbol=:abs: type of PSD reference: absolute power (no reference) (:abs) or relative to: total power (:total), :delta, :theta, :alpha, :beta, :beta_high, :gamma, :gamma_1, :gamma_2, :gamma_lower or :gamma_higher
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Power [dB units^2/Hz] or Power [units^2/Hz]
  • zlabel::String="default": z-axis label for 3-d plots, default is Power [dB units^2/Hz] or Power [units^2/Hz]
  • title::String="default": plot title, default is PSD [frequency limit: 0-128 Hz] [channel: 1, epoch: 1, time window: 0 ms:10 s]
  • mono::Bool=false: use color or gray palette
  • type::Symbol=:normal: plot type:
    • :normal
    • :butterfly
    • :mean
    • :w3d: 3-d waterfall
    • :s3d: 3-d surface
    • :topo: topographical
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_3dFunction
plot_psd_w3d(sf, sp; <keyword arguments>)

Plot 3-d waterfall PSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • db::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • zlabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • variant::Symbol: waterfall (:w) or surface (:s)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_avgFunction
plot_psd_avg(sf, sp; <keyword arguments>)

Plot PSD mean and ±95% CI of averaged channels.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Matrix{Float64}: powers
  • db::Bool=true: whether powers are normalized to dB
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_butterflyFunction
plot_psd_butterfly(sf, sp; <keyword arguments>)

Butterfly PSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • db::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_topoFunction
plot_psd_topo(locs, sf, sp; <keyword arguments>)

Plot topographical map PSDs.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • ch::Union{Vector{Int64}, AbstractRange}: which channels to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • db::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_saveFunction
plot_save(p; <keyword arguments>)

Saves plot as file (PNG/PDF). File format is determined using file_name extension.

Arguments

  • p::Plots.Plot{Plots.GRBackend}
  • file_name::String

Returns

Nothing

NeuroAnalyzer.plot_signalFunction
plot_signal(t, s; <keyword arguments>)

Plot amplitude of single-channel signal.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractVector: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • bad::Bool=false: is this a bad channel
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_signal(t, s; <keyword arguments>)

Plot amplitude of multi-channel signal.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=repeat([""], size(s, 1)): channel labels
  • ctypes:::Vector{String}=repeat([""], size(s, 1)): channel types
  • cunits::Vector{String}=repeat([""], size(s, 1)): channel units
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • scale::Bool=true: draw scale
  • bad::Vector{Bool}=zeros(Bool, size(s, 1)): list of bad channels
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_signal(t, s1, s2; <keyword arguments>)

Plot amplitude of single-channel signal.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s1::AbstractVector: data to plot
  • s2::AbstractVector: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_signal(t, s1, s2; <keyword arguments>)

Plot amplitude of multi-channel signals.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s1::AbstractArray: data to plot
  • s2::AbstractArray: data to plot
  • clabels::Vector{String}=repeat([""], size(s1, 1)): channel labels
  • ctypes:::Vector{String}=repeat([""], size(s1, 1)): channel types
  • cunits::Vector{String}=repeat([""], size(s1, 1)): channel units
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • scale::Bool=true: draw scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_avgFunction
plot_signal_avg(t, signal; <keyword arguments>)

Plot amplitude mean and ±95% CI of averaged signal channels.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_butterflyFunction
plot_signal_butterfly(t, s; <keyword arguments>)

Butterfly plot of s channels.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • avg::Bool=false: plot average channels
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogramFunction
plot_spectrogram(st, sf, sp; <keyword arguments>)

Plot single-channel spectrogram.

Arguments

  • st::Vector{Float64}: time
  • sf::Vector{<:Real}: frequencies
  • sp::Matrix{Float64}: powers
  • db::Bool=true: whether powers are normalized to dB
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • units::String=""
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_spectrogram(sch, sf, sp; <keyword arguments>)

Plot multiple-channel spectrogram.

Arguments

  • sch::Vector{String}: channel labels
  • sf::Vector{<:Real}: frequencies
  • sp::Matrix{Float64}: powers
  • db::Bool=true: whether powers are normalized to dB
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • units::String=""
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_spectrogram(obj; <keyword arguments>)

Plots spectrogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • db::Bool=true: normalize powers to dB; for CWT scaleogram: normalize to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): y-axis limits
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is Frequency [Hz]
  • title::String="default": plot title, default is Spectrogram [frequency limit: 0-128 Hz]

[channel: 1, epoch: 1, time window: 0 ms:10 s]

  • mono::Bool=false: use color or gray palette
  • markers::Bool: draw markers if available
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_spectrogram(obj, c; <keyword arguments>)

Plots spectrogram of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Union{Symbol, AbstractArray}: component to plot
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • db::Bool=true: normalize powers to dB; for CWT scaleogram: normalize to the signal scale so the amplitudes of wavelet coefficients agree with the amplitudes of oscillatory components in a signal
  • method::Symbol=:stft: method of calculating spectrogram:
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • nt::Int64=7: number of Slepian tapers
  • wlen::Int64=sr(obj): window length (in samples), default is 1 second
  • woverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)
  • w::Bool=true: if true, apply Hanning window
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=32: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=linspace(ncyc[1], ncyc[2], frq_n), where frq_n is the length of 0:(sr(obj) / 2)
  • wt<:CWT=wavelet(Morlet(2π), β=32, Q=128): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=32, Q=128), see ContinuousWavelets.jl documentation for the list of available wavelets
  • frq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scaling
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): y-axis limits
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is Frequency [Hz]
  • title::String="default": plot title, default is Spectrogram [frequency limit: 0-128 Hz]

[component: 1, epoch: 1, time window: 0 ms:10 s]

  • mono::Bool=false: use color or gray palette
  • markers::Bool: draw markers if available
  • units::String=""
  • smooth::Bool=false: smooth the image using Gaussian blur
  • n::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_topoFunction
plot_topo(c; <keyword arguments>)

Plot topographical view.

Arguments

  • s::Vector{<:Real}: values to plot (one value per channel)
  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}}=1:nrow(locs): list of channels, default is all channels
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • large::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plot
  • head::Bool=true: draw head
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_topo(obj; <keyword arguments>)

Topographical plot.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • title::String="default": plot title, default is Amplitude topographical plot [channels: 1:19, epoch: 1, time window: 0 ms:20 s]
  • mono::Bool=false: use color or gray palette
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • large::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plot
  • head::Bool=true: draw head
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
plot_topo(obj; <keyword arguments>)

Topographical plot of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • title::String="default": plot title, default is Amplitude topographical plot [channels: 1:19, epoch: 1, time window: 0 ms:20 s]
  • mono::Bool=false: use color or gray palette
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • large::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plot
  • head::Bool=true: draw head
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planes
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_violinFunction
plot_violin(s; <keyword arguments>)

Violin plot.

Arguments

  • s::AbstractArray
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_xacFunction
plot_xac(m, lags; <keyword arguments>)

Plot cross/auto-covariance/correlation.

Arguments

  • m::Abstractvector: covariance matrix
  • lags::AbstractVector: covariance lags
  • xlabel::String="lag"
  • ylabel::String=""
  • title::String=""
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or gray palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.resize_canvasFunction
resize_canvas(c; <keyword arguments>)

Resize CairoSurfaceBase by a factor.

Arguments

  • c::Cairo.CairoSurfaceBase{UInt32}
  • r::Real: resizing factor

Returns

  • c_new::Cairo.CairoSurfaceBase{UInt32}

GUI

NeuroAnalyzer.ieditFunction
iedit(obj; <keyword arguments>)

Interactive edit signal channels properties and locations.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::String: initial channel

Returns

Nothing

NeuroAnalyzer.iplot_locs3dFunction
iplot_locs3d(locs; <keyword arguments>)

3D interactive preview of channel locations.

Arguments

  • locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}}=1:nrow(locs): channel(s) to plot, default is all channels
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • ch_labels::Bool=true: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or gray palette
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinates
  • camera::Tuple{Real, Real}=(20, 45): camera position – (XY plane angle, XZ plane angle)

Returns

Nothing

iplot_locs3d(obj; <keyword arguments>)

3D interactive preview of channel locations.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}=1:nrow(locs): channel(s) to plot, default is all channels
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • ch_labels::Bool=true: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or gray palette
  • cart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinates
  • camera::Tuple{Real, Real}=(20, 45): camera position – (XY plane angle, XZ plane angle)

Returns

Nothing

NeuroAnalyzer.ipsdFunction
ipsd(obj; <keyword arguments>)

Interactive PSD of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::String: channel name
  • zoom::Real=10: how many seconds are displayed in one segment

Returns

Nothing

NeuroAnalyzer.ipsd_epFunction
ipsd_ep(obj, ch)

Interactive PSD of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::String: channel name

Returns

Nothing

NeuroAnalyzer.iselect_segFunction
iselect_seg(m; <keyword arguments>)

Interactive selection of matrix area.

Arguments

  • m::AbstractMatrix
  • shape::Symbol=:r: selection shape:
    • :r: rectangular
    • :c: circular
    • :p: point
  • extract::Bool=false: if true, return values of the matrix
  • v::Bool=false: if true, return as vector (matrix m by rows over columns)

Returns

  • r1::Int64: upper-left corner
  • r2::Int64: bottom-right corner
  • c1::Int64: upper-left corner
  • c2::Int64: bottom-right corner

or

  • seg::Union{AbstractMatrix, AbstractVector, Tuple{AbstractVector, AbstractVector}}: extracted segment
NeuroAnalyzer.ispectrogramFunction
ispectrogram(obj; <keyword arguments>)

Interactive spectrogram of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::String: channel name
  • zoom::Real=10: how many seconds are displayed in one segment

Returns

Nothing

NeuroAnalyzer.ispectrogram_epFunction
ispectrogram_ep(obj; <keyword arguments>)

Interactive spectrogram of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::String: channel name

Returns

Nothing

NeuroAnalyzer.itopoFunction
itopo(obj; <keyword arguments>)

Interactive topographical map of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channels to plot

Returns

Nothing

NeuroAnalyzer.itopo_epFunction
itopo_ep(obj; <keyword arguments>)

Interactive topographical map of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channels to plot

Returns

Nothing

NeuroAnalyzer.iviewFunction
iview(obj; <keyword arguments>)

Interactive view of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • mch::Bool=true: draw multichannel signal (up to 20 channels in one plot)
  • zoom::Real=10: how many seconds are displayed in one segment
  • bad::Bool=true: list of bad channels; if not false – plot bad channels using this list
  • snap::Bool=true: snap region markers to grid at 0.0, 0.25, 0.5 and 0.75 time points

Returns

  • seg::Union{Nothing, Tuple{Float64, Float64}}
iview(obj1, obj2; <keyword arguments>)

Interactive view of two continuous signals.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • zoom::Real=10: how many seconds are displayed in one segment

Returns

Nothing

iview(obj, c; <keyword arguments>)

Interactive view of embedded or external component of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • zoom::Real=10: how many seconds are displayed in one segment

Returns

Nothing

iview(p)

View plot object.

Arguments

  • p::Plots.Plot{Plots.GRBackend}

Returns

Nothing

iview(file_name)

View PNG image.

Arguments

  • file_name::String

Returns

Nothing

iview(c)

View Cairo surface object.

Arguments

  • c::Cairo.CairoSurfaceBase{UInt32}

Returns

Nothing

NeuroAnalyzer.iview_epFunction
iview_ep(obj; <keyword arguments>)

Interactive view of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • mch::Bool=true: draw multichannel signal (up to 20 channels in one plot)
  • ep::Int64=1: initial epoch to display
  • bad::Bool=true: list of bad channels; if not false – plot bad channels using this list
  • snap::Bool=true: snap region markers to grid at 0.0, 0.25, 0.5 and 0.75 time points

Returns

  • seg::Union{Nothing, Tuple{Float64, Float64}}
iview_ep(obj1, obj2; <keyword arguments>)

Interactive view of two epoched signals.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Int64=1: initial epoch to display

Returns

Nothing

iview_ep(obj, c; <keyword arguments>)

Interactive view of embedded or external component of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • ep::Int64=1: initial epoch to display

Returns

Nothing

NeuroAnalyzer.iview_icaFunction
iview_ica(obj; <keyword arguments>)

Interactive view of embedded ("ic" and "ic_mw") ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

iview_ica(obj, ic, ic_mw; <keyword arguments>)

Interactive view of external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{String, Vector{String}}: channel name or list of channel names

Returns

Nothing

Statistics

Statistics.stdFunction
std(itr; corrected::Bool=true, mean=nothing[, dims])

Compute the sample standard deviation of collection itr.

The algorithm returns an estimator of the generative distribution's standard deviation under the assumption that each entry of itr is a sample drawn from the same unknown distribution, with the samples uncorrelated. For arrays, this computation is equivalent to calculating sqrt(sum((itr .- mean(itr)).^2) / (length(itr) - 1)). If corrected is true, then the sum is scaled with n-1, whereas the sum is scaled with n if corrected is false with n the number of elements in itr.

If itr is an AbstractArray, dims can be provided to compute the standard deviation over dimensions.

A pre-computed mean may be provided. When dims is specified, mean must be an array with the same shape as mean(itr, dims=dims) (additional trailing singleton dimensions are allowed).

Note

If array contains NaN or missing values, the result is also NaN or missing (missing takes precedence if array contains both). Use the skipmissing function to omit missing entries and compute the standard deviation of non-missing values.

std(x::AbstractArray, w::AbstractWeights, [dim]; mean=nothing, corrected=false)

Compute the standard deviation of a real-valued array x, optionally over a dimension dim. Observations in x are weighted using weight vector w. The uncorrected (when corrected=false) sample standard deviation is defined as:

\[\sqrt{\frac{1}{\sum{w}} \sum_{i=1}^n {w_i\left({x_i - μ}\right)^2 }}\]

where $n$ is the length of the input and $μ$ is the mean. The unbiased estimate (when corrected=true) of the population standard deviation is computed by replacing $\frac{1}{\sum{w}}$ with a factor dependent on the type of weights used:

  • AnalyticWeights: $\frac{1}{\sum w - \sum {w^2} / \sum w}$
  • FrequencyWeights: $\frac{1}{\sum{w} - 1}$
  • ProbabilityWeights: $\frac{n}{(n - 1) \sum w}$ where $n$ equals count(!iszero, w)
  • Weights: ArgumentError (bias correction not supported)
std(ce::CovarianceEstimator, x::AbstractVector; mean=nothing)

Compute the standard deviation of the vector x using the estimator ce.

std(d::UnivariateDistribution)

Return the standard deviation of distribution d, i.e. sqrt(var(d)).

std(m::MixedModel)

Return the estimated standard deviations of the random effects as a Vector{Vector{T}}.

FIXME: This uses an old convention of isfinite(sdest(m)). Probably drop in favor of m.σs

std(obj)

Calculate standard deviation of the signal data (along epochs).

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • s::Matrix{Float64}
NeuroAnalyzer.binom_probFunction
binom_prob(p, r, n)

Calculate probability of exactly r successes in n trials.

Arguments

  • p::Float64: proportion of successes
  • r::Int64: number of successes
  • n::Int64: number of trials

Returns

  • bp::Float64: probability
NeuroAnalyzer.binom_statFunction
binom_stat(p, n)

Calculate mean and standard deviation for probability p.

Arguments

  • p::Float64: proportion of successes
  • n::Int64: number of trials

Returns

Named tuple containing:

  • m::Float64: mean
  • s::Float64: standard deviation
NeuroAnalyzer.bootstrap_ciFunction
bootstrap_ci(s; <keyword arguments>)

Calculate Confidence Interval using bootstrapping.

Arguments

  • s::AbstractMatrix: signal (time points × epochs)
  • n1::Int64=3000: number of stage 1 resamplings – number of samples in the resampled signal
  • n2::Int64=1000: number of stage 2 resamplings – number of samples sampled from the signal
  • ci::Float64=0.95: confidence interval

Returns

Named tuple containing:

  • s_avg::Vector{Float64}: averaged signal
  • s_ci_l::Vector{Float64}: lower bound of the confidence interval
  • s_ci_h::Vector{Float64}: upper bound of the confidence interval
NeuroAnalyzer.bootstrap_statFunction
bootstrap_stat(s; <keyword arguments>)

Calculate signal statistic using bootstrapping.

Arguments

  • s::AbstractMatrix: signal (time points × epochs)
  • n1::Int64=3000: number of stage 1 resamplings – number of samples in the resampled signal
  • n2::Int64=1000: number of stage 2 resamplings – number of samples sampled from the signal
  • f::String: statistic function to be applied, e.g. f="abs(maximum(OBJ))"; signal is given using variableOBJ` here.

Returns

  • out::AbstractVector
NeuroAnalyzer.channel_statsFunction
channel_stats(obj)

Calculate channels statistics per epoch.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • c_mean::Matrix{Float64}: mean
  • c_median::Matrix{Float64}: median
  • c_std::Matrix{Float64}: standard deviation
  • c_var::Matrix{Float64}: variance
  • c_kurt::Matrix{Float64}: kurtosis
  • c_skew::Matrix{Float64}: skewness
  • c_mean_diff::Matrix{Float64}: mean diff value
  • c_median_diff::Matrix{Float64}: median diff value
  • c_max_dif::Matrix{Float64}: max difference
  • c_dev_mean::Matrix{Float64}: deviation from channel mean
NeuroAnalyzer.ci2zFunction
ci2z(ci)

Calculate critical z score.

Arguments

  • ci::Float64: confidence level

Returns

  • z::Float64
NeuroAnalyzer.ci_medianFunction
ci_median(x; <keyword arguments>)

Calculate confidence interval for a median.

Arguments

  • x::AbstractVector
  • ci::Float64=0.95: confidence level

Returns

  • ci_median::Tuple{Float64, Float64}
ci_median(x; <keyword arguments>)

Calculate confidence interval for a median.

Arguments

  • x::AbstractArray
  • ci::Float64=0.95: confidence level

Returns

  • ci_median::Tuple{Float64, Float64}
NeuroAnalyzer.ci_propFunction
ci_prop(p, n; <keyword arguments>)

Calculate confidence interval for a proportion.

Arguments

  • p::Float64: proportion
  • n::Int64: sample size
  • ci::Float64=0.95: confidence level

Returns

  • ci_prop::Tuple{Float64, Float64}
NeuroAnalyzer.ci_rFunction
ci_r(x, y; <keyword arguments>)

Calculate confidence interval for a correlation coefficient.

Arguments

  • x::AbstractVector
  • y::AbstractVector
  • ci::Float64=0.95: confidence level

Returns

  • ci_r::Tuple{Float64, Float64}
ci_r(; <keyword arguments>)

Calculate confidence interval for a correlation coefficient.

Arguments

  • r::Float64: correlation coefficient
  • n::Int64: number of observations
  • ci::Float64=0.95: confidence level

Returns

  • ci_r::Tuple{Float64, Float64}
NeuroAnalyzer.cmp_statFunction
cmp_stat(stat_dist, v)

Calculate proportion of elements below or above a given statistic value.

Arguments

  • stat_dist::AbstractVector: statistic values distribution
  • v::Real: statistic value
  • type::Symbol=:g: calculation proportion of elements greater (:g) or lesser (:l) than v

Returns

  • p::Float64
NeuroAnalyzer.cmp_testFunction
cmp_test(seg1, seg2, paired, alpha, type, exact)

Compare two vectors; Kruskall-Wallis test is used first, next t-test (paired on non-paired) or non-parametric test (paired: Wilcoxon signed rank, non-paired: Mann-Whitney U test) is applied.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • paired::Bool
  • alpha::Float64=0.05: confidence level
  • type::Symbol=:auto: choose test automatically (:auto), permutation-based (:perm), parametric (:p) or non-parametric (:np)
  • exact::Bool=false: if true, use exact Wilcoxon test
  • nperm::Int64=1000: number of permutation for :perm method

Returns

Named tuple containing for type !== :perm:

  • t: test results
  • ts::Tuple{Float64, String}: test statistics
  • tc::Tuple{Float64, Float64}: test statistics confidence interval
  • df::Float64: degrees of freedom
  • p::Float64: p-value

Named tuple containing for type === :perm:

  • t::Tuple{perm_diff::Vector{Float64}, obs_diff::Float64}: test results: (permutation difference, observed difference)
  • p1::Float64: one-sided p-value
  • p2::Float64: two-sided p-value
NeuroAnalyzer.cor_testFunction
cor_test(seg1, seg2)

Calculate correlation between two vectors.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • t::CorrelationTest{Float64}
  • r::Float64: correlation coefficient
  • rc::Tuple{Float64, Float64}: correlation coefficient confidence interval
  • ts::Tuple{Float64, String}: t-statistics
  • df::Int64: degrees of freedom
  • p::Float64: p-value
NeuroAnalyzer.cosine_similarityFunction
cosine_similarity(s1, s2)

Calculate cosine similarity.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

  • cs::Float64
NeuroAnalyzer.count_threshFunction
count_thresh(x; <keyword arguments>)

Collect thresholded elements, e.g. in a topographical map.

Arguments

  • x::AbstractMatrix
  • t::Real: threshold value
  • t_type::Symbol=:g: rule for thresholding:
    • :eq: =
    • :geq: ≥
    • :leq: ≤
    • :g: >
    • :l: <

Returns

Named tuple containing:

  • x_t::Matrix{Bool}: thresholded matrix
  • n::Int64: number of elements
NeuroAnalyzer.crit_tFunction
crit_t(df, alpha; <keyword arguments>)

Calculate critical t value.

Arguments

  • df::Real: degrees of freedom (usually df = n - 1)
  • alpha::Float64=0.05: alpha value
  • twosided::Bool=false: one or two tailed probability

Returns

  • t::Float64

Notes

Critical region for one tailed probability:

  • left: (-∞ , -t]
  • right: [t , ∞)

Critical region for two tailed probability: (-∞ , -t] ∪ [t, ∞)

NeuroAnalyzer.cvar_meanFunction
cvar_mean(x)

Calculate coefficient of variation for a mean.

Arguments

  • x::AbstractVector

Returns

  • cvar_mean::Float64
NeuroAnalyzer.cvar_medianFunction
cvar_median(x)

Calculate coefficient of variation for a median.

Arguments

  • x::AbstractVector

Returns

  • cvar_median::Float64
NeuroAnalyzer.distanceFunction
slope(p1, p2)

Calculate distance between two points.

Arguments

  • p1::Tuple{Real, Real}
  • p2::Tuple{Real, Real}

Returns

  • d::Float64: distance
NeuroAnalyzer.dprimeFunction
dprime(p1::Real, p2::Real)

Calculate d' and response bias for two proportions.

Arguments

  • p1::Real
  • p2::Real

Returns

Named tuple containing:

  • dp::Float64
  • rb::Float64: response bias
NeuroAnalyzer.dranksFunction
dranks(x, nbins)

Calculate ranks scaled in 0..nbins.

Arguments

  • x::AbstractArray: some continuous variable such as reaction time (the time it takes to indicate the response)
  • nbins::Int64: number of bins, default is Sturges' formula

Returns

  • caf::Array{Int64}
NeuroAnalyzer.effsizeFunction
effsize(x1, x2)

Calculate Cohen's d and Hedges g effect sizes.

Arguments

  • x1::AbstractVector
  • x2::AbstractVector

Returns

Named tuple containing:

  • d::Float64: Cohen's d
  • g::Float64: Hedges g, uses maximum likelihood estimator by Hedges and Olkin
  • Δ::Float64: Glass' Δ
NeuroAnalyzer.effsize_p2gFunction
effsize_p2g(p1, p2)

Calculate effect size for two proportions p1 and p2.

Arguments

  • p1::Float64: 1st proportion, e.g. 0.7
  • p2::Float64: 2nd proportion, e.g. 0.3

Returns

  • e::Float64
NeuroAnalyzer.epoch_statsFunction
epoch_stats(obj)

Calculate epochs statistics.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • e_mean::Vector{Float64}: mean
  • e_median::Vector{Float64}: median
  • e_std::Vector{Float64}: standard deviation
  • e_var::Vector{Float64}: variance
  • e_kurt::Vector{Float64}: kurtosis
  • e_skew::Vector{Float64}: skewness
  • e_mean_diff::Vector{Float64}: mean diff value
  • e_median_diff::Vector{Float64}: median diff value
  • e_max_dif::Vector{Float64}: max difference
  • e_dev_mean::Vector{Float64}: deviation from channel mean
NeuroAnalyzer.f1Function
f1(; <keyword arguments>)

Assess performance of the classification model using F1-score. F1-score value ranges from 0 to 1.

Arguments

  • tp::Int64: number of true positives
  • tn::Int64: number of true negatives
  • fp::Int64: number of false positives
  • fn::Int64: number of false negatives

Returns

Named tuple containing:

  • f1::Float64: F1-score
  • p::Float64: precision
  • r::Float64: recall

Source

https://www.statology.org/what-is-a-good-f1-score/

NeuroAnalyzer.flimFunction
flim(p, f; <keyword arguments>)

Trim power spectrum or spectrogram array to a range of frequencies.

Arguments

  • p::AbstractArray: powers
  • f::AbstractVector: frequencies
  • frq_lim::Tuple{Real, Real}: frequency bounds

Returns

Named tuple containing:

  • p::Union{Array{Float64, 3}, Array{Float64, 4}}: powers
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.friedmanFunction
friedman(m)

Estimate Friedman's nonparametric two-way analysis of variance (and Kendall's coefficient of concordance).

Arguments

  • m::AbstractArray: values × groups

Returns

Named tuple containing:

  • f::Float64: Friedman
  • k::Float64: Kendall
  • p::Float64: P-value

Notes

  • H0 (Friedman) is that the treatments are equal
  • H0 (Kendall) is that there is agreement between rankings or test results
  • Kendall's coefficient of concordance ranges from 0 to 1, with 0 meaning no agreement across raters (judges)
NeuroAnalyzer.fwhmFunction
fwhm(s)

Calculate indices of full-width half-maximum points of a Gaussian-like distribution.

Arguments

  • s::AbstractVector

Returns

  • p1_idx::Int64: pre-peak half-maximum point
  • p_idx::Int64: peak
  • p2_idx::Int64: post-peak half-maximum point
NeuroAnalyzer.grubbsFunction
grubbs(x; <keyword arguments>)

Perform Grubbs test for outlier.

Arguments

  • x::AbstractVector
  • alpha::Float64=0.95
  • t::Int64=0: test type:
    • -1: test whether the minimum value is an outlier
    • 0: two-sided test
    • 1: test whether the maximum value is an outlier

Returns

  • g::Bool: true: outlier exists, false: there is no outlier
NeuroAnalyzer.hildebrand_ruleFunction
hildebrand_rule(x)

Calculate Hildebrand rule for vector x. If H < 0.2 then the vector x is symmetrical.

Arguments

  • x::AbstractVector

Returns

  • h::Float64
NeuroAnalyzer.infcritFunction
infcrit(m)

Calculate Akaike’s Information Criterion (AIC) and Bayesian Information Criterion (BIC) for a linear regression model m.

Arguments

  • m::StatsModels.TableRegressionModel: linear regression model

Returns

Named tuple containing:

  • aic::Float64
  • bic::Float64
NeuroAnalyzer.jaccard_similarityFunction
jaccard_similarity(x, y)

Calculate Jaccard similarity between two vectors.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Returns

  • j::Float64
NeuroAnalyzer.k_categoriesFunction
k_categories(n)

Calculate number of categories for a given sample size n.

Arguments

  • n::Int64

Returns

Named tuple containing:

  • k1::Float64: sqrt(n)
  • k2::Float64: 1 + 3.222 * log10(n)
NeuroAnalyzer.linregFunction
linreg(x, y)

Linear regression between two vectors.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Notes

To predict, use: `newx = DataFrame(x = [3.5, 7]); predict(lr, newx)

Returns

Named tuple containing:

  • lr::StatsModels.TableRegressionModel: model
  • radj::Float64: R^2
  • c::Vector{Float64}: coefficients
  • se::Vector{Float64}: standard error for coefficients
  • aic::Float64:: Akaike’s Information Criterion (AIC)
  • bic::Float64:: Bayesian Information Criterion (BIC)
  • lf::Vector{Float64}: linear fit (plot(x, lf))
NeuroAnalyzer.mccFunction
mcc(; <keyword arguments>)

Assess performance of the classification model using Matthews correlation coefficient (MCC).

MCC’s value ranges from -1 to 1, depending on:

  • a score of -1 denotes a complete discrepancy between expected and actual classes
  • 0 is equivalent to making an entirely arbitrary guess
  • total agreement between expected and actual classes is indicated by a score of 1

Arguments

  • tp::Int64: number of true positives
  • tn::Int64: number of true negatives
  • fp::Int64: number of false positives
  • fn::Int64: number of false negatives

Returns

  • mcc::Float64

Source

https://finnstats.com/index.php/2022/09/06/assess-performance-of-the-classification-model/

NeuroAnalyzer.mdiffFunction
mdiff(s1, s2; <keyword arguments>)

Calculate mean difference and 95% confidence interval for 2 signals.

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • n::Int64=3: number of bootstraps
  • method::Symbol=:absdiff:
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Vector{Float64}
  • sts::Float64
  • p::Float64
mdiff(s1, s2; <keyword arguments>)

Calculate mean difference and its 95% CI between channels.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • n::Int64=3: number of bootstraps
  • method::Symbol=:absdiff
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Matrix{Float64}
  • sts::Vector{Float64}
  • p::Vector{Float64}
mdiff(obj1, obj2; <keyword arguments>)

Calculate mean difference and 95% confidence interval for two channels.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2:NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs
  • n::Int64: number of bootstraps
  • method::Symbol[:absdiff, :diff2int]
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Matrix{Float64}
  • sts::Vector{Float64}
  • p::Vector{Float64}
NeuroAnalyzer.meancFunction
meanc(x; <keyword arguments>)

Calculate circular mean.

Arguments

  • x::AbstractVector: angles
  • rad::Bool=false: angles in radians (rad=true) or degrees (rad=false)

Returns

  • m::Float64
NeuroAnalyzer.meangFunction
meang(x)

Calculate geometric mean.

Arguments

  • x::AbstractVector

Returns

  • m::Float64
NeuroAnalyzer.meanhFunction
meanh(x)

Calculate harmonic mean.

Arguments

  • x::AbstractVector

Returns

  • m::Float64
NeuroAnalyzer.meanwFunction
meanw(x, w)

Calculate weighted mean.

Arguments

  • x::AbstractVector
  • w::AbstractVector: weights

Returns

  • m::Float64
NeuroAnalyzer.moeFunction
moe(n)

Calculate margin of error for given sample size n.

Arguments

  • n::Int64

Returns

  • m::Float64
moe(x)

Calculate margin of error.

Arguments

  • x::AbstractArray

Returns

  • m::Float64
NeuroAnalyzer.msci95Function
msci95(s; <keyword arguments>)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractVector
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Float64: mean
  • ss::Float64: standard deviation
  • su::Float64: upper 95% CI
  • sl::Float64: lower 95% CI
msci95(s; <keyword arguments>)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractMatrix
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Vector{Float64}: mean
  • ss::Vector{Float64}: standard deviation
  • su::Vector{Float64}: upper 95% CI
  • sl::Vector{Float64}: lower 95% CI
msci95(s; <keyword arguments>)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractArray
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI
  • sl::Matrix{Float64}: lower 95% CI
msci95(obj; <keyword arguments>)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Vector{String}}: channel name or list of channel names
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal (:normal) method or n-times bootstrapping (:boot)

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI
  • sl::Matrix{Float64}: lower 95% CI
msci95(s1, s2)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • sm::Float64: mean
  • ss::Float64: standard deviation
  • su::Float64: upper 95% CI
  • sl::Float64: lower 95% CI
msci95(s1, s2)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI
  • sl::Matrix{Float64}: lower 95% CI
msci95(obj1, obj2; <keyword arguments>)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2:NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI bound
  • sl::Matrix{Float64}: lower 95% CI bound
NeuroAnalyzer.mscrFunction
mscr(; <keyword arguments>)

Assess performance of the classification model using misclassification rate.

Arguments

  • tp::Int64: number of true positives
  • tn::Int64: number of true negatives
  • fp::Int64: number of false positives
  • fn::Int64: number of false negatives

Returns

Named tuple containing:

  • mr::Float64: misclassification rate
  • acc::Float64: accuracy

Source

https://www.statology.org/misclassification-rate/

NeuroAnalyzer.norminvFunction
norminv(x::Real)

Convert probability to a normal distribution with a peak at 0.5.

Arguments

  • x::Real

Returns

  • n::Float64
NeuroAnalyzer.outlier_detectFunction
outlier_detect(x; <keyword arguments>)

Detect outliers.

Arguments

  • x::AbstractVector
  • method::Symbol=iqr: detecting methods:
    • :iqr: interquartile range
    • :z: z-score
    • :g: Grubbs test

Returns

  • o::Vector{Bool}: index of outliers
NeuroAnalyzer.p2zFunction
p2z(p; <keyword arguments>)

Calculate z score for p value.

Arguments

  • p::Float64=0.05: confidence level
  • twosided::Bool=false: one or two tailed probability

Returns

  • z::Float64
NeuroAnalyzer.permuteFunction
permute(s, n)

Permute signal data.

Arguments

  • s::AbstractVector
  • n::Int64: number of permutations

Returns

  • s_new::Matrix{Float64}
permute(s, n)

Permute signal data.

Arguments

  • s::AbstractArray
  • n::Int64: number of permutations

Returns

  • s_new::Union{Array{Float64, 3}, Array{Float64, 4}}
NeuroAnalyzer.pooledstdFunction
pooledstd(x1, x2; <keyword arguments>)

Calculate pooled standard deviation

Arguments

  • x1::AbstractVector
  • x2::AbstractVector
  • type::Symbol=:cohen: use Cohen's equation (:cohen) or maximum likelihood estimator by Hedges and Olkin (:hedges)

Returns

  • ps::Float64
NeuroAnalyzer.power_c1gFunction
power_c1g(; <keyword arguments>)

Calculate study power for a continuous variable (group 1 vs population).

Arguments

  • m::Real: population mean
  • s::Real: population standard deviation
  • xbar::Real: group mean
  • n::Int64: group sample size
  • alpha::Float64=0.05: the probability of type I error

Returns

  • p::Float64: study power
NeuroAnalyzer.power_c2gFunction
power_c2g(; <keyword arguments>)

Calculate study power for a continuous variable (group 1 vs group 2).

Arguments

  • m1::Real: group 1 mean
  • s1::Real: group 1 standard deviation
  • n1::Int64: group 1 sample size
  • m2::Real: group 2 mean
  • s2::Real: group 2 standard deviation
  • n2::Int64: group 2 sample size
  • alpha::Float64=0.05: the probability of type I error

Returns

  • p::Float64: study power
NeuroAnalyzer.power_p1gFunction
power_p1g(; <keyword arguments>)

Calculate required sample size for a proportion (group 1 vs population).

Arguments

  • p1::Float64: population incidence
  • p2::Float64: group 1 anticipated incidence
  • n1::Int64: group 1 sample size
  • alpha::Float64=0.05: the probability of type I error

Returns

  • p::Float64: study power
NeuroAnalyzer.power_p2gFunction
power_p2g(; <keyword arguments>)

Calculate required sample size for a proportion (group 1 vs group 2).

Arguments

  • p1::Float64: group 1 incidence
  • p2::Float64: group 2 incidence
  • n1::Int64: group 1 sample size
  • n2::Int64: group 2 sample size
  • alpha::Float64=0.05: the probability of type I error

Returns

  • p::Float64: study power
NeuroAnalyzer.prankFunction
prank(x)

Calculate percentile rank.

Arguments

  • x::AbstractVector: the vector to analyze

Returns

  • p::Vector{Float64}: percentile ranks
NeuroAnalyzer.pred_intFunction
pred_int(n)

Calculate the prediction interval (95% CI adjusted for sample size)

Arguments

  • n::Int64: sample size

Returns

  • pi::Float64
NeuroAnalyzer.r1r2_testFunction
r1r2_test(; <keyword arguments>)

Test if two correlation coefficients are significantly different.

Arguments

  • r1::Float64: correlation coefficient, group 1
  • r2::Float64: correlation coefficient, group 2
  • n1::Int64: number of observations, group 1
  • n2::Int64: number of observations, group 2

Returns

  • z::Float64: z score
NeuroAnalyzer.res_normFunction
res_norm(x, g)

Test normal distribution of residuals.

Arguments

  • x::AbstractVector: data values
  • g::Vector{Int64}: group(s) to which each data value belongs

Returns

Named tuple containing:

  • adt_p::Vector{Float64}: p-values for k-sample Anderson–Darling test vs normal distribution
  • ks_p::Vector{Float64}: p-values for one-sample exact Kolmogorov–Smirnov test vs normal distribution

Notes

p-values are reported for each group and for the whole sample. If there is only one group, p-values are returned only for the whole sample p-values are reported.

NeuroAnalyzer.rngFunction
rng(x)

Calculate range.

Arguments

  • x::AbstractArray

Returns

  • r::Float64
NeuroAnalyzer.seg_extractFunction
seg_extract(m, rc; <keyword arguments>)

Extract segment from a matrix.

Arguments

  • m::AbstractMatrix
  • rc::NTuple{4, Int64}: upper-left corner row and column, bottom-right corner row and column
  • c::Bool=false: if true, use circular segment; for circular segment the segment is always returned as vector
  • v::Bool=false: if true, return as vector (matrix m by rows over columns)

Returns

  • seg::Union{AbstractMatrix, AbstractVector}
NeuroAnalyzer.seg_meanFunction
seg_mean(seg)

Calculate mean of a segment (e.g. spectrogram).

Arguments

  • seg::AbstractArray

Returns

  • sm::Vector{Float64}: averaged segment
seg2_mean(seg1, seg2)

Calculate mean of two segments (e.g. spectrograms).

Arguments

  • seg1::AbstractArray
  • seg2::AbstractArray

Returns

Named tuple containing:

  • seg1::Vector{Float64}: averaged segment 1
  • seg2::Vector{Float64}: averaged segment 2
NeuroAnalyzer.semFunction
sem(x)

Calculate standard error of the mean.

Arguments

  • x::AbstractVector

Returns

  • s::Float64
NeuroAnalyzer.sem_diffFunction
sem_diff(x, y)

Calculate SEM (standard error of the mean) for the difference of two means.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Returns

  • sem_diff::Float64
NeuroAnalyzer.size_c1diffFunction
size_c1diff(; <keyword arguments>)

Calculate required sample size for detecting a difference in a continuous variable (group 1 vs population).

Arguments

  • s1::Real: population standard deviation
  • s2::Real: study standard deviation that we want to detect
  • twosided::Bool=true: if true, the estimation is for two-sided difference
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)

Returns

  • n::Int64: study sample size
NeuroAnalyzer.size_c1gFunction
size_c1g(; <keyword arguments>)

Calculate required sample size for a continuous variable (group 1 vs population).

Arguments

  • m::Real: population mean
  • s::Real: population standard deviation
  • xbar::Real: expected group mean
  • alpha::Float64=0.05: the probability of type I error
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)
  • iter::Bool=false: use iterative method

Returns

  • n::Int64: group sample size
NeuroAnalyzer.size_c2gFunction
size_c2g(; <keyword arguments>)

Calculate required sample size for a continuous variable (group 1 vs group 2).

Arguments

  • m1::Real: group 1 mean
  • s1::Real: group 1 standard deviation
  • m2::Real: group 2 mean (expected)
  • r::Int64=1: enrollment ratio – the ratio of group 2 to group 1 enrollment
  • alpha::Float64=0.05: the probability of type I error
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)

Returns

Named tuple containing:

  • n1::Int64: group 1 sample size
  • n2::Int64: group 2 sample size
NeuroAnalyzer.size_p1diffFunction
size_p1diff(; <keyword arguments>)

Calculate required sample size for detecting a difference in a proportion (group 1 vs population).

Arguments

  • p1::Real: population proportion
  • p2::Real: study proportion that we want to detect
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)

Returns

  • n::Int64: study sample size (for both study groups)
NeuroAnalyzer.size_p1gFunction
size_p1g(; <keyword arguments>)

Calculate required sample size for a proportion (group 1 vs population).

Arguments

  • p1::Float64: population incidence
  • p2::Float64: group anticipated incidence
  • alpha::Float64=0.05: the probability of type I error
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)

Returns

  • n::Int64: group 1 sample size
NeuroAnalyzer.size_p2gFunction
size_p2g(; <keyword arguments>)

Calculate required sample size for a proportion (group 1 vs group 2).

Arguments

  • p1::Float64: group 1 anticipated incidence
  • p2::Float64: group 2 anticipated incidence
  • r::Int64=1: enrollment ratio – the ratio of group 2 to group 1 enrollment
  • alpha::Float64=0.05: the probability of type I error
  • power::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, where beta is the probability of type II error)

Returns

Named tuple containing:

  • n1::Int64: group 1 sample size
  • n2::Int64: group 2 sample size
NeuroAnalyzer.slopeFunction
slope(p1, p2)

Calculate slope of the line crossing two points.

Arguments

  • p1::Tuple{Real, Real}
  • p2::Tuple{Real, Real}

Returns

  • s::Float64: slope
NeuroAnalyzer.spec_segFunction
spec_seg(sp, st, sf; <keyword arguments>)

Return spectrogram segment.

Arguments

  • sp::Matrix{Float64}: spectrogram powers
  • sf::Vector{Float64}: spectrogram frequencies
  • st::Vector{Float64}: spectrogram time
  • t::Tuple{Real, Real}: time bounds
  • f::Tuple{Real, Real}: frequency bounds

Returns

Named tuple containing:

  • segp::Matrix{Float64}: powers
  • segs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted by Plots.Shape(segs)
  • tidx::Tuple{Real, Real}: time indices
  • fidx::Tuple{Real, Real}: frequency indices
spec_seg(sp, sf, st; <keyword arguments>)

Return spectrogram segment.

Arguments

  • sp::AbstractArray: spectrogram powers
  • sf::AbstractVector: spectrogram frequencies
  • st::AbstractVector: spectrogram time
  • ch::Int64: channel
  • t::Tuple{Real, Real}: time bounds
  • f::Tuple{Real, Real}: frequency bounds

Returns

Named tuple containing:

  • segp::Array{Float64, 3}: segment of powers
  • segs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted by Plots.Shape(segs)
  • tidx::Tuple{Real, Real}: time indices
  • fidx::Tuple{Real, Real}: frequency indices
NeuroAnalyzer.summaryFunction
summary(x)

Return summary statistics.

Arguments

  • x::AbstractVector

Returns

Named tuple containing:

  • mm::Float64: mean
  • s::Float64: standard deviation
  • v::Float64: variance
  • me::Float64: median
  • mo::Float64: mode
summary(x, y)

Return summary statistics.

Arguments

  • x::AbstractVector
  • y::AbstractVector
  • g1::String="1": group 1 name
  • g2::String="2": group 2 name

Returns

Named tuple containing:

  • mm1::Float64: mean
  • mm2::Float64: mean
  • s1::Float64: standard deviation
  • s2::Float64: standard deviation
  • v1::Float64: variance
  • v2::Float64: variance
  • me1::Float64: median
  • me2::Float64: median
  • mo1::Float64: mode
  • mo2::Float64: mode
NeuroAnalyzer.tlimFunction
tlim(p, f; <keyword arguments>)

Trim spectrogram array to a range of time points.

Arguments

  • p::AbstractArray: powers
  • t::AbstractVector: time points
  • seg::Tuple{Real, Real}: time segment

Returns

Named tuple containing:

  • p::Array{Float64, 4}: powers
  • t::Vector{Float64}: time points
NeuroAnalyzer.vartestFunction
vartest(obj; <keyword arguments>)

Calculate variance F-test.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `ch::Union{String, Vector{String}}: list of channels

Returns

Named tuple containing:

  • f::Array{Float64, 3}
  • p::Array{Float64, 3}
vartest(obj1, obj2; <keyword arguments>)

Calculate variance F-test.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{String, Vector{String}}: list of channels
  • ch2::Union{String, Vector{String}}: list of channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs

Returns

Named tuple containing:

  • f::Array{Float64, 3}
  • p::Array{Float64, 3}
NeuroAnalyzer.z2pFunction
z2p(z; <keyword arguments>)

Calculate probability for a given z value.

Arguments

  • z::Real: z value
  • twosided::Bool=false: one or two tailed probability

Returns

  • p::Float64
NeuroAnalyzer.z_scoreFunction
z_score(x)

Calculate Z-scores for each value of the vector x.

Arguments

  • x::AbstractVector

Returns

  • z::Vector{Float64}

Study

NeuroAnalyzer.create_studyFunction
study(obj, group)

Create NeuroAnalyzer STUDY object.

Arguments

  • obj::Vector{NeuroAnalyzer.NEURO}
  • group::Vector{Symbol}

Returns

  • study::NeuroAnalyzer.STUDY
Missing docstring.

Missing docstring for NeuroAnalyzer.epoch_len. Check Documenter's build log for details.

Missing docstring.

Missing docstring for NeuroAnalyzer.nchannels. Check Documenter's build log for details.

Missing docstring.

Missing docstring for NeuroAnalyzer.nepochs. Check Documenter's build log for details.

NeuroAnalyzer.obj_nFunction
obj_n(study)

Return number of NeuroAnalyzer NEURO objects in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
Missing docstring.

Missing docstring for NeuroAnalyzer.sr. Check Documenter's build log for details.

NeuroRecorder

NeuroAnalyzer.edaFunction
eda(; <keyword arguments>)

Record electrodermal activity (EDA), also called Galvanic Skin Response (GSR) or skin conductance, in CLI mode. EDA is recorded using Groove GSR sensor via Arduino attached to the PC via USB cable (virtual serial port).

Arguments

  • duration::Int64=20: recording duration in seconds
  • port_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.fttFunction
ftt(; <keyword arguments>)

Perform Finger Tapping Test (FTT) in CLI mode. Use computer keyboard (SPACEBAR key) or switch panel attached to Raspberry Pi via a GPIO pin. Number of taps, time points and durations of taps are recorded. Also, taps during intervals (when the study subject should suppress tapping) are recorded. When using computer keyboard, only the number of taps and their time points are recorded; tap durations are set to 100 ms.

Arguments

  • duration::Int64=5: single trial duration in seconds
  • trials::Int64=2: number of trials
  • interval::Int64=2: interval between trials in seconds
  • gpio::Int64=-1: Raspberry Pi GPIO to which the switch is connected (e.g. gpio=23 is Pi board pin 16); set to -1 to disable using GPIO
  • port_name::String="": serial port to which the switch is connected (e.g. /dev/ttyACM0); set to "" to disable using serial port

Returns

Named tuple containing:

  • taps::Vector{Int64}: number of taps per trial
  • tap_t::Vector{Vector{Float64}}: taps time point [ms]
  • tap_d::Vector{Vector{Float64}}: taps duration [ms]
  • taps_int::Vector{Int64}: number of taps per trial during intervals
  • tap_t_int::Vector{Vector{Float64}}: taps time point [ms] during intervals
  • tap_d_int::Vector{Vector{Float64}}: taps duration [ms] during intervals
NeuroAnalyzer.iedaFunction
ieda(; <keyword arguments>)

Record electrodermal activity (EDA), also called Galvanic Skin Response (GSR) or skin conductance, in GUI mode. EDA is recorded using Groove GSR sensor via Arduino attached to the PC via USB cable (virtual serial port). Sampling rate is 50 Hz.

Arguments

  • duration::Int64=20: recording duration in seconds
  • port_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.ifttFunction
iftt(; <keyword arguments>)

Perform Finger Tapping Test (FTT) in GUI mode. Use computer keyboard (SPACEBAR key) or switch panel attached to Raspberry Pi via a GPIO pin and to the PC via USB (virtual serial port). Number of taps, time points and durations of taps are recorded. Also, taps during intervals (when the study subject should suppress tapping) are recorded.

Arguments

  • duration::Int64=5: single trial duration in seconds
  • trials::Int64=2: number of trials
  • interval::Int64=2: interval between trials in seconds
  • gpio::Int64=-1: Raspberry Pi GPIO to which the switch is connected (e.g. gpio=23 is Pi board pin 16); set to -1 to disable using GPIO
  • port_name::String="": serial port to which the switch is connected (e.g. /dev/ttyACM0); set to "" to disable using serial port

Returns

Named tuple containing:

  • taps::Vector{Int64}: number of taps per trial
  • tap_t::Vector{Vector{Float64}}: taps time point [ms]
  • tap_d::Vector{Vector{Float64}}: taps duration [ms]
  • taps_int::Vector{Int64}: number of taps per trial during intervals
  • tap_t_int::Vector{Vector{Float64}}: taps time point [ms] during intervals
  • tap_d_int::Vector{Vector{Float64}}: taps duration [ms] during intervals

NeuroStim

NeuroAnalyzer.ect_chargeFunction
ect_charge(; <keyword arguments>)

Calculate charge administered during ECT.

Arguments

  • pw::Real: pulse width [ms]
  • pint::Real: pulse intensity [mA]
  • pf::Real: pulse frequency [Hz]
  • duration::Real: stimulation duration [s]

Returns

  • charge::Float64: charge [mC]
NeuroAnalyzer.tacs_doseFunction
tacs_dose(; <keyword arguments>)

Calculate charge, current_density and charge_ density for tACS stimulation.

Arguments

  • current::Real: stimulation current (peak to peak) [mA]
  • pad_area::Real: electrode pad area [cm²]
  • duration::Real: stimulation duration [s]
  • offset::Real: current offset [μA]
  • frequency::Real: sinus frequency [Hz]
  • phase::Real: phase shift [degree]

Returns

Named tuple containing:

  • charge::Float64: charge [C]
  • current_density::Float64: current density [A/m²]
  • charge_density::Float64: delivered charge density [kC/m²]
NeuroAnalyzer.tdcs_doseFunction
tdcs_dose(; <keyword arguments>)

Calculate charge, current_density and charge_ density for tDCS stimulation.

Arguments

  • current::Real: stimulation current [mA]
  • pad_area::Real: electrode pad area [cm²]
  • duration::Int64: stimulation duration [s]

Returns

Named tuple containing:

  • charge::Float64: charge [C]
  • current_density::Float64: current density [A/m²]
  • charge_density::Float64: delivered charge density [kC/m²]

Source

Chhatbar PY, George MS, Kautz SA, Feng W. Quantitative reassessment of safety limits of tDCS for two animal studies. Brain Stimulation. 2017;10(5):1011–2.

NeuroAnalyzer.tes_modelFunction
tes_model(; <keyword arguments>)

Create model of TES stimulation.

Arguments

  • anode::String: anode location
  • cathode::String: cathode location
  • anode_curr::Real=2.0: anode current [mA]
  • cathode_curr::Real=-2.0: cathode current [mA]

Returns

  • p::Plots.Plot{Plots.GRBackend}

Notes

This is a very initial version, simplified model – just superficial spread of the electric field

To do

Model spread of electric field at the cortical surface – reduce charge for skull resistance

NeuroAnalyzer.tes_protocolFunction
tes_protocol(; <keyword arguments>)

Create TES (tDCS/tACS/tRNS/tPCS) protocol.

Arguments

  • type::Symbol: stimulation type (:tDCS, :tACS, :tRNS, :tPCS)
  • hd::Bool: high-density electrodes
  • current::Real: stimulation current [mA]
  • frequency::Real=0: stimulation frequency [mA]
  • anode_size::Tuple{Int64, Int64}: anode dimensions [mm]
  • cathode_size::Tuple{Int64, Int64}: cathode dimensions [mm]
  • anode_loc::Symbol: anode location (according to 10-20 Positioning System)
  • cathode_loc::Symbol: cathode location (according to 10-20 Positioning System)
  • duration::Real: stimulation duration [s]
  • ramp_in::Real: stimulation duration [s]
  • ramp_out::Real: stimulation duration [s]
  • sham::Bool: protocol includes sham stimulations

Returns

  • protocol::Dict
NeuroAnalyzer.tpcs_doseFunction
tpcs_dose(; <keyword arguments>)

Calculate charge, current_density and charge_ density for tPCS stimulation.

Arguments

  • current::Real: stimulation current (peak to peak) [mA]
  • pad_area::Real: electrode pad area [cm²]
  • duration::Real: stimulation duration [s]
  • pw::Real: pulse width [ms]
  • isi::Real: interstimulus interval [ms]

Returns

Named tuple containing:

  • charge::Float64: charge [C]
  • current_density::Float64: current density [A/m²]
  • charge_density::Float64: delivered charge density [kC/m²]

NeuroTester