
NeuroAnalyzer.jl documentation
This documentation has been generated using Documenter.jl.
NeuroAnalyzer
NeuroAnalyzer.na_info — Function
na_info()Show NeuroAnalyzer and imported packages versions.
Arguments
Nothing
Returns
Nothing
NeuroAnalyzer.na_set_colors — Function
na_set_colors(value)Change colors preference.
Arguments
value::Bool: value
Returns
Nothing
NeuroAnalyzer.na_set_exclude_bads — Function
na_set_exclude_bads(value)Change exclude_bads preference.
Arguments
value::Bool: value
Returns
Nothing
NeuroAnalyzer.na_set_prefs — Function
na_set_prefs(; use_gpu, progress_bar, verbose, exclude_bads, colors)Set and save NeuroAnalyzer preferences.
Arguments
use_gpu::Boolprogress_bar::Boolverbose::Boolexclude_bads::Boolcolors::Bool
Returns
Nothing
NeuroAnalyzer.na_set_progress_bar — Function
na_set_progress_bar(value)Change progress_bar preference.
Arguments
value::Bool: value
Returns
Nothing
NeuroAnalyzer.na_set_use_gpu — Function
na_set_use_gpu(value)Change use_gpu preference.
Arguments
value::Bool: value
Returns
Nothing
NeuroAnalyzer.na_set_verbose — Function
na_set_verbose(value)Change verbose preference.
Arguments
value::Bool: value
Returns
Nothing
NeuroAnalyzer.na_version — Function
na_version()Convert NeuroAnalyzer version to string.
Arguments
Nothing
Returns
VER::String
NeuroAnalyzer.na_plugins_install — Function
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_list — Function
na_plugins_list()List NeuroAnalyzer plugins.
Arguments
Nothing
Returns
Nothing
NeuroAnalyzer.na_plugins_reload — Function
na_plugins_reload()Reload NeuroAnalyzer plugins.
Arguments
Nothing
Returns
Nothing
NeuroAnalyzer.na_plugins_remove — Function
na_plugins_remove(plugin)Remove NeuroAnalyzer plugin.
Arguments
plugin::String: plugin name
Returns
Nothing
NeuroAnalyzer.na_plugins_update — Function
na_plugins_update(plugin)Update NeuroAnalyzer plugin(s).
Arguments
plugin::String: plugin to update; if empty, update all
Returns
Nothing
Utils
Base.size — Function
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.NEUROd::Int64: compute size along dimensiond
Returns
s::Int64
NeuroAnalyzer.add_component — Function
add_component(obj; <keyword arguments>)Add component.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component namev::Any: component value
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_component! — Function
add_component!(obj; <keyword arguments>)Add component.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component namev::Any: component value
Returns
Nothing
NeuroAnalyzer.add_note — Function
add_note(obj; <keyword arguments>)Add recording note to the object header.
Arguments
obj::NeuroAnalyzer.NEUROnote::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.NEUROnote::String
Returns
Nothing
NeuroAnalyzer.aff_mni2tal — Function
aff_mni2tal(pts)Convert MNI coordinates to Talairach coordinates: redo the affine transform of Talairach coordinates.
Arguments
pts::Vector{<:Number}: MNI X, Y, Z coordinates
Returns
t::Vector{Float64}: Talairach X, Y, Z coordinates
Source
https://www.brainmap.org/training/BrettTransform.html
NeuroAnalyzer.aff_tal2mni — Function
aff_tal2mni(pts)Convert Talairach coordinates to MNI coordinates: do the affine transform of MNI coordinates.
Arguments
pts::Vector{<:Number}: Talairach X, Y, Z coordinates
Returns
t::Vector{Float64}: MNI X, Y, Z coordinates
Source
https://www.brainmap.org/training/BrettTransform.html
NeuroAnalyzer.apply — Function
apply(obj; <keyword arguments>)Apply custom function.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesf::String: function to be applied, e.g.f="mean(obj, dims=3)"; OBJ signal is given using variableobjhere.
Returns
out::Array{Float64, 3}
NeuroAnalyzer.areduce — Function
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 dataf::AbstractVector: e.g. frequenciesn::Float64=0.5: reduce at multiplications of this value
Returns
a_new::Array{eltype(a), ndims(a)}f_new::Vector{eltype(f)}
NeuroAnalyzer.arr2mat — Function
arr2mat(x)Reshape array into matrix.
Arguments
x::AbstractArray
Returns
m::AbstractMatrix
NeuroAnalyzer.band_frq — Function
band_frq(obj, band)Return band frequency limits.
Arguments
obj::NeuroAnalyzer.NEUROband::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 rateband::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.cextrema — Function
cextrema(x)Return extreme values of the complex vector.
Arguments
x::Vector{ComplexF64}
Returns
Tuple containing:
cmax::ComplexF64cmin::ComplexF64
NeuroAnalyzer.channel_cluster — Function
channels_cluster(obj; <keyword arguments>)Return channels belonging to a cluster of channels.
Arguments
obj::NeuroAnalyzer.NEUROcluster::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{Int64}: channel numbers
NeuroAnalyzer.channel_info — Function
channel_info(obj; <keyword arguments>)Show channel info.
Arguments
obj::NeuroAnalyzer.NEUROch::Int64
Returns
Nothing
NeuroAnalyzer.channel_order — Function
channel_order(obj)Return channel order of the object.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
co::Vector{Int64}
NeuroAnalyzer.channel_pick — Function
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.NEUROp::Vector{Symbol}: pick of electrodes; picks may be combined, e.g.[:left, :frontal]:central(or:c):left(or:l):right(or:r):frontal(or:f):temporal(or:t):parietal(or:p):occipital(or:o)
Returns
channels::Vector{Int64}: channel numbers
NeuroAnalyzer.chtypes — Function
chtypes(obj)Return channel types.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
cht::Vector{String}
NeuroAnalyzer.cmax — Function
cmax(x)Return maximum value of the complex vector.
Arguments
x::Vector{ComplexF64}
Returns
cmax::ComplexF64
NeuroAnalyzer.cmin — Function
cmin(x)Return minimum value of the complex vector.
Arguments
x::Vector{ComplexF64}
Returns
cmin::ComplexF64
NeuroAnalyzer.component_type — Function
component_type(obj, c)Return component data type.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component name
Return
c_type::DataType
NeuroAnalyzer.cums — Function
cums(signal)Calculate cumulative sum of a 3-dimensional array.
Arguments
signal::Array{<:Real, 3}
Returns
signal_cs::Array{Float64, 3}
NeuroAnalyzer.cwtfrq — Function
cwtfrq(s; <keyword arguments>)Return mean frequencies of a collection of analytic or real wavelets for a given signal.
Arguments
s::AbstractVectorfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), 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::AbstractArrayfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), 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.NEUROwt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
f::Vector{Float64}: frequencies
NeuroAnalyzer.datatype — Function
datatype(obj)Return data type of the object.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
dt::String
NeuroAnalyzer.delete_component — Function
delete_component(obj; <keyword arguments>)Delete component.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component name
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_component! — Function
delete_component!(obj; <keyword arguments>)Delete component.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component name
Returns
Nothing
NeuroAnalyzer.delete_note — Function
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.delmean — Function
delmean(s)Demean signal.
Arguments
s::AbstractArray
Returns
s_new::AbstractArray
NeuroAnalyzer.describe — Function
describe(obj; <keyword arguments>)Return basic descriptive statistics of the object data.
Arguments
obj::NeuroAnalyzer.NEUROdf::Bool=false: if true, return statistics as a DataFrame
Returns
Union{Nothing, DataFrame}
NeuroAnalyzer.detector_labels — Function
detector_labels(obj)Return NIRS detector labels.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
l::Vector{String}
NeuroAnalyzer.epoch_duration — Function
epoch_duration(obj)Return epoch length.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
ed::Float64
NeuroAnalyzer.epoch_len — Function
epoch_len(obj)Return epoch length.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
len::Int64
NeuroAnalyzer.extract_component — Function
extract_component(obj, c)Extract component values.
Arguments
obj::NeuroAnalyzer.NEUROc::Symbol: component name
Returns
c::Any
NeuroAnalyzer.f2t — Function
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.fft0 — Function
fft0(x, n)Perform zeros-padded FFT.
Arguments
x::AbstractVectorn::Int64: number of zeros to add
Returns
fft0::Vector{ComplexF64}
NeuroAnalyzer.fft2 — Function
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.findpeaks — Function
findpeaks(signal; <keyword arguments>)Find peaks.
Arguments
signal::AbstractVectord::Int64=32: distance between peeks in samples
Returns
p_idx::Vector{Int64}
NeuroAnalyzer.fir_order_bw — Function
fir_order_bw(; <keyword arguments>)Calculate order of FIR filter using Harris formula.
Arguments
bw::Real: transition band widtha::Real: attenuation in dBfs::Int64: sampling rate
Returns
n::Int64
fir_order_bw(obj; <keyword arguments>)Calculate order of FIR filter using Harris formula.
Arguments
obj::NeuroAnalyzer.NEURObw::Real: transition band widtha::Real: attenuation in dB
Returns
n::Int64
NeuroAnalyzer.fir_order_f — Function
fir_order_f(obj; <keyword arguments>)Calculate order of FIR filter using lower frequency bound.
Arguments
obj::NeuroAnalyzer.NEUROf::Real: lower frequency bound for analyzed range
Returns
n::Tuple{Int64, Int64}: recommended order range
fir_order_f(; <keyword arguments>)Calculate order of FIR filter using lower frequency bound.
Arguments
f::Real: lower frequency bound for analyzed rangefs::Int64: sampling rate
Returns
n::Tuple{Int64, Int64}: recommended order range
NeuroAnalyzer.f_nearest — Function
f_nearest(m, pos)Find nearest position tuple in a matrix of positions.
Arguments
m::Matrix{Tuple{Float64, Float64}}: matrix of positionsp::Tuple{Float64, Float64}: position tuple
Returns
pos::Tuple{Int64, Int64}: row and column in m
NeuroAnalyzer.freqs — Function
freqs(t; nf)Return vector of frequencies and Nyquist frequency for time vector.
Arguments
t::AbstractVector, AbstractRange}: time vectornf::Bool=false: if true, return negative and positive frequencies, otherwise return positive frequencies only
Returns
hz::Vector{Float64}nqf::Float64
freqs(s, fs; nf)Return vector of frequencies and Nyquist frequency for signal.
Arguments
s::AbstractVectorfs::Int64nf::Bool=false: if true, return negative and positive frequencies, otherwise return positive frequencies only
Returns
hz::Vector{Float64: signal vectornqf::Float64
freqs(n, fs; nf)Return vector of frequencies and Nyquist frequency for signal.
Arguments
n::Int64: number of samplesfs::Int64nf::Bool=false: if true, return negative and positive frequencies, otherwise return positive frequencies only
Returns
hz::Vector{Float64: signal vectornqf::Float64
freqs(obj; nf)Return vector of frequencies and Nyquist frequency.
Arguments
obj::NeuroAnalyzer.NEUROnf::Bool=false: if true, return negative and positive frequencies, otherwise return positive frequencies only
Returns
Named tuple containing:
hz::Vector{Float64}nqf::Float64
NeuroAnalyzer.fwhm — Function
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 pointp_idx::Int64: peakp2_idx::Int64: post-peak half-maximum point
NeuroAnalyzer.generate_cosine — Function
generate_cosine(f, t, a, p)Generate cosine wave.
Arguments
f::Real: frequency [Hz]t::AbstractVector: time vectora::Real: amplitude, sine amplitude will be in[-amp, +amp]p::Real: phase shift [degrees]
Returns
- s::Vector{Float64}`
NeuroAnalyzer.generate_csine — Function
generate_csine(f, t, a)Generate complex sine wave.
Arguments
f::Real: frequency [Hz]t::AbstractVector: time vectora::Real: amplitude, sine amplitude will be in[-amp, +amp]
Returns
- cs::Vector{ComplexF64}`
NeuroAnalyzer.generate_gaussian — Function
generate_gaussian(fs, f, t; <keyword arguments>)Generate Gaussian wave.
Arguments
fs::Int64: sampling ratef::Real: frequencyt::Real=1: length = -t:1/fs:tncyc::Int64: : number of cycles, width, SD of the Gaussiana::Real=1: peak amp
Returns
g::Vector{Float64}
NeuroAnalyzer.generate_morlet — Function
generate_morlet(fs, f, t; <keyword arguments>)Generate Morlet wavelet.
Arguments
fs::Int64: sampling ratef::Real: frequencyt::Real=1: wavelet length is-t:1/fs:tncyc::Int64=5: number of cyclescomplex::Bool=false: generate complex Morlet
Returns
morlet::Union{Vector{Float64}, Vector{ComplexF64}}
NeuroAnalyzer.generate_morlet_fwhm — Function
generate_morlet_fwhm(fs, f, t; <keyword arguments>)Generate Morlet wavelet using FWHM (full width at half maximum) formula.
Arguments
fs::Int64: sampling ratef::Real: frequencyt::Real=1: length = -t:1/fs:th::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_noise — Function
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_signal — Function
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_sinc — Function
generate_sinc(t, f, peak, norm)Generate sinc function.
Arguments
t::AbstractVector=-2:0.01:2: time- `f::Real=1.0: frequency
peak::Real=0: sinc peak timenorm::Bool=true: generate normalized function
Returns
s::Vector{Float64}
NeuroAnalyzer.generate_sine — Function
generate_sine(f, t, a, p)Generate sine wave.
Arguments
f::Real: frequency [Hz]t::AbstractVector: time vectora::Real: amplitude, sine amplitude will be in[-amp, +amp]p::Real: phase shift [degrees]
Returns
- s::Vector{Float64}`
NeuroAnalyzer.generate_square — Function
generate_square(t, a, p, w, offset)Generate square wave.
Arguments
t::AbstractVector: time vectora::Real: amplitudep::Real: duty cyclew::Real: widthoffset::Real: amplitude offset
Returns
s::Vector{Float64}
NeuroAnalyzer.generate_triangle — Function
generate_triangle(t, a)Generate triangle wave.
Arguments
t::AbstractVector: time vectora::Real: amplitude
Returns
s::Vector{Float64}
NeuroAnalyzer.generate_window — Function
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 lengtheven::Bool=false: if true, make the window of even length (increase length by 1 for odd value ofn)
Returns
w::Vector{Float64}:: generated window
NeuroAnalyzer.gradient — Function
gradient(x; <keyword arguments>)Calculate gradient of a 1-dimensional scalar field.
Arguments
x::AbstractVectorrev::Bool=false: by default the direction of the gradient vector field is towards maximum value, ifrev=true, the direction is towards the minimum value
Returns
Named tuple containing:
g::Vector{Vector{Float64}}: vector field of gradientsg_len::Vector{Float64}: scalar field of gradient lengths
gradient(x; <keyword arguments>)Calculate gradient of a 2-dimensional scalar field.
Arguments
x::AbstractMatrixrev::Bool=false: by default the direction of the gradient vector field is towards maximum value, ifrev=true, the direction is towards the minimum value
Returns
Named tuple containing:
g::Matrix{Vector{Float64}}: vector field of gradientsg_len::Matrix{Float64}: scalar field of gradient lengths
gradient(x; <keyword arguments>)Calculate gradient of a ≥3-dimensional scalar field.
Arguments
x::AbstractArrayrev::Bool=false: by default the direction of the gradient vector field is towards maximum value, ifrev=true, the direction is towards the minimum value
Returns
Named tuple containing:
g::Array{Vector{Float64}, 3}: vector field of gradientsg_len::Array{Float64, 3}: scalar field of gradient lengths
NeuroAnalyzer.header — Function
header(obj; <keyword arguments>)Show object header.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.history — Function
history(obj)Show processing history.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
h::Vector{String}
NeuroAnalyzer.hz2rads — Function
hz2rads(f)Convert frequency in Hz to rad/s.
Arguments
f::Real
Returns
f_rads::Float64
NeuroAnalyzer.ifft0 — Function
ifft0(x, n)Perform IFFT of zero-padded vector.
Arguments
x::AbstractVectorn::Int64: number of zeros added tox
Returns
ifft0::Vector{ComplexF64}: reconstructed signal trimmed to original length
NeuroAnalyzer.iir_order — Function
iir_order(; <keyword arguments>)Calculate order of IIR filter.
Arguments
fprototype::Symbol: filter prototype::butterworth:chebyshev1:chebyshev2:elliptic
ftype::Symbol: filter type::lp: low pass:hp: high pass:bp: band pass:bs: band stop
cutoff::Union{Real, Tuple{Real, Real}}: filter cutoff in Hz (a pair of frequencies for band pass and band stop filters)bw::Real: transition band widthrp::Union{Nothing, Real}=nothing: ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: ripple amplitude in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersfs::Int64: sampling rate
Returns
n::Int64
iir_order(obj; <keyword arguments>)Calculate order of FIR filter using harris' formula.
Arguments
obj::NeuroAnalyzer.NEUROfprototype::Symbol: filter prototype::butterworth:chebyshev1:chebyshev2:elliptic
ftype::Symbol: filter type::lp: low pass:hp: high pass:bp: band pass:bs: band stop
cutoff::Union{Real, Tuple{Real, Real}}: filter cutoff in Hz (a pair of frequencies for band pass and band stop filters)bw::Real: transition band widthrp::Union{Nothing, Real}=nothing: ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: ripple amplitude in dB in the stop band; default: 40 dB for:elliptic, 20 dB for others
Returns
n::Int64
NeuroAnalyzer.info — Function
info(obj; <keyword arguments>)Show info.
Arguments
obj::NeuroAnalyzer.NEUROdf::Bool=false: if true, return object data as a DataFrame containing time points and channels
Returns
Union{Nothing, DataFrame}
NeuroAnalyzer.l1 — Function
l1(a1, a2)Compare two arrays (e.g. two spectrograms), using L1 (Manhattan) distance.
Arguments
a1::AbstractArray: first arraya2::AbstractArray: second array
Returns
l1::Float64
NeuroAnalyzer.l2 — Function
l2(a1, a2)Compare two arrays (e.g. two spectrograms), using L2 (Euclidean) distance.
Arguments
a1::AbstractArray: first arraya2::AbstractArray: second array
Returns
l2::Float64
NeuroAnalyzer.labels — Function
labels(obj)Return channel labels.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
l::Vector{String}
NeuroAnalyzer.linspace — Function
linspace(start, stop, length)Generates a sequence of evenly spaced numbers between start and stop.
Arguments
start::Numberstop::Numbern::Int64: sequence length
Returns
range::Vector{Float64}
NeuroAnalyzer.list_component — Function
list_component(obj)List component names.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
components::Union{Vector{Symbol}, Nothing}
NeuroAnalyzer.log10space — Function
log10space(start, stop, n)Generates a sequence of log10-spaced numbers between start and stop.
Arguments
start::Numberstop::Numbern::Int64: sequence length
Returns
range::Vector{Float64}
NeuroAnalyzer.log2space — Function
log2space(start, stop, n)Generates a sequence of log2-spaced numbers between start and stop.
Arguments
start::Numberstop::Numbern::Int64: sequence length
Returns
range::Vector{Float64}
NeuroAnalyzer.markers_s2t — Function
markers_s2t(m; <keyword arguments>)Convert markers start and length from samples to seconds.
Arguments
m::DataFrame: markersfs::Int64: sampling rate
Returns
m_new::DataFrame
markers_s2t(obj; <keyword arguments>)Convert markers start and length from samples to seconds.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
m_new::DataFrame
NeuroAnalyzer.markers_s2t! — Function
markers_s2t!(m; <keyword arguments>)Convert markers start and length from samples to seconds.
Arguments
m::DataFrame: markersfs::Int64: sampling rate
Returns
Nothing
markers_s2t!(obj; <keyword arguments>)Convert markers start and length from samples to seconds.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.maxat — Function
maxat(x, y)Find maximum value of one vector and return value at its index from another vector.
Argument
x::AbstractVectory::AbstractVector
Returns
value::Realidx::Int64
NeuroAnalyzer.meshgrid — Function
meshgrid(x)Create mesh grid (pair of x and y coordinates) from two vectors.
Arguments
x::Vector{Float64}y::Vector{Float64}
Returns
m::Tuple{Vector{Vector{Float64}}, Vector{Vector{Float64}}}
NeuroAnalyzer.minat — Function
minat(x, y)Find minimum value of one vector and return value at its index from another vector.
Argument
x::AbstractVectory::AbstractVector
Returns
value::Realidx::Int64
NeuroAnalyzer.mni2tal — Function
mni2tal(pts)Convert MNI coordinates to Talairach coordinates: a non-linear transform of MNI to Talairach coordinates.
Arguments
pts::Vector{<:Number}: MNI X, Y, Z coordinates
Returns
t::Vector{Float64}: Talairach X, Y, Z coordinates
Source
https://www.brainmap.org/training/BrettTransform.html
NeuroAnalyzer.m_norm — Function
m_norm(m)Normalize matrix.
Arguments
m::AbstractArray
Returns
m_norm::AbstractArray
NeuroAnalyzer.m_pad0 — Function
m_pad0(m)Pad matrix with zeros to make it square.
Arguments
m::AbstractMatrix
Returns
m::AbstractMatrix
m_pad0(m, r, c)Pad matrix with zeros to make its size r × c.
Arguments
m::AbstractMatrixr::Int64: number of rowsc::Int64: number of columns
Returns
m::AbstractMatrix
NeuroAnalyzer.m_sort — Function
m_sort(m, m_idx; <keyword arguments>)Sorts matrix using sorting index.
Arguments
m::AbstractMatrixm_idx::Vector{Int64}: sorting indexrev::Bool=false: reverse sortdims::Int64=1: sort by columns (dims=1) or by rows (dims=2)
Returns
m_sorted::AbstractMatrix
NeuroAnalyzer.m_sortperm — Function
m_sortperm(m; <keyword arguments>)Generates matrix sorting index.
Arguments
m::AbstractMatrixrev::Bool: reverse sortdims::Int64=1: sort by columns (dims=1) or by rows (dims=2)
Returns
idx::Matrix{Int64}
NeuroAnalyzer.nchannels — Function
nchannels(obj; <keyword arguments>)Return number type channels.
Arguments
obj::NeuroAnalyzer.NEUROtype::String="all": channel type (stored in the globalchannel_typesconstant variable)
Returns
ch_n::Int64
NeuroAnalyzer.nepochs — Function
nepochs(obj)Return number of epochs.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
ep_n::Int64
NeuroAnalyzer.nextpow2 — Function
nextpow2(x)Return the next power of 2 for a given number.
Argument
x::Int64
Returns
nextpow2::Int64
NeuroAnalyzer.ntapers — Function
ntapers(obj; df)Return recommended number of Slepian tapers for multi-taper power spectrum analysis.
Arguments
obj::NeuroAnalyzer.NEUROdf::Real: frequency resolution (bandwidth); smallest distance between frequency peaks that we want to observe (e.g. 1 Hz)
Returns
nt::Int64
NeuroAnalyzer.optode_labels — Function
optode_labels(obj)Return optode labels.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
l::Vector{String}
NeuroAnalyzer.pad0 — Function
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.pad2 — Function
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.padm — Function
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_labels — Function
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_cmp — Function
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 arraya2::Array{<:Real, 3}: second arrayp::Float64=0.05: p-valueperm_n::Int64=1000: number of permutations
Returns
Named tuple containing:
zmap::Matrix{Float64}: array of Z-valuesbm::BitMatrix: binarized mask of statistically significant positions
NeuroAnalyzer.phases — Function
phases(s)Calculate phases.
Arguments
s::AbstractVector
Returns
phases::Vector{Float64}
NeuroAnalyzer.play — Function
play(obj; <keyword arguments>)Play channel signal as audio.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameseg::Tuple{Real, Real}: time segment to playep::Int64: epoch number
Returns
Nothing
NeuroAnalyzer.rads2hz — Function
rads2hz(f)Convert frequency in rad/s to Hz.
Arguments
f::Real
Returns
f_rads::Float64
NeuroAnalyzer.rename_component — Function
rename_component(obj, c_old, c_new)Rename component.
Arguments
obj::NeuroAnalyzer.NEUROc_old::Symbol: old component namec_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.NEUROc_old::Symbol: old component namec_new::Symbol: new component name
Returns
Nothing
NeuroAnalyzer.reset_components — Function
reset_components(obj)Remove all components.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reset_components! — Function
reset_components!(obj)Remove all components.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.rfft0 — Function
rfft0(x, n)Perform zeros-padded single-sided FFT.
Arguments
x::AbstractVectorn::Int64: number of zeros to add
Returns
rfft0::Vector{ComplexF64}
NeuroAnalyzer.rfft2 — Function
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.s2t — Function
s2t(s, fs)Convert sample number to time in seconds.
Arguments
s::Real: sample numberfs::Int64: sampling rate
Returns
s2t::Float64: time in s
s2t(obj; <keyword arguments>)Convert time in samples to seconds.
Arguments
obj::NeuroAnalyzer.NEUROs::Int64: time in samples
Returns
s2t::Float64: time in seconds
NeuroAnalyzer.signal_duration — Function
signal_duration(obj)Return signal duration.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
sd::Float64
NeuroAnalyzer.signal_len — Function
signal_len(obj)Return signal length.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
sl::Int64
NeuroAnalyzer.source_labels — Function
source_labels(obj)Return NIRS source labels.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
l::Vector{String}
NeuroAnalyzer.sr — Function
sr(obj)Return sampling rate.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
fs::Int64
NeuroAnalyzer.t2f — Function
t2f(t)Convert cycle length in ms to frequency.
Arguments
t::Real: cycle length in ms
Returns
f::Float64: frequency in Hz
NeuroAnalyzer.t2s — Function
t2s(t, fs)Convert time in seconds to sample number.
Arguments
t::Real: time in sfs::Int64: sampling rate
Returns
t2s::Int64: sample number
t2s(obj; <keyword arguments>)Convert time in seconds to sample number.
Arguments
obj::NeuroAnalyzer.NEUROt::Real: time in seconds
Returns
t2s::Int64: sample number
NeuroAnalyzer.tal2mni — Function
Convert Talairach coordinates to MNI coordinates: a non-linear transform of MNI to Talairach coordinates.
Arguments
pts::Vector{<:Number}: Talairach X, Y, Z coordinates
Returns
m::Vector{Float64}: MNI X, Y, Z coordinates
Source
https://www.brainmap.org/training/BrettTransform.html
NeuroAnalyzer.tavg — Function
tavg(s)Average signal across trials.
Arguments
s::AbstractArray
Returns
s_new::AbstractArray
NeuroAnalyzer.to_df — Function
to_df(obj)Export object data as DataFrames.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
df::DataFrame: DataFrame containing time points and channels
NeuroAnalyzer.trtm — Function
trtm(obj; <keyword arguments>)Return signal channel in the form trials × time.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameep::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj)): epoch numbers; default use all epochs
Returns
s::Matrix{Float64}
NeuroAnalyzer.tuple_order — Function
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.vec2mat — Function
vec2mat(x; <keyword arguments>)Reshape vector into matrix using fixed segment length and overlapping.
Arguments
x::AbstractVectorwlen::Int64: window length (in samples)woverlap::Int64: overlap with the previous window (in samples)
Returns
m::AbstractMatrix
NeuroAnalyzer.view_header — Function
header(obj)Show keys and values of the object header.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.view_note — Function
view_note(obj)Return the object recording note.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
note::String
NeuroAnalyzer.vreduce — Function
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 dataf::AbstractVector: e.g. frequenciesn::Float64=0.5: reduce at multiplications of this value
Returns
x_new::AbstractVectorf_new::AbstractVector
NeuroAnalyzer.vsearch — Function
vsearch(y, x)Return the positions of the string in the vector of strings.
Arguments
y::String: value of interestx::Vector{String}: vector to search within
Returns
idx::Union{Int64, Nothing}
vsearch(y, x; <keyword arguments>)Return the positions of the value in the vector.
Arguments
y::Real: value of interestx::AbstractVector: vector to search withinacc::Bool=false: if true, return the difference betweenyandx[idx]
Returns
idx::Int64d::Real: the difference betweenyandx[idx]
vsearch(y, x; <keyword arguments>)Return the positions of the value in the vector.
Arguments
y::AbstractVector: vector of interestx::AbstractVector: vector to search withinacc::Bool=false: if true, return the difference betweenyandx[idx:idx + length(y)]
Returns
idx::Int64d::Real: the difference betweenyandx[idx:idx + length(y)]
NeuroAnalyzer.vsplit — Function
vsplit(x, n)Splits vector into pieces.
Argument
x::AbstractVectorn::Int64: length of one piece
Returns
x::Vector{AbstractVector}
Stats
NeuroAnalyzer.angle — Function
angle(x)Return the phase angles (in radians) of a vector with complex elements.
Arguments
x::Vector{ComplexF64}
Returns
angle::Vector{Float64}
NeuroAnalyzer.arf — Function
arf(df, var)Calculate absolute and relative frequencies.
Arguments
df::DataFramevar::Union{Symbol, String}: variable name
Returns
m::Matrix{Float64}: first row: absolute frequencies, second row: relative frequencies (proportion), third row: second row: relative frequencies (percentage); last column: totals
NeuroAnalyzer.ba — Function
ba(x, y; <keyword arguments>)Calculate Bland-Altman comparison between two clinical measurements.
Arguments
x::AbstractVectory::AbstractVectorla::FLoat64=0.95: 95% limits of agreement for each comparison (average difference ± 1.96 standard deviation of the difference)
Returns
Named tuple containing:
m::Float64: mean of the differences_u::Float64: +1.96 (for default la) × standard deviation of the differences_d::Float64: -1.96 (for default la) × standard deviation of the difference
Notes
To plot the Bland-Altman plot: p = hline([0, m]); hline!([0, s_u]); hline!([0, s-d])
NeuroAnalyzer.binom_prob — Function
binom_prob(p, r, n)Calculate probability of exactly r successes in n trials.
Arguments
p::Float64: proportion of successesr::Int64: number of successesn::Int64: number of trials
Returns
bp::Float64: probability
NeuroAnalyzer.binom_test — Function
binom_test(p, n; verbose)Test proportion against 0.5.
Arguments
p::Float64: proportion of level 1 observationsn::Int64: number of observationsverbose::Bool=true: print detailed output
Returns
Named tuple containing:
x0::Int64: level 0 countsx1::Int64: level 1 countsp0::Float64: level 0 proportionp1::Float64: level 1 proportionci0::Tuple{Float64, Float64}: level 1 proportion 95%CIci1::Tuple{Float64, Float64}: level 1 proportion 95%CIp::Float64: Binomial test p value
binom_test(x; verbose)Test proportion against 0.5.
Arguments
x::Vector{Bool}: vector of level 0 and 1 categoriesverbose::Bool=true: print detailed output
Returns
Named tuple containing:
x0::Int64: level 0 countsx1::Int64: level 1 countsp0::Float64: level 0 proportionp1::Float64: level 1 proportionci0::Tuple{Float64, Float64}: level 1 proportion 95%CIci1::Tuple{Float64, Float64}: level 1 proportion 95%CIp::Float64: Binomial test p value
binom_test(x, n; verbose)Test proportion against 0.5.
Arguments
x::Int64: number of level 1 observationsn::Int64: number of observationsverbose::Bool=true: print detailed output
Returns
Named tuple containing:
x0::Int64: level 0 countsx1::Int64: level 1 countsp0::Float64: level 0 proportionp1::Float64: level 1 proportionci0::Tuple{Float64, Float64}: level 1 proportion 95%CIci1::Tuple{Float64, Float64}: level 1 proportion 95%CIp::Float64: Binomial test p value
NeuroAnalyzer.biplot — Function
biplot(df, vars; <keyword arguments>)Plot PCA biplot.
Arguments
df::DataFramevars::Union{Vector{String}, Vector{Symbol}}: variable namesn::Int64: number of PCszstd::Bool=true: perform z score standardization before performing PCA
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.bootstrap_ci — Function
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 signaln2::Int64=1000: number of stage 2 resamplings - number of samples sampled from the signalcl::Float64=0.95: confidence level
Returns
Named tuple containing:
s_avg::Vector{Float64}: averaged signals_ci_l::Vector{Float64}: lower bound of the confidence intervals_ci_h::Vector{Float64}: upper bound of the confidence interval
NeuroAnalyzer.bootstrap_stat — Function
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 signaln2::Int64=1000: number of stage 2 resamplings - number of samples sampled from the signalf::String: statistic function to be applied, e.g.f="abs(maximum(obj))"; signal is given using variableobj` here.
Returns
out::AbstractVector
NeuroAnalyzer.center — Function
center(x)Center values by subtracting mean.
Arguments
x::AbstractVector
Returns
x::Vector{Float64}
NeuroAnalyzer.chi2p — Function
chi2p(chi; <keyword arguments>)Convert Χ² score to right-tailed (P(Chi > chi)) p value.
Arguments
chi::Real: Χ² scoredf::Real: degrees of freedom
Returns
p::Float64
Notes
To calculate P(Chi < chi) (left-tailed) use 1 - chi2p(chi, df=df).
NeuroAnalyzer.cim — Function
cim(x; <keyword arguments>)Calculate confidence interval for the mean.
Arguments
x::AbstractVectorcl::Float64=0.95: confidence leveld::Symbol=:t: distribution used for critical value calculation (:zor:t)twotailed::Bool=true: interval type, usetwotailed=falseto calculate lower and upper bound separately (both will be returned)
Returns
cim::Tuple{Float64, Float64}: lower and upper bound
NeuroAnalyzer.cimd — Function
cimd(x; <keyword arguments>)Calculate confidence interval for the median.
Arguments
x::AbstractVectorcl::Float64=0.95: confidence level
Returns
cimd::Tuple{Float64, Float64}
cimd(x; <keyword arguments>)Calculate confidence interval for the median.
Arguments
x::AbstractArraycl::Float64=0.95: confidence level
Returns
cimd::Tuple{Float64, Float64}
NeuroAnalyzer.cip — Function
cip(p, n; <keyword arguments>)Calculate confidence interval for the proportion.
Arguments
p::Float64: proportionn::Int64: sample sizecl::Float64=0.95: confidence level
Returns
cip::Tuple{Float64, Float64}
NeuroAnalyzer.cir — Function
cir(x, y; <keyword arguments>)Calculate confidence interval for the correlation coefficient.
Arguments
x::AbstractVectory::AbstractVectorcl::Float64=0.95: confidence level
Returns
cir::Tuple{Float64, Float64}
cir(; <keyword arguments>)Calculate confidence interval for the correlation coefficient.
Arguments
r::Float64: correlation coefficientn::Int64: number of observationscl::Float64=0.95: confidence level
Returns
cir::Tuple{Float64, Float64}
NeuroAnalyzer.cis — Function
cis(x; <keyword arguments>)Calculate confidence interval for the standard deviation.
Arguments
x::AbstractVectorcl::Float64=0.95: confidence level
Returns
cis::Tuple{Float64, Float64}: lower and upper bound
NeuroAnalyzer.civ — Function
civ(x; <keyword arguments>)Calculate confidence interval for the variance.
Arguments
x::AbstractVectorcl::Float64=0.95: confidence level
Returns
civ::Tuple{Float64, Float64}: lower and upper bound
NeuroAnalyzer.cl2z — Function
cl2z(ci; <keyword arguments>)Convert confidence level to z score.
Arguments
cl::Float64: confidence leveltwotailed::Bool=true: one- or two-tailed probability
Returns
z::Float64
Notes
The confidence interval is (-z, +z) if twotailed=true; otherwise it is (-∞, -z) on the left and (z, +∞) on the right.
NeuroAnalyzer.cmp_stat — Function
cmp_stat(stat_dist, v)Calculate proportion of elements below or above a given statistic value.
Arguments
stat_dist::AbstractVector: statistic values distributionv::Real: statistic valuetype::Symbol=:g: calculation proportion of elements greater (:g) or lesser (:l) thanv
Returns
p::Float64
NeuroAnalyzer.cmp_test — Function
cmp_test(seg1, seg2; <keyword arguments>)Compare two vectors. Jarque–Bera is used first to test normality of distribution, next variances are tested using F-test. Finally, paired or non-paired t-test or non-parametric test (Wilcoxon signed rank for paired data; Mann-Whitney U test for non-paired data) is applied. Permutation-based testing is also
Arguments
s1::AbstractVectors2::AbstractVectorpaired::Boolalpha::Float64=0.05: confidence leveltype::Symbol=:auto:auto: choose test automatically:perm: permutation-based:p: parametric:np: non-parametric
exact::Bool=false: if true, use exact Wilcoxon testnperm::Int64=1000: number of permutation for:permmethodverbose::Bool=true: print detailed output
Returns
For permutation-based test, named tuple containing:
t::Tuple{perm_diff::Vector{Float64}, obs_diff::Float64}: test result (permutation difference, observed difference)p1::Float64: one-tiled p valuep2::Float64: two-tiled p value
Otherwise, named tuple containing:
t::Union{OneSampleTTest, EqualVarianceTTest, UnequalVarianceTTest, ExactSignedRankTest, ApproximateSignedRankTest, ExactMannWhitneyUTest, ApproximateMannWhitneyUTest}: statistical testts::Tuple{Float64, String}: test statistic value and nametc::Tuple{Float64, Float64}: test statistic confidence intervaldf::Float64: degrees of freedomp::Float64: p value
NeuroAnalyzer.cor_test — Function
cor_test(seg1, seg2)Calculate correlation between two vectors.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
t::CorrelationTest{Float64}r::Float64: correlation coefficientrc::Tuple{Float64, Float64}: correlation coefficient confidence intervalts::Tuple{Float64, String}: t-statisticsdf::Int64: degrees of freedomp::Float64: p value
NeuroAnalyzer.count_thresh — Function
count_thresh(x; <keyword arguments>)Collect thresholded elements, e.g. in a topographical map.
Arguments
x::AbstractMatrixt::Real: threshold valuet_type::Symbol=:g: rule for thresholding::eq: =:geq: ≥:leq: ≤:g: >:l: <
Returns
Named tuple containing:
x_t::Matrix{Bool}: thresholded matrixn::Int64: number of elements
NeuroAnalyzer.crit_chi — Function
crit_chi(df, alpha)Calculate critical Χ² score.
Arguments
df::Real: degrees of freedom (usually df = n - 1)alpha::Float64=0.05: alpha value
Returns
chi::Float64
NeuroAnalyzer.crit_t — Function
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 valuetwotailed::Bool=true: 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.crit_z — Function
crit_z(alpha; <keyword arguments>)Calculate critical z score.
Arguments
alpha::Float64=0.05: alpha valuetwotailed::Bool=true: one- or two-tailed probability
Returns
z::Float64
Notes
Critical region for one- tailed probability:
- left:
(-∞ , -z] - right:
[z , ∞)
Critical region for two-tailed probability: (-∞ , -z] ∪ [z, ∞)
NeuroAnalyzer.cvm — Function
cvm(x)Calculate coefficient of variation for a mean.
Arguments
x::AbstractVector
Returns
cvm::Float64
NeuroAnalyzer.cvmd — Function
cvmd(x)Calculate coefficient of variation for a median.
Arguments
x::AbstractVector
Returns
cvmd::Float64
NeuroAnalyzer.dap — Function
dap(x)Calculate D'Agostino-Pearson Omnibus Test for normality.
Arguments
x::AbstractVector
Returns
Named tuple containing:
zs::Float64: skewness testzk::Float64: kurtosis testd::Float64: test statisticp::Float64: p value
NeuroAnalyzer.df — Function
df(x)Calculate degrees of freedom.
Arguments
x::AbstractVector
Returns
df::Int64
NeuroAnalyzer.distance — Function
distance(p1, p2)Calculate distance between two points.
Arguments
p1::Tuple{Real, Real}p2::Tuple{Real, Real}
Returns
d::Float64: distance
NeuroAnalyzer.dprime — Function
dprime(p1::Real, p2::Real)Calculate d' and response bias for two proportions.
Arguments
p1::Realp2::Real
Returns
Named tuple containing:
dp::Float64rb::Float64: response bias
NeuroAnalyzer.dranks — Function
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 (nbins = 1 + log2(length(x))))
Returns
sr::Array{Int64}
NeuroAnalyzer.efs — Function
efs(x1, x2)Calculate effect sizes.
Arguments
x1::AbstractVectorx2::AbstractVector
Returns
Named tuple containing:
d::Float64: Cohen's dg::Float64: Hedges g, uses maximum likelihood estimator by Hedges and OlkinΔ::Float64: Glass' Δ
NeuroAnalyzer.efs_p1g — Function
efs_p1g(p)Calculate Cohen's h effect size for one proportion.
Arguments
p::Float64: proportion
Returns
h::Float64
NeuroAnalyzer.efs_p2g — Function
efs_p2g(p1, p2; nd)Calculate Cohen's h effect size for two proportions p1 and p2.
Arguments
p1::Float64: 1st proportion, e.g. 0.7p2::Float64: 2nd proportion, e.g. 0.3nd::Bool=false: if true, calculate non-directional h value
Returns
h::Float64
NeuroAnalyzer.f1 — Function
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 positivestn::Int64: number of true negativesfp::Int64: number of false positivesfn::Int64: number of false negatives
Returns
Named tuple containing:
f1::Float64: F1-scorep::Float64: precisionr::Float64: recall
Source
https://www.statology.org/what-is-a-good-f1-score/
NeuroAnalyzer.f2p — Function
f2p(t; <keyword arguments>)Convert F score to right-tailed (P(F > f)) p value.
Arguments
f::Real: F score (F = var(x) / var(y))df1::Real: numerator degrees of freedom (DF1)df2::Real: denominator degrees of freedom (DF2)
Returns
p::Float64
Notes
To calculate P(F < f) (left-tailed) use 1 - f2p(f, df1=df1, df2=df2).
NeuroAnalyzer.fano — Function
fano(x)Calculate Fano factor.
Arguments
x::AbstractVector
Returns
fano::Float64
NeuroAnalyzer.friedman — Function
friedman(m)Estimate Friedman's nonparametric two-way analysis of variance (and Kendall's coefficient of concordance, normalized Friedman's Q statistics).
Arguments
m::AbstractArray: values × groups
Returns
Named tuple containing:
q::Float64: Friedman's Q statisticsw::Float64: Kendall's coefficient of concordancep::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.grubbs — Function
grubbs(x; <keyword arguments>)Perform Grubbs test for outlier.
Arguments
x::AbstractVectoralpha::Float64=0.95t::Int64=0: test type:-1: test whether the minimum value is an outlier0: two-tiled test1: test whether the maximum value is an outlier
Returns
g::Bool: true: outlier exists, false: there is no outlier
NeuroAnalyzer.hildebrand_rule — Function
hildebrand_rule(x; verbose)Calculate Hildebrand rule for vector x.
If H < 0.2 then the vector x is symmetric.
Arguments
x::AbstractVectorverbose::Bool=true: print detailed output
Returns
h::Float64
NeuroAnalyzer.infcrit — Function
infcrit(m)Calculate R², R² adjusted, 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:
R2::Float64R2adj::Float64bic::Float64bic::Float64
NeuroAnalyzer.jaccsim — Function
jaccsim(x, y)Calculate Jaccard similarity between two vectors.
Arguments
x::AbstractVectory::AbstractVector
Returns
j::Float64
Notes
To compute Jaccard distance, use 1 - jaccard(x, y)
NeuroAnalyzer.k_categories — Function
k_categories(n)Calculate number of categories for a given sample size n.
Arguments
n::Int64: sample size
Returns
Named tuple containing:
k1::Float64: sqrt(n)k2::Float64: 1 + 3.222 * log10(n)
NeuroAnalyzer.linreg — Function
linreg(x, y)Linear regression between two vectors.
Arguments
x::AbstractVectory::AbstractVector
Notes
To predict, use: `newx = DataFrame(x = [3.5, 7]); predict(lr, newx)
Returns
Named tuple containing:
lr::StatsModels.TableRegressionModel: modelc::Vector{Float64}: coefficientsse::Vector{Float64}: standard error for coefficientsR2::Float64: R²R2adj::Float64: R² adjustedaic::Float64:: Akaike’s Information Criterion (AIC)bic::Float64:: Bayesian Information Criterion (BIC)lf::Vector{Float64}: linear fit (plot(x, lf))
NeuroAnalyzer.logit — Function
logit(p)Convert proportion to logit.
Arguments
p::Float64: proportion
Returns
l::Float64
NeuroAnalyzer.make_table — Function
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.mcc — Function
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 positivestn::Int64: number of true negativesfp::Int64: number of false positivesfn::Int64: number of false negatives
Returns
mcc::Float64
Source
https://finnstats.com/index.php/2022/09/06/assess-performance-of-the-classification-model/
NeuroAnalyzer.mde — Function
mde(; <keyword arguments>)Calculate minimum detectable difference (MDE).
Arguments
n::Int64: number of subject per groups::Real: standard deviationalpha::Float64=0.05: the probability of type I errorbeta::Float64=0.20: the probability of type II errorverbose::Bool=true: print detailed output
Returns
mde::Float64
NeuroAnalyzer.meanc — Function
meanc(g, x)Calculate mean of categorical data.
Arguments
g::Vector{Int64}: group (e.g. [0, 1, 2, 3])x::Vector{Int64}: amount of subject per group (e.g. [2, 8, 27, 45])
Returns
m::Float64
NeuroAnalyzer.meancirc — Function
meancirc(x; <keyword arguments>)Calculate circular mean.
Arguments
x::AbstractVector: anglesrad::Bool=false: angles are provided in radians (rad=true) or degrees (rad=false)
Returns
m::Float64
NeuroAnalyzer.meang — Function
meang(x)Calculate geometric mean.
Arguments
x::AbstractVector
Returns
m::Float64
NeuroAnalyzer.meanh — Function
meanh(x)Calculate harmonic mean.
Arguments
x::AbstractVector
Returns
m::Float64
NeuroAnalyzer.meanp — Function
meanp(p, n)Calculate mean of the proportion.
Arguments
p::Float64: proportionn::Int64: number of observationsm::Float64
NeuroAnalyzer.meant — Function
meant(x; <keyword arguments>)Calculate trimmed mean.
Arguments
x::AbstractVectorn::Float64=0.1: percentage of extreme values to trim from both ends
Returns
m::Float64
NeuroAnalyzer.meanw — Function
meanw(x, w)Calculate weighted mean.
Arguments
x::AbstractVectorw::AbstractVector: weights
Returns
m::Float64
NeuroAnalyzer.moe — Function
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.mrng — Function
mrng(x)Calculate midrange.
Arguments
x::AbstractArray
Returns
mr::Float64
NeuroAnalyzer.mscr — Function
mscr(; <keyword arguments>)Assess performance of the classification model using misclassification rate.
Arguments
tp::Int64: number of true positivestn::Int64: number of true negativesfp::Int64: number of false positivesfn::Int64: number of false negatives
Returns
Named tuple containing:
mr::Float64: misclassification rateacc::Float64: accuracy
Source
https://www.statology.org/misclassification-rate/
NeuroAnalyzer.na — Function
na(x)Return values of x ignoring NaNs and Missing values.
Arguments
x::AbstractVector
Returns
x::Vector{Float64}
NeuroAnalyzer.norminv — Function
norminv(x::Real)Convert probability to a normal distribution with a peak at 0.5.
Arguments
x::Real
Returns
n::Float64
NeuroAnalyzer.npca — Function
npca(m; <keyword arguments>)Calculate recommended number of Primary Components (PCs).
Arguments
m::Matrix{Float64}: observations × variableszstd::Bool=true: perform z score standardization before performing PCAtype::Symbol:var: use total variation:eig: use eigenvalue
value::Real: minimum % of total variation or threshold for eigenvalues (keep the components with eigenvalues greater than the threshold)
Returns
n::Int64: recommended number of PCs
NeuroAnalyzer.o2p — Function
o2p(o::Float64)Convert probability to odds.
Arguments
o::Float64
Returns
p::Float64
NeuroAnalyzer.op — Function
op(x, y)Calculate outer product of two vectors.
Arguments
x::AbstractVectory::AbstractVector
Returns
op::AbstractMatrix
NeuroAnalyzer.outlier_detect — Function
outlier_detect(x; <keyword arguments>)Detect outliers.
Arguments
x::AbstractVectormethod::Symbol=iqr: detecting methods::iqr: interquartile range:z: z-score:g: Grubbs test
Returns
o::Vector{Bool}: index of outliers
NeuroAnalyzer.p2o — Function
p2o(p::Float64)Convert probability to odds.
Arguments
p::Float64
Returns
o::Float64
NeuroAnalyzer.p2z — Function
p2z(p; <keyword arguments>)Convert p value to z score.
Arguments
p::Float64=0.05: p valuetwotailed::Bool=false: one- or two-tailed probability
Returns
z::Float64
NeuroAnalyzer.pcacomp — Function
pcacomp(m; <keyword arguments>)Calculate n first Primary Components (PCs).
Arguments
m::Matrix{Float64}: observations × variablesn=size(m, 2)::Int64: number of PCszstd::Bool=true: perform z score standardization before performing PCA
Returns
Named tuple containing:
pc::DataFrame: PC(1)..PC(n)pcv::Vector{Float64}: PC variances (fraction of total variance explained)pcm::Vector{Float64}: PC meanspcp::Matrix{Float64}: PC projectionspc_model::MultivariateStats.PCA{Float64}: PC model
pcacomp(df, vars; <keyword arguments>)Calculate n first Primary Components (PCs).
Arguments
df::DataFramevars::Union{Vector{String}, Vector{Symbol}}: variable namesn::Int64: number of PCszstd::Bool=true: perform z score standardization before performing PCA
Returns
Named tuple containing:
pc::DataFrame: PC(1)..PC(n)pcv::Vector{Float64}: PC variances (fraction of total variance explained)pcm::Vector{Float64}: PC meanspcp::Matrix{Float64}: PC projectionspc_model::MultivariateStats.PCA{Float64}: PC model
NeuroAnalyzer.permute — Function
permute(s, n)Permute signal data.
Arguments
s::AbstractVectorn::Int64: number of permutations
Returns
s_new::Matrix{Float64}
permute(s, n)Permute signal data.
Arguments
s::AbstractArrayn::Int64: number of permutations
Returns
s_new::Union{Array{Float64, 3}, Array{Float64, 4}}
NeuroAnalyzer.power_c1g — Function
power_c1g(; <keyword arguments>)Calculate study power for a continuous variable (group 1 vs population).
Arguments
m::Real: population means::Real: population standard deviationxbar::Real: study group meann::Int64: group sample sizealpha::Float64=0.05: the probability of type I error
Returns
p::Float64: study power
NeuroAnalyzer.power_c2g — Function
power_c2g(; <keyword arguments>)Calculate study power for a continuous variable (group 1 vs group 2).
Arguments
m1::Real: study group 1 means1::Real: study group 1 standard deviationn1::Int64: study group 1 sample sizem2::Real: study group 2 means2::Real: study group 2 standard deviationn2::Int64: study group 2 sample sizealpha::Float64=0.05: the probability of type I error
Returns
p::Float64: study power
NeuroAnalyzer.power_p1g — Function
power_p1g(; <keyword arguments>)Calculate study power for one proportion.
Arguments
p1::Float64: study group proportionp2::Float64: population proportionn1::Int64: study group sample sizealpha::Float64=0.05: the probability of type I error
Returns
p::Float64: study power
NeuroAnalyzer.power_p2g — Function
power_p2g(; <keyword arguments>)Calculate study power for two proportions.
Arguments
p1::Float64: study group 1 proportionp2::Float64: study group 2 proportionn1::Int64: study group 1 sample sizen2::Int64: study group 2 sample sizealpha::Float64=0.05: the probability of type I error
Returns
p::Float64: study power
NeuroAnalyzer.prank — Function
prank(x)Calculate percentile ranks.
Arguments
x::AbstractVector: the vector to analyze
Returns
p::Vector{Float64}: percentile ranks
NeuroAnalyzer.pred_int — Function
pred_int(n)Calculate the prediction interval (95% CI adjusted for sample size)
Arguments
n::Int64: sample size
Returns
pi::Float64
NeuroAnalyzer.r1r2_zscore — Function
r1r2_zscore(; <keyword arguments>)Calculate z score for the difference of two correlation coefficients.
Arguments
r1::Float64: correlation coefficient, group 1r2::Float64: correlation coefficient, group 2n1::Int64: number of observations, group 1n2::Int64: number of observations, group 2
Returns
z::Float64: z score
NeuroAnalyzer.res_norm — Function
res_norm(x, g)Test normal distribution of residuals.
Arguments
x::AbstractVector: data valuesg::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 distributionks_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.rfz — Function
rfz(r)Calculate Fischer's z transformations of correlation coefficient.
Arguments
r::Float64: correlation coefficient
Returns
z::Float64: z score
Notes
Formula: z = atanh(r), gives ∞ for r = 1.0 and -∞ for r = -1.0. This functions returns 18.36840028483855 (atanh(1 - eps())) for r = 1.0 and -18.36840028483855 (atanh(1 - eps())) for r = -1.0.
NeuroAnalyzer.rng — Function
rng(x)Calculate range.
Arguments
x::AbstractArray
Returns
r::Float64
NeuroAnalyzer.screeplot — Function
screeplot(df, vars; <keyword arguments>)Plot PCA scree plot.
Arguments
df::DataFramevars::Union{Vector{String}, Vector{Symbol}}: variable namesn::Int64: number of PCszstd::Bool=true: perform z score standardization before performing PCA
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.sdi — Function
sdi(x, y)Calculate Sorensen-Dice similarity index between two vectors.
Arguments
x::AbstractVectory::AbstractVector
Returns
sdi::Float64
Notes
Sorensen-Dice Index values range from 0 to 1:
- 0.80-1.00: very high similarity
- 0.60-0.79: high similarity
- 0.40-0.59: moderate similarity
- 0.20-0.39: low similarity
- 0.00-0.19: very low similarity
NeuroAnalyzer.sek — Function
sek(x)Calculate standard error of the kurtosis.
Arguments
x::AbstractVector
Returns
s::Float64
ses(n)Calculate standard error of the skewness.
Arguments
n::Int64: number of observations
Returns
s::Float64
NeuroAnalyzer.sem — Function
sem(x)Calculate standard error of the mean.
Arguments
x::AbstractVector
Returns
s::Float64
NeuroAnalyzer.semd — Function
semd(x)Calculate standard error of the median.
Arguments
x::AbstractVector
Returns
s::Float64
NeuroAnalyzer.sem_diff — Function
sem_diff(x, y)Calculate SEM (standard error of the mean) of difference between two means.
Arguments
x::AbstractVectory::AbstractVector
Returns
sd::Float64
NeuroAnalyzer.sen — Function
sen(n)Calculate standard error of the number.
Arguments
n::Int64: number of observations
Returns
s::Float64
NeuroAnalyzer.sen_diff — Function
sen_diff(n1, n2)Calculate standard error of the difference between two numbers.
Arguments
n1::Int64: number of observations in group 1n2::Int64: number of observations in group 2
Returns
s::Float64
NeuroAnalyzer.sep — Function
sep(p, n)Calculate standard error of the proportion.
Arguments
p::Float64: proportionn::Int64: number of observations
Returns
s::Float64
NeuroAnalyzer.sep_diff — Function
sep_diff(p1, p2, n1, n2)Calculate standard error of the difference of two proportions.
Arguments
p1::Float64: proportion 1p2::Float64: proportion 1n1::Int64: number of observations in group 1n2::Int64: number of observations in group 2
Returns
s::Float64
NeuroAnalyzer.ses — Function
ses(x)Calculate standard error of the skewness.
Arguments
x::AbstractVector
Returns
s::Float64
ses(n)Calculate standard error of the skewness.
Arguments
n::Int64: number of observations
Returns
s::Float64
NeuroAnalyzer.size_c1diff — Function
size_c1diff(; <keyword arguments>)Calculate required sample size for detecting a difference in a continuous variable (group 1 vs population).
Arguments
s1::Real: study study standard deviation that we want to detects2::Real: population standard deviationtwotailed::Bool=true: if true, the estimation is for two-tiled differencepower::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, wherebetais the probability of type II error)
Returns
n::Int64: study sample size
NeuroAnalyzer.size_c1g — Function
size_c1g(; <keyword arguments>)Calculate required sample size for a continuous variable (group 1 vs population).
Arguments
m::Real: population means::Real: population standard deviationxbar::Real: study group meanalpha::Float64=0.05: the probability of type I errorpower::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_c2g — Function
size_c2g(; <keyword arguments>)Calculate required sample size for a continuous variable (group 1 vs group 2).
Arguments
m1::Real: study group 1 means1::Real: study group 1 standard deviationm2::Real: study group 2 mean (expected)r::Int64=1: enrollment ratio - the ratio of group 2 to group 1 enrollmentalpha::Float64=0.05: the probability of type I errorpower::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 sizen2::Int64: group 2 sample size
NeuroAnalyzer.size_m — Function
size_m(; <keyword arguments>)Calculate required sample size for estimating sample mean.
Arguments
sigma::Real: population standard deviationalpha::Float64=0.05: the probability of type I errorE::Real: margin of error (error of sample mean estimation)
Returns
n::Int64: sample size
NeuroAnalyzer.size_p — Function
size_p(; <keyword arguments>)Calculate required sample size for estimating proportion.
Arguments
p::Union{Float64, Nothing}: study group proportion, omit if unknownalpha::Float64=0.05: the probability of type I errorE::Float64: margin of error (error of sample proportion estimation)
Returns
n::Int64: sample size
NeuroAnalyzer.size_p1diff — Function
size_p1diff(; <keyword arguments>)Calculate required sample size for detecting a difference in a proportion (group 1 vs population).
Arguments
p1::Float64: study group proportion that we want to detectp2::Float64: population proportionpower::Float64=0.8: the ability to detect a difference between groups (power = 1 - beta, wherebetais the probability of type II error)
Returns
n::Int64: study sample size (for both study groups)
NeuroAnalyzer.size_p1g — Function
size_p1g(; <keyword arguments>)Calculate required sample size for a proportion (group 1 vs population).
Arguments
p1::Float64: population proportionp2::Float64: study group proportionalpha::Float64=0.05: the probability of type I errorpower::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_p2g — Function
size_p2g(; <keyword arguments>)Calculate required sample size for a proportion (group 1 vs group 2).
Arguments
p1::Float64: study group 1 proportionp2::Float64: study group 2 proportionr::Int64=1: enrollment ratio - the ratio of group 2 to group 1 enrollmentalpha::Float64=0.05: the probability of type I errorpower::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 sizen2::Int64: group 2 sample size
NeuroAnalyzer.slope — Function
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.stdc — Function
stdc(g, x)Calculate standard deviation of categorical data.
Arguments
g::Vector{Int64}: group (e.g. [0, 1, 2, 3])x::Vector{Int64}: amount of subject per group (e.g. [2, 8, 27, 45])
Returns
σ::Float64
NeuroAnalyzer.stdp — Function
stdp(p, n)Calculate standard deviation of the proportion.
Arguments
p::Float64: proportionn::Int64: number of observations
Returns
σ::Float64
stdp(x1, x2; <keyword arguments>)Calculate pooled standard deviation.
Arguments
x1::AbstractVectorx2::AbstractVectortype::Symbol=:cohen: use Cohen's equation (:cohen) or maximum likelihood estimator by Hedges and Olkin (:hedges)
Returns
sp::Float64
stdp(s1, s2, n1, n2; <keyword arguments>)Calculate pooled standard deviation when number of subjects in groups are different.
Arguments
s1::Reals2::Realn1::Int64n2::Int64type::Symbol=:cohen: use Cohen's equation (:cohen) or maximum likelihood estimator by Hedges and Olkin (:hedges)
Returns
ps::Float64
stdp(s1, s2)Calculate pooled standard deviation when number of subjects in groups are equal.
Arguments
s1::Reals2::Real
Returns
ps::Float64
NeuroAnalyzer.summary — Function
summary(x; g)Return summary statistics.
Arguments
x::AbstractVectorg::String="": group name
Returns
Named tuple containing:
n::Int64: number of observationsms::Int64: missingsmm::Float64: meanv::Float64: variances::Float64: standard deviationmin::Float64: minimumq1::Float64: 1st quartilemd::Float64: medianq3::Float64: 3rd quartilemax::Float64: maximummo::Float64: mode
summary(x; g, d)Return summary statistics.
Arguments
x::AbstractMatrixg::Vector{String}: group namesd::Int64: round toddigits
Returns
- df::DataFrame containing: - :group: group name - :n: number of observations - :missing: missings - :m: mean - :v: variance - :s: standard deviation - :min: minimum - :Q1: 1st quartile - :median: median - :Q3: 3rd quartile - :max: maximum - :mode: mode
summary(x; g, d)Return summary statistics.
Arguments
x::AbstractMatrixg::Vector{String}: group namesd::Int64: round toddigits
Returns
- df::DataFrame containing: - :group: group name - :n: number of observations - :missing: missings - :m: mean - :v: variance - :s: standard deviation - :min: minimum - :Q1: 1st quartile - :median: median - :Q3: 3rd quartile - :max: maximum - :mode: mode
NeuroAnalyzer.sumsq — Function
sumsq(x)Calculate sum of squares.
Arguments
x::AbstractVector
Returns
s::Float64
NeuroAnalyzer.t2p — Function
t2p(t; <keyword arguments>)Convert t score to p value.
Arguments
t::Real: t scoredf::Real: degrees of freedomtwotailed::Bool=false: one- (P(Z > t)) or two-tailed (P(T < -t or T > t)) probability
Returns
p::Float64
Notes
To calculate:
P(T < t)(left-tailed) use1 - t2p(t, df=df, twotailed=false)P(-t < T < t)use1 - t2p(t, df=df, twotailed=true)P(0 < T < t)use(1 - t2p(t, df=df, twotailed=true))/2
NeuroAnalyzer.varc — Function
varc(g, x)Calculate variance of categorical data.
Arguments
g::Vector{Int64}: group (e.g. [0, 1, 2, 3])x::Vector{Int64}: amount of subject per group (e.g. [2, 8, 27, 45])
Returns
σ2::Float64
NeuroAnalyzer.varp — Function
varp(p, n)Calculate variance of the proportion.
Arguments
p::Float64: proportionn::Int64: number of observations
Returns
σ2::Float64
NeuroAnalyzer.z2p — Function
z2p(z; <keyword arguments>)Convert z score to p value.
Arguments
z::Real: z valuetwotailed::Bool=false: one- (P(Z > z)) or two-tailed (P(Z < -z or Z > z)) probability
Returns
p::Float64
Notes
To calculate:
P(Z < z)(left-tailed) use1 - z2p(z, twotailed=false)P(-z < Z < z)use1 - z2p(z, twotailed=true)P(0 < Z < z)use(1 - z2p(z, twotailed=true))/2
NeuroAnalyzer.zscore — Function
zscore(x)Calculate z-scores for each value of the vector x.
Arguments
x::AbstractVector
Returns
z::Vector{Float64}
zscore(x, m, sd)Calculate z-score for x.
Arguments
x::Realm::Real: meansd::Real: standard deviation
Returns
z::Float64
IO
NeuroAnalyzer.export_csv — Function
export_csv(obj; <keyword arguments>)Export NeuroAnalyzer.NEURO object to CSV.
Arguments
obj::NeuroAnalyzer.NEUROfile_name::Stringnames::Bool=true: export channel namesheader::Bool=false: export headerepoch_time::Bool=false: export epoch time pointscomponents::Bool=false: export componentsmarkers::Bool=false: export event markerslocs::Bool=false: export channel locationshistory::Bool=false: export historyoverwrite::Bool=false
Returns
Nothing
NeuroAnalyzer.export_locs — Function
export_locs(obj; <keyword arguments>)Export channel locations data, format is based on file_name extension (.csv, .ced, .locs or .tsv)
Arguments
obj::NeuroAnalyzer.NEUROfile_name::Stringoverwrite::Bool=false
Returns
Nothing
export_locs(locs; <keyword arguments>)Export channel locations, format is based on file_name extension (.ced, .locs, .tsv)
Arguments
locs::DataFramefile_name::Stringoverwrite::Bool=false
Returns
Nothing
NeuroAnalyzer.export_markers — Function
export_markers(obj; <keyword arguments>)Export NeuroAnalyzer.NEURO object markers to CSV.
Arguments
obj::NeuroAnalyzer.NEUROfile_name::Stringoverwrite::Bool=false
Returns
Nothing
NeuroAnalyzer.import_alice4 — Function
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 loaddetect_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_bdf — Function
import_bdf(file_name; <keyword arguments>)Load BDF/BDF+ file and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to loaddetect_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_bv — Function
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_cnt — Function
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 loaddetect_type::Bool=true: detect channel type based on its labeldata_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_csv — Function
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 loaddetect_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_dat — Function
import_dat(file_name)Load Neuroscan DAT file.
Arguments
file_name::String: name of the file to load
Returns
dat::DataFrame
NeuroAnalyzer.import_digitrack — Function
import_digitrack(file_name; <keyword arguments>)Load Digitrack ASCII file and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to loaddetect_type::Bool=true: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_duomag — Function
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_edf — Function
import_edf(file_name; <keyword arguments>)Load EDF/EDF+ file and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to loaddetect_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
- 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
- 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
- https://www.edfplus.info/specs/
NeuroAnalyzer.import_edf_annotations — Function
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_fiff — Function
import_fiff(file_name)Load Elekta-Neuromag 306 FIFF (Functional Image File Format) file (MEG, EEG) and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to load
Returns
obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_ft — Function
import_ft(file_name; <keyword arguments>)Load FieldTrip file (.mat) and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to loadtype::Symbol: type of imported data:eeg: EEG:meg: MEG:nirs: fNIRS:events: events
detect_type::Bool=false: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO- for EEG, MEG, fNIRS datamarkers::DataFrame- for events
NeuroAnalyzer.import_gdf — Function
import_gdf(file_name; <keyword arguments>)Load GDF file and return NeuroAnalyzer.NEURO object.
Arguments
file_name::String: name of the file to loaddetect_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
- Schlögl A, Filz O, Ramoser H, Pfurtscheller G. GDF - A General Dataformat for Biosignals Version 1.25. 1998
- Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.12. 2009
- Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.51. 2013
NeuroAnalyzer.import_locs — Function
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_asc — Function
import_locs_asc(file_name)Load channel locations from ASC file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_ced — Function
import_locs_ced(file_name)Load channel locations from CED file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_csd — Function
import_locs_csd(file_name)Load channel locations from CSD file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_csv — Function
import_locs_csv(file_name)Load channel locations from CSV file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_dat — Function
import_locs_dat(file_name)Load channel locations from DAT file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_elc — Function
import_locs_elc(file_name)Load channel locations from ELC file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_geo — Function
import_locs_geo(file_name)Load channel locations from GEO file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_locs — Function
import_locs_locs(file_name)Load channel locations from LOCS file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_mat — Function
import_locs_mat(file_name)Load channel locations from MAT file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_sfp — Function
import_locs_sfp(file_name)Load channel locations from SFP file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_tsv — Function
import_locs_tsv(file_name)Load channel locations from TSV file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_locs_txt — Function
import_locs_txt(file_name)Load channel locations from TXT file.
Arguments
file_name::String
Returns
locs::DataFrame
NeuroAnalyzer.import_montage — Function
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-CzorFp1
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 pairsref_name::String: name of the montage
NeuroAnalyzer.import_ncs — Function
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_nirs — Function
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_nirx — Function
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_npy — Function
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 loadsampling_rate::Int64: NPY file contains only signal data, therefore its sampling rate must be provided upon importing
Returns
obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_nwb — Function
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 loaddetect_type::Bool=true: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Source
- https://www.biorxiv.org/content/10.1101/523035v1
NeuroAnalyzer.import_recording — Function
import_recording(file_name; <keyword arguments>)Load recording file and return NeuroAnalyzer.NEURO object. Supported formats:
- EDF/EDF+
- BDF/BDF+
- GDF
- BrainVision
- CSV or CSV.GZ
- VHDR or AHDR (BrainVision)
- SET (EEGLAB dataset)
- NPY (MNE)
- XDF (Extensible Data Format)
- NWB (Neurodata Without Borders)
- NCS (Neuralinx Continuously Sampled Channels (CSC))
- FIFF (Neuromag)
- MAT (FieldTrip)
- SNIRF
- NIRS
- ASCII or M (DuoMAG TMS MEP)
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|.npy|.xdf|.nwb|.ncs|.fif|.fiff|.mat|.snirf|.nirs|.ascii|.m). Signal data type (e.g. EEG or MEG is auto-detected, if possible) and stored in the obj.header.recording[:data_type] field.
Arguments
file_name::String: name of the file to loaddetect_type::Bool=true: detect channel type based on channel labeltype::Union{Nothing, Symbol}=nothing: type of imported data (required for FieldTrip files):eeg: EEG:meg: MEG:nirs: fNIRS:events: events
n::Int64=0: subject number to extract in case of multi-subject file (required for SNIRF files)sampling_rate::Union{Nothing, Int64}=nothing: NPY file contains only signal data, therefore its sampling rate must be provided upon importing
Returns
obj::NeuroAnalyzer.NEURO- for EEG, MEG, fNIRS datamarkers::DataFrame- for events
NeuroAnalyzer.import_set — Function
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 loaddetect_type::Bool=true: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Source
- https://eeglab.org/tutorials/ConceptsGuide/Data_Structures.html
NeuroAnalyzer.import_snirf — Function
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 loadn::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_thymatron — Function
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::Union{String, Vector{String}}: name(s) of the file(s) to loaddpi::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_xdf — Function
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.load — Function
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_fiff — Function
load_fiff(file_name)Load Elekta-Neuromag 306 FIFF (Functional Image File Format) file (MEG, EEG) 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_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
- CSV
Channel locations:
loc_theta: polar angleloc_radius: polar radiusloc_x: spherical Cartesian xloc_y: spherical Cartesian yloc_z: spherical Cartesian zloc_radius_sph: spherical radiusloc_theta_sph: spherical horizontal angleloc_phi_sph: spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEUROfile_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 angleloc_radius: polar radiusloc_x: spherical Cartesian xloc_y: spherical Cartesian yloc_z: spherical Cartesian zloc_radius_sph: spherical radiusloc_theta_sph: spherical horizontal angleloc_phi_sph: spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEUROfile_name::String
Return
Nothing
NeuroAnalyzer.save — Function
save(obj; <keyword arguments>)Save NeuroAnalyzer.NEURO object to file_name file (HDF5-based).
Arguments
obj::NeuroAnalyzer.NEUROfile_name::String: name of the file to save tooverwrite::Bool=false
Return
Nothing
Edit
NeuroAnalyzer.add_channel — Function
add_channel(obj; <keyword arguments>)Add channels data to an empty NeuroAnalyzer.NEURO object.
Arguments
obj::NeuroAnalyzer.NEUROdata::Array{<:Number, 3}: channels datalabel::Union{String, Vector{String}}: channels labelstype::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.NEUROdata::Array{<:Number, 3}: channels datalabel::Union{String, Vector{String}}: channels labelstype::Union{String, Vector{String}}: channels types
Returns
Nothing
NeuroAnalyzer.add_label — Function
add_label(obj; <keyword arguments>)Add channel labels.
Arguments
obj::NeuroAnalyzer.NEUROclabels::Vector{String}
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_label! — Function
add_label!(obj; <keyword arguments>)Add channel labels.
Arguments
obj::NeuroAnalyzer.NEUROclabels::Vector{String}
Returns
Nothing
NeuroAnalyzer.add_marker — Function
add_marker(obj; <keyword arguments>)Add marker.
Arguments
obj::NeuroAnalyzer.NEUROid::String: marker IDstart::Real: marker time in secondslen::Real=1.0: marker length in secondsvalue::String: marker valuech::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, value, ch)Add marker.
Arguments
obj::NeuroAnalyzer.NEUROid::String: marker IDstart::Real: marker time in secondslen::Real=1.0: marker length in secondsvalue::String: marker valuech::Int64=0: channel number, if 0 then marker is related to all channels
Returns
Nothing
NeuroAnalyzer.add_markers — Function
add_markers(obj; markers)Add markers.
Arguments
obj::NeuroAnalyzer.NEUROmarkers::DataFrame
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_markers! — Function
add_markers!(obj; markers)Add markers.
Arguments
obj::NeuroAnalyzer.NEUROmarkers::DataFrame
Returns
Nothing
NeuroAnalyzer.channel2marker — Function
channel2marker(obj; <keyword arguments>)Convert event channel to markers.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel namev::Real=1.0: event channel value interpreted as an eventid::String: prefix for marker ID; default is based on event channel name (e.g. "stim1_")value::String="": marker value; 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.NEUROch::String: channel namev::Real=1.0: event channel value interpreted as an eventid::String: prefix for marker ID; default is "mrk_"value::String="": prefix for marker value; default is based on event channel name (e.g. "stim1_")
Returns
Nothing
NeuroAnalyzer.channel_type — Function
channel_type(obj; <keyword arguments>)Get channel type.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel name
Returns
cht::String
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.NEUROn::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.NEUROn::Int64=sr(obj): number of samples to remove, default is 1 second
Returns
Nothing
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.NEUROdata::Array{Float64, 3}fs::Int64type::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.NEUROdata::Array{Float64, 3}fs::Int64type::String: channel types of imported data channels
Returns
Nothing
NeuroAnalyzer.create_object — Function
create_object(; <keyword arguments>)Create an empty NeuroAnalyzer.NEURO object.
Arguments
data_type::String: data type of the new object
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.NEUROfs::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.NEUROfs::Int64
Returns
Nothing
NeuroAnalyzer.delete_channel — Function
delete_channel(obj; <keyword arguments>)Delete channel(s).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channels to be removeddel_opt::Bool=false: for NIRS data is set astrueif called fromremove_optode()
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_channel! — Function
delete_channel!(obj; <keyword arguments>)Delete channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channels to be removeddel_opt::Bool=false: for NIRS data is set astrueif called fromremove_optode()
Returns
Nothing
NeuroAnalyzer.delete_epoch — Function
delete_epoch(obj; <keyword arguments>)Remove epochs.
Arguments
obj::NeuroAnalyzer.NEUROep::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.NEUROep::Union{Int64, Vector{Int64}, AbstractRange}: epoch numbers to be removed
Returns
Nothing
NeuroAnalyzer.delete_marker — Function
delete_marker(obj; <keyword arguments>)Delete marker.
Arguments
obj::NeuroAnalyzer.NEUROn::Int64: marker number
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_marker! — Function
delete_marker!(obj; n)Delete marker.
Arguments
obj::NeuroAnalyzer.NEUROn::Int64: marker number
Returns
Nothing
NeuroAnalyzer.delete_optode — Function
delete_optode(obj; <keyword arguments>)Delete optodes) and channels associated with removed optodes.
Arguments
obj::NeuroAnalyzer.NEUROopt::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.NEUROopt::Union{Int64, Vector{Int64}, AbstractRange}: optopode number(s) to be removed
Returns
Nothing
NeuroAnalyzer.detect_bad — Function
detect_bad(obj; <keyword arguments>)Detect bad channels and epochs.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesmethod::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_rat more thanransac_trof 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 withinw-width window)flat_tol::Float64=0.1: tolerance (signal is flat within-tolto+tol),eps()gives very low toleranceflat_fr::Float64=0.3: acceptable ratio (0.0 to 1.0) of flat segments within a channel before marking it as flatp::Float64=0.99: probability threshold (0.0 to 1.0) for marking a channel as bad; also threshold for:p2pdetection: abovemean + p * stdand belowmean - 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:zmethod: percentage of channel length per epoch for marking a channel as badtc::Float64=0.3: threshold (0.0 to 1.0) of bad channels ratio to mark the epoch as badtkeo_method::Symbol=:pow: method of calculating TKEO, seetkeo()for detailsz::Real=3: threshold number of z-scoresransac_r::Float64=0.8: threshold (0.0 to 1.0) correlation between channelsransac_tr::Float64=0.4: threshold (0.0 to 1.0) ratio of uncorrelated channelsransac_t::Float64=100.0: threshold distance of a sample point to the regression hyperplane to determine if it fits the model wellamp_t::Float64=400.0: two-sided rejection amplitude threshold (± 400 μV)
Returns
Named tuple containing:
bm::Matrix{Bool}: matrix of bad channels × epochsbe::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesmethod::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_rat more thanransac_trof 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 withinw-width window)flat_tol::Float64=0.1: tolerance (signal is flat within-tolto+tol),eps()gives very low toleranceflat_fr::Float64=0.3: acceptable ratio (0.0 to 1.0) of flat segments within a channel before marking it as flatp::Float64=0.99: probability threshold (0.0 to 1.0) for marking a channel as bad; also threshold for:p2pdetection: abovemean + p * stdand belowmean - 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:zmethod: percentage of channel length per epoch for marking a channel as badtc::Float64=0.3: threshold (0.0 to 1.0) of bad channels ratio to mark the epoch as badtkeo_method::Symbol=:pow: method of calculating TKEO, seetkeo()for detailsz::Real=3: threshold number of z-scoresransac_r::Float64=0.8: threshold (0.0 to 1.0) correlation between channelsransac_tr::Float64=0.4: threshold (0.0 to 1.0) ratio of uncorrelated channelsransac_t::Float64=100.0: threshold distance of a sample point to the regression hyperplane to determine if it fits the model wellamp_t::Float64=400.0: two-sided rejection amplitude threshold (± 400 μV)
Returns
Nothing
NeuroAnalyzer.edit_channel — Function
edit_channel(obj; <keyword arguments>)Edit channel properties (:channel_type or :label) in OBJ.header.recording.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel namefield::Symbolvalue::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.NEUROch::String: channel namefield::Symbolvalue::String
Returns
Nothing
NeuroAnalyzer.edit_marker — Function
edit_marker(obj; <keyword arguments>)Edit marker.
Arguments
obj::NeuroAnalyzer.NEUROn::Int64: marker numberid::String: marker IDstart::Real: marker time in secondslen::Real=1.0: marker length in secondsvalue::String: marker valuech::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, value, ch)Edit marker.
Arguments
obj::NeuroAnalyzer.NEUROn::Int64: marker numberid::String: marker IDstart::Real: marker time in secondslen::Real=1: marker length in secondsvalue::String: marker valuech::Int64=0: channel number, if 0 then marker is related to all channels
Returns
Nothing
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.NEUROmarker::String="": marker value to split atoffset::Real=0: time offset (in seconds) for marker-based epoching (each epoch time will start atmarker time - offset)ep_n::Union{Int64, Nothing}=nothing: number of epochsep_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.NEUROmarker::String="": marker value to split atoffset::Real=0: time offset (in seconds) for marker-based epoching (each epoch time will start atmarker time - offset)ep_n::Union{Int64, Nothing}=nothing: number of epochsep_len::Union{Real, Nothing}=nothing: epoch length in seconds
Returns
Nothing
NeuroAnalyzer.epoch_ts — Function
epoch_ts(obj; <keyword arguments>)Edit epochs time start.
Arguments
obj::NeuroAnalyzer.NEUROts::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.NEUROts::Real: time start in seconds
Returns
Nothing
NeuroAnalyzer.extract_channel — Function
extract_channel(obj; <keyword arguments>)Extract channel data.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel name
Returns
d::Array{Float64, 3}
NeuroAnalyzer.extract_data — Function
extract_data(obj; <keyword arguments>)Extract data.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesep::Union{Int64, Vector{Int64}, AbstractRange}=1:nepochs(obj): index of epochs, default is all epochstime::Bool=false: return time vectoretime::Bool=false: return epoch time vector
Returns
signal::Array{Float64, 3}time::Vector{Float64}etime::Vector{Float64}
NeuroAnalyzer.extract_epoch — Function
extract_epoch(obj; <keyword arguments>)Extract epoch.
Arguments
obj::NeuroAnalyzer.NEUROep::Int64: epoch index
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.extract_epoch! — Function
extract_epoch!(obj; <keyword arguments>)Extract epoch.
Arguments
obj::NeuroAnalyzer.NEUROep::Int64: epoch index
Returns
Nothing
NeuroAnalyzer.extract_eptime — Function
extract_eptime(obj)Extract epochs time.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
et::Vector{Float64}
NeuroAnalyzer.extract_time — Function
extract_time(obj)Extract time.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
tpts::Vector{Float64}
NeuroAnalyzer.get_channel — Function
get_channel(obj; <keyword arguments>)Return list of channel names of specified type or their numbers if names are specified.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}="": channel name or list of channel namestype::Union{String, Vector{String}}="all": channels typeswl::Real: return NIRS channels for wavelength (in nm)exclude::Union{String, Vector{String}, Regex}="": channel name or list of channel names to exclude from the list
Returns
ch::Union{Vector{String}, Vector{Int64}}
NeuroAnalyzer.join — Function
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.NEUROobj2::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.NEUROobj2::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.keep_channel — Function
keep_channel(obj; <keyword arguments>)Keep channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channels to keep
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_channel! — Function
keep_channel!(obj; <keyword arguments>)Keep channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channels to keep
Returns
Nothing
NeuroAnalyzer.keep_epoch — Function
keep_epoch(obj; <keyword arguments>)Keep epochs.
Arguments
obj::NeuroAnalyzer.NEUROep::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.NEUROep::Union{Int64, Vector{Int64}, AbstractRange}: epoch numbers to keep
Returns
Nothing
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.NEUROn::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.NEUROn::Int64=sr(obj): number of samples to add, default is 1 second
Returns
Nothing
NeuroAnalyzer.rename_channel — Function
rename_channel(obj; <keyword arguments>)Rename channel.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel namename::String: new name
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.rename_channel! — Function
rename_channel!(obj; <keyword arguments>)Rename channel.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel namename::String: new name
Returns
Nothing
NeuroAnalyzer.replace_channel — Function
replace_channel(obj; <keyword arguments>)Replace channel.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel names::AbstractArray
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.replace_channel! — Function
replace_channel!(obj; <keyword arguments>)Replace channel.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel names::Array{Float64, 3}: signal to replace with
Returns
Nothing
NeuroAnalyzer.set_channel_type — Function
set_channel_type(obj; <keyword arguments>)Set channel type.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nametype::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.NEUROch::String: channel nametype::String
Returns
Nothing
NeuroAnalyzer.subepoch — Function
subepoch(obj; <keyword arguments>)Extract sub-epochs with a reduced time range.
Arguments
obj::NeuroAnalyzer.NEUROep_start::Real: sub-epoch startep_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.NEUROep_start::Real: sub-epoch startep_end::Real: sub-epoch end
Returns
Nothing
NeuroAnalyzer.trim — Function
trim(s; <keyword arguments>)Remove segment from the signal.
Arguments
v::AbstractVectorseg::Tuple{Int64, Int64}: segment (from, to) in samplesinverse::Bool=false: if true, keep the segment
Returns
trim::Vector{Float64}
trim(m; <keyword arguments>)Remove segment from the signal.
Arguments
m::AbstractMatrixseg::Tuple{Int64, Int64}: segment (from, to) in samplesinverse::Bool=false: if true, keep the segment
Returns
trim::Matrix{Float64}
trim(a; <keyword arguments>)Remove segment from the signal.
Arguments
a::AbstractArrayseg::Tuple{Int64, Int64}: segment (from, to) in samplesinverse::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.NEUROseg::Tuple{Real, Real}: segment to be removed (from, to) in secondsinverse::Bool=false: if true, keep the segmentremove_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.NEUROseg::Tuple{Real, Real}: segment to be removed (from, to) in secondsinverse::Bool=false: if true, keep the segmentremove_epochs::Bool=true: if true, remove epochs containing signal to trim or remove signal and re-epoch trimmed signal
Returns
Nothing
NeuroAnalyzer.vch — Function
vch(obj; <keyword arguments>)Calculate virtual channel using formula f.
Arguments
obj::NeuroAnalyzer.NEUROf::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
NeuroAnalyzer.view_marker — Function
view_marker(obj)Show markers.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
Process
NeuroAnalyzer.add_signal — Function
add_signal(s1, s2)Add signal.
Arguments
s1::AbstractVector: target signals2::AbstractVector: signal to be added
Returns
s_noisy::AbstractVector
add_signal(obj; <keyword arguments>)Add signal.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namess::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namess::AbstractVector: signal to be added to each channel
Returns
Nothing
NeuroAnalyzer.apply_ssp_projectors — Function
apply_ssp_projectors(obj; <keyword arguments>)Apply SSP projectors from embedded projections.
Arguments
obj::NeuroAnalyzer.NEUROproj::Union{Int64, Vector{Int64}}=0: list of projections used for generating projectors, by default use all available projections
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.apply_ssp_projectors! — Function
apply_ssp_projectors!(obj; <keyword arguments>)Apply SSP projectors from embedded projections.
Arguments
obj::NeuroAnalyzer.NEUROproj::Union{Int64, Vector{Int64}}=0: list of projections used for generating projectors, by default use all available projections
Returns
Nothing
NeuroAnalyzer.artrem_cwd — Function
artrem_cwd(s, t; <keyword arguments>)Remove artifacts using continuous wavelet decomposition (CWD).
Arguments
s::AbstractVectort::AbstractVector: time pointsfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletstseg::Tuple{Real, Real}: artifact time locationfseg::Tuple{Real, Real}: artifact frequency locationtype::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
s_new::Vector{Float64}
artrem_cwd(obj; <keyword arguments>)Remove artifacts using continuous wavelet decomposition (CWD).
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameep::Int64wt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletstseg::Tuple{Real, Real}: artifact time locationfseg::Tuple{Real, Real}: artifact frequency locationtype::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.artrem_cwd! — Function
artrem_cwd!(obj; <keyword arguments>)Remove artifacts using continuous wavelet decomposition (CWD).
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameep::Int64wt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletstseg::Tuple{Real, Real}: artifact time locationfseg::Tuple{Real, Real}: artifact frequency locationtype::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
NeuroAnalyzer.average — Function
average(s)Average all channels.
Arguments
s::AbstractArray
Returns
average::AbstractArray
average(s1, s2)Averages two signals.
Arguments
s1::AbstractArrays2::AbstractArray
Returns
average::AbstractArray
average(obj; <keyword arguments>)Return the average signal of channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROobj2::NeuroAnalyzer.NEURO
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.average! — Function
average!(obj; <keyword arguments>)Return the average signal of channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
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.NEURObl::Tuple{Real, Real}=(0, 0): baseline is fromb[1]tob[2]seconds; ifblis greater than (0, 0), DC value is calculated as mean of theb[1]tob[2]seconds and subtracted from the signalblfirst::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.NEURObl::Tuple{Real, Real}=(0, 0): baseline is the firstblseconds; ifblis greater than 0, DC value is calculated as mean of the firstnsamples and subtracted from the signalblfirst::Bool=false: if true, subtract the baseline segment prior to averaging
Returns
Nothing
NeuroAnalyzer.bpsplit — Function
bpsplit(obj; <keyword arguments>)Split signal into frequency bands using a FIR band-pass filter.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesorder::Int64=91: number of taps for FIR band-pass filterw::Union{Nothing, AbstractVector, <:Real}=nothing: window for:firfilter (default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb)
Returns
Named tuple containing:
s::Array{Float64, 4}: split signalbn::Vector{Symbol}: band namesbf::Vector{Tuple{Real, Real}}: band frequencies
NeuroAnalyzer.cbp — Function
cbp(s; <keyword arguments>)Perform convolution band-pass filtering.
Arguments
s::AbstractVectorpad::Int64: pad withpadzerosfrq::Real: filter frequencyfs::Int64: sampling rate
Returns
cbp::Vector{Float64}
cbp(obj; <keyword arguments>)Perform convolution bandpass filtering.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64: pad thesignalwithpadzerosfrq::Real: filter frequency
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.cbp! — Function
cbp!(obj; <keyword arguments>)Perform convolution bandpass filtering.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64: pad thesignalwithpadzerosfrq::Tuple{Real, Real}: filter frequency
Returns
Nothing
NeuroAnalyzer.ch_zero — Function
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.csd — Function
csd(obj; <keyword arguments>)Transform data using Current Source Density (CSD) transformation based on spherical spline surface Laplacian.
Arguments
obj::NeuroAnalyzer.NEUROm::Int64=4: positive integer constant that affects spherical spline flexibility, highermvalues mean increased rigidityn::Int64=8: Legendre polynomial orderlambda::Float64=10^-5: smoothing factor
Returns
obj_new::NeuroAnalyzer.NEURO: withcsdchannel 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.NEUROm::Int64=4: positive integer constant that affects spherical spline flexibility, highermvalues mean increased rigidityn::Int64=8: Legendre polynomial orderlambda::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.cwd — Function
cwd(s; <keyword arguments>)Perform continuous wavelet decomposition (CWD).
Arguments
s::AbstractVectorwt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
ct::Matrix{Float64}: CWT coefficients (by rows)
cwd(s; <keyword arguments>)Perform continuous wavelet decomposition (CWD).
Arguments
s::AbstractArraywt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
ct::Array{Float64, 4}: CWT coefficients (by rows)
cwd(obj; <keyword arguments>)Perform continuous wavelet decomposition (CWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
ct::Array{Float64, 4}: CWT coefficients (by rows)
NeuroAnalyzer.denoise_cwd — Function
denoise_cwd(s; <keyword arguments>)Perform denoising using continuous wavelet decomposition (CWD).
Arguments
s::AbstractVectorfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletsnf::Real: noise frequency in Hzw::Int64=5: width (in Hz) of the area surrounding noise (fromnf - wtonf + w)type::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
s_new::Vector{Float64}
denoise_cwd(s; <keyword arguments>)Perform denoising using continuous wavelet decomposition (CWD).
Arguments
s::AbstractArrayfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletsnf::Real: noise frequency in Hzw::Int64=5: width (in Hz) of the area surrounding noise (fromnf - wtonf + w)type::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
s_new::Array{Float64, 3}
denoise_cwd(obj; <keyword arguments>)Perform denoising using continuous wavelet decomposition (CWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletsnf::Real: noise frequency in Hzw::Int64=5: width (in Hz) of the area surrounding noise (fromnf - wtonf + w)type::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_cwd! — Function
denoise_cwd!(obj; <keyword arguments>)Perform denoising using continuous wavelet decomposition (CWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt::T where {T <: CWT}=wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available waveletsnf::Real: noise frequency in Hzw::Int64=5: width (in Hz) of the area surrounding noise (fromnf - wtonf + w)type::Symbol=:nd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
Nothing
NeuroAnalyzer.denoise_dwd — Function
denoise_dwd(s; <keyword arguments>)Perform threshold denoising using discrete wavelet decomposition (DWD).
Arguments
s::AbstractVectorwt<:DiscreteWavelet=wavelet(WT.haar): discrete wavelet, see Wavelets.jl documentation for the list of available waveletsl::Int64=0: number of levels, default maximum number of levels available or total transformationdnt<:DNF=RelErrorShrink(SoftTH()): denoise type, see WaveletsExt.jl documentation for detailed description of available denoising functionssmooth::Symbol=:regular: the smoothing method used (:regularsmoothing thresholds all given coefficients, whereas:undersmoothsmoothing does not threshold the lowest frequency subspace node of the wavelet transform)
Returns
s_new::Vector{Float64}
denoise_dwd(s; <keyword arguments>)Perform denoising using discrete wavelet decomposition (DWD).
Arguments
s::AbstractArraywt<:DiscreteWavelet: discrete wavelet, e.g.wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available waveletsl::Int64=0: number of levels, default maximum number of levels available or total transformationdnt<:DNF=RelErrorShrink(SoftTH()): denoise type, see WaveletsExt.jl documentation for detailed description of available denoising functionssmooth::Symbol=:regular: the smoothing method used (:regularsmoothing thresholds all given coefficients, whereas:undersmoothsmoothing does not threshold the lowest frequency subspace node of the wavelet transform)
Returns
s_new::Array{Float64, 3}
denoise_dwd(obj; <keyword arguments>)Perform denoising using discrete wavelet decomposition (DWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt<:DiscreteWavelet: discrete wavelet, e.g.wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available waveletsl::Int64=0: number of levels, default maximum number of levels available or total transformationdnt<:DNF=RelErrorShrink(SoftTH()): denoise type, see WaveletsExt.jl documentation for detailed description of available denoising functionssmooth::Symbol=:regular: the smoothing method used (:regularsmoothing thresholds all given coefficients, whereas:undersmoothsmoothing does not threshold the lowest frequency subspace node of the wavelet transform)
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_dwd! — Function
denoise_dwd!(obj; <keyword arguments>)Perform denoising using discrete wavelet decomposition (DWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt<:DiscreteWavelet: discrete wavelet, e.g.wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available waveletsl::Int64=0: number of levels, default maximum number of levels available or total transformationdnt<:DNF=RelErrorShrink(SoftTH()): denoise type, see WaveletsExt.jl documentation for detailed description of available denoising functionssmooth::Symbol=:regular: the smoothing method used (:regularsmoothing thresholds all given coefficients, whereas:undersmoothsmoothing does not threshold the lowest frequency subspace node of the wavelet transform)
Returns
Nothing
NeuroAnalyzer.denoise_fft — Function
denoise_fft(s; <keyword arguments>)Perform FFT denoising.
Arguments
s::AbstractVectorpad::Int64=0: number of zeros to addt::Real=0: PSD threshold for keeping frequency components; if 0, use mean signal power value
Returns
Named tuple containing:
s::Vector{Float64}: denoised signalf_idx::BitVector: index of components zeroed
denoise_fft(s; <keyword arguments>)Perform FFT denoising.
Arguments
s::AbstractArraypad::Int64=0: number of zeros to addt::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to add signal for FFTt::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to add signal for FFTt::Int64=100: PSD threshold for keeping frequency components
Returns
Nothing
NeuroAnalyzer.denoise_wien — Function
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.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
NeuroAnalyzer.derivative — Function
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.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
NeuroAnalyzer.detect_powerline — Function
detect_powerline(s; <keyword arguments>)Detect power line noise frequency.
Arguments
s::AbstractVectorfs::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, 2}: peak noise frequency in Hz for channels × epochs
NeuroAnalyzer.detect_powerline! — Function
detect_powerline!(obj)Detect power line noise frequency.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Nothing
NeuroAnalyzer.detrend — Function
detrend(s; <keyword arguments>)Perform piecewise detrending.
Arguments
s::AbstractVectortype::Symbol=:linear::loess: fit loess approximation and subtract it froms:poly: polynomial oforderis subtracted froms:mean: the mean ofsis subtracted froms:constant:offsetis subtracted froms:ls: the result of a linear least-squares fit tosis subtracted froms:linear: linear trend (1st order polynomial) is subtracted froms
offset::Real=0: constant for:constantdetrendingorder::Int64=1: polynomial fitting orderf::Float64=1.0: smoothing factor for:loessdetrending
Returns
s_new::Vector{Float64}
detrend(s; <keyword arguments>)Perform piecewise detrending.
Arguments
s::AbstractArraytype::Symbol=:linear: detrending method:loess: fit loess approximation and subtract it froms:poly: polynomial oforderis subtracted froms:mean: the mean ofsis subtracted froms:constant:offsetis subtracted froms:ls: the result of a linear least-squares fit tosis subtracted froms:linear: linear trend (1st order polynomial) is subtracted froms
offset::Real=0: constant for:constantdetrendingorder::Int64=1: polynomial fitting orderf::Float64=1.0: smoothing factor for:loessdetrending
Returns
s_new::Array{Float64, 3}
detrend(obj; <keyword arguments>)Perform piecewise detrending.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namestype::Symbol=:linear: detrending method:loess: fit loess approximation and subtract it froms:poly: polynomial oforderis subtracted froms:mean: the mean ofsis subtracted froms:constant:offsetis subtracted froms:ls: the result of a linear least-squares fit tosis subtracted froms:linear: linear trend (1st order polynomial) is subtracted froms
offset::Real=0: constant for:constantdetrendingorder::Int64=1: polynomial fitting orderf::Float64=1.0: smoothing factor for:loessdetrending
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.detrend! — Function
detrend!(obj; <keyword arguments>)Perform piecewise detrending.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namestype::Symbol=:linear: detrending method:loess: fit loess approximation and subtract it froms:poly: polynomial oforderis subtracted froms:mean: the mean ofsis subtracted froms:constant:offsetis subtracted froms:ls: the result of a linear least-squares fit tosis subtracted froms:linear: linear trend (1st order polynomial) is subtracted froms
offset::Real=0: constant for:constantdetrendingorder::Int64=1: polynomial fitting orderf::Float64=1.0: smoothing factor for:loessdetrending
Returns
Nothing
NeuroAnalyzer.downsample — Function
downsample(obj; <keyword arguments>)Downsample.
Arguments
obj::NeuroAnalyzer.NEUROnew_sr::Int64: new sampling rate
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.downsample! — Function
downsample!(obj; <keyword arguments>)Downsample.
Arguments
obj::NeuroAnalyzer.NEUROnew_sr::Int64: new sampling rate
Returns
Nothing
NeuroAnalyzer.dwd — Function
dwd(s; <keyword arguments>)Perform discrete wavelet decomposition (DWD).
Arguments
s::AbstractVectorwt<:DiscreteWavelet=wavelet(WT.haar): discrete wavelet, see Wavelets.jl documentation for the list of available waveletstype::Symbol: decomposition type::sdwt: stationary discrete wavelet transform:acdwt: discrete autocorrelation wavelet transform
l::Int64=maxtransformlevels(s): number of levels, default maximum number of levels available or total transformation
Returns
dc::Matrix{Float64}: DWD coefficients (by rows)
dwd(s; <keyword arguments>)Perform discrete wavelet decomposition (DWD).
Arguments
s::AbstractArraywt<:DiscreteWavelet=wavelet(WT.haar): discrete wavelet, see Wavelets.jl documentation for the list of available waveletstype::Symbol: transformation type::sdwt: stationary discrete wavelet transform:acdwt: discrete autocorrelation wavelet transform
l::Int64=maxtransformlevels(s[1, :, 1]): number of levels, default is the maximum number of levels available or total transformation
Returns
dc::Array{Float64, 4}: DWD coefficients
dwd(obj; <keyword arguments>)Perform discrete wavelet decomposition (DWD).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameswt<:DiscreteWavelet=wavelet(WT.haar): discrete wavelet, see Wavelets.jl documentation for the list of available waveletstype::Symbol: transformation type::sdwt: stationary discrete wavelet transform:acdwt: discrete autocorrelation wavelet transform
l::Int64=0: number of levels, default is the maximum number of levels available or total transformation
Returns
dc::Array{Float64, 4}: DWD coefficients
NeuroAnalyzer.edit_montage — Function
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.fconv — Function
fconv(s; <keyword arguments>)Perform convolution in the frequency domain.
Arguments
s::AbstractVectorkernel::AbstractVectornorm::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::AbstractArraykernel::AbstractVector: convolution kernelnorm::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameskernel::AbstractVector: convolution kernelnorm::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.filter — Function
filter(obj; <keyword arguments>)Apply filtering.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}="": channel name or list of channel namesfprototype::Symbol: filter prototype::fir: FIR filter:firls: weighted least-squares FIR filter:remez: Remez FIR filter:butterworth: IIR filter:chebyshev1IIR filter:chebyshev2IIR filter:ellipticIIR filter:iirnotch: second-order IIR notch 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}}: filter cutoff in Hz (must be a pair of frequencies for:bpand:bs)fs::Int64: sampling rateorder::Union{Nothing, Int64}=nothing: filter orderrp::Union{Nothing, Real}=nothing: maximum ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: minimum ripple attenuation in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersbw::Union{Nothing, Real}=nothing: transition band width in Hz for:firls,:remezand:iirnotchfiltersw::Union{Nothing, AbstractVector}=nothing: window for:firfilter (default is Hamming window) or weights for:firlsfilterpreview::Bool=false: plot filter responsedir:Symbol=:twopass: filtering direction::twopass: two passes, the resulting signal has zero phase distortion, the effective filter order is doubled:onepass: single pass:reverse: one pass, reverse direction
Returns
obj_new::NeuroAnalyzer.NEURO
If preview=true, it will return Plots.Plot{Plots.GRBackend}.
NeuroAnalyzer.filter! — Function
filter!(obj; <keyword arguments>)Apply filtering.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}="": channel name or list of channel namesfprototype::Symbol: filter prototype::fir: FIR filter:firls: weighted least-squares FIR filter:remez: Remez FIR filter:butterworth: IIR filter:chebyshev1IIR filter:chebyshev2IIR filter:ellipticIIR filter:iirnotch: second-order IIR notch 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}}: filter cutoff in Hz (must be a pair of frequencies for:bpand:bs)fs::Int64: sampling rateorder::Union{Nothing, Int64}=nothing: filter orderrp::Union{Nothing, Real}=nothing: maximum ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: minimum ripple attenuation in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersbw::Union{Nothing, Real}=nothing: transition band width in Hz for:firls,:remezand:iirnotchfiltersw::Union{Nothing, AbstractVector}=nothing: window for:firfilter (default is Hamming window) or weights for:firlsfilterpreview::Bool=false: plot filter responsedir:Symbol=:twopass: filtering direction::twopass: two passes, the resulting signal has zero phase distortion, the effective filter order is doubled:onepass: single pass:reverse: one pass, reverse direction
Returns
Nothing
If preview=true, it will return Plots.Plot{Plots.GRBackend}.
NeuroAnalyzer.filter_apply — Function
filter_apply(s; <keyword arguments>)Apply IIR or FIR filter.
Arguments
s::AbstractVectorflt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}: filterdir:Symbol=:twopass: filtering direction::twopass: two passes, the resulting signal has zero phase distortion, the effective filter order is doubled:onepass: single pass:reverse: one pass, reverse direction
Returns
s_new::Vector{Float64}
filter_apply(obj; <keyword arguments>)Apply IIR or FIR filter.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}: filterdir:Symbol=:twopass: filtering direction::twopass: two passes, the resulting signal has zero phase distortion, the effective filter order is doubled:onepass: single pass:reverse: one pass, reverse direction
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_apply! — Function
filter_apply!(obj; <keyword arguments>)Apply IIR or FIR filter.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}: filterdir:Symbol=:twopass: filtering direction::twopass: two passes, the resulting signal has zero phase distortion, the effective filter order is doubled:onepass: single pass:reverse: one pass, reverse direction
Returns
Nothing
NeuroAnalyzer.filter_create — Function
filter_create(; <keyword arguments>)Create FIR or IIR filter.
Arguments
fprototype::Symbol: filter prototype::fir: FIR filter:firls: weighted least-squares FIR filter:remez: Remez FIR filter:butterworth: IIR filter:chebyshev1IIR filter:chebyshev2IIR filter:ellipticIIR filter:iirnotch: second-order IIR notch 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}}: filter cutoff in Hz (must be a pair of frequencies for:bpand:bs)fs::Int64: signal sampling rateorder::Union{Nothing, Int64}=nothing: filter orderrp::Union{Nothing, Real}=nothing: maximum ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: minimum ripple attenuation in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersbw::Union{Nothing, Real}=nothing: transition band width in Hz for:firls,:remezand:iirnotchfiltersw::Union{Nothing, AbstractVector}=nothing: window for:firfilter (default is Hamming window) or weights for:firlsfilter
Returns
flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}
NeuroAnalyzer.filter_g — Function
filter_g(s; <keyword arguments>)Filter using Gaussian in the frequency domain.
Arguments
s::AbstractVectorfs::Int64: sampling ratepad::Int64=0: number of zeros to addf::Real: filter frequencygw::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::AbstractArrayfs::Int64: sampling ratepad::Int64=0: number of zeros to addf::Real: filter frequencygw::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to addf::Real: filter frequencygw::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to addf::Real: filter frequencygw::Real=5: Gaussian width in Hz
Returns
Nothing
NeuroAnalyzer.filter_mavg — Function
filter_mavg(s; <keyword arguments>)Filter using moving average filter (with threshold).
Arguments
s::AbstractVectork::Int64=8: window length is2 × k + 1; for cutoff frequency F, k issqrt(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 filteredww::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::AbstractArrayk::Int64=8: window length is2 × k + 1; for cutoff frequency F, k issqrt(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 filteredww::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesk::Int64=8: window length is2 × k + 1; for cutoff frequency F, k issqrt(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 filteredww::Union{Nothing, AbstractVector}=nothing: weighting window
Returns
obj_new::NeuroAnalyzer.NEURO
Source
- https://dsp.stackexchange.com/questions/9966/what-is-the-cutoff-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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesk::Int64=8: window length is2 × k + 1; for cutoff frequency F, k issqrt(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))ww::Union{Nothing, AbstractVector}=nothing: weighting window
Returns
Nothing
NeuroAnalyzer.filter_mmed — Function
filter_mmed(s; <keyword arguments>)Filter using moving median filter (with threshold).
Arguments
s::AbstractVectork::Int64=8: window length is2 × k + 1t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filteredww::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::AbstractArrayk::Int64=8: window length is2 × k + 1t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples below/above the threshold are being filteredww::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesk::Int64=8: window length is2 × k + 1t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filteredww::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesk::Int64=8: window length is2 × k + 1t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filteredww::Union{Nothing, AbstractVector}=nothing: weighting window
Returns
Nothing
NeuroAnalyzer.filter_poly — Function
filter_poly(s; <keyword arguments>)Filter using polynomial filter.
Arguments
s::AbstractVectororder::Int64=8: polynomial orderwindow::Int64=10: window length
Returns
s_filtered::Vector{Float64}
filter_poly(s; <keyword arguments>)Filter using polynomial filter.
Arguments
s::AbstractArrayorder::Int64=8: polynomial orderwindow::Int64=10: window length
Returns
s_filtered::Array{Float64, 3}: convoluted signal
filter_poly(obj; <keyword arguments>)Filter using polynomial filter.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesorder::Int64=8: polynomial orderwindow::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesorder::Int64=8: polynomial orderwindow::Int64=10: window length
Returns
Nothing
NeuroAnalyzer.filter_sg — Function
filter_sg(s; <keyword arguments>)Filter using Savitzky-Golay filter.
Arguments
s::AbstractVectororder::Int64=6: order of the polynomial used to fit the samples; must be less thanwindowwindow::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::AbstractArrayorder::Int64=6: order of the polynomial used to fit the samples; must be less thanwindowwindow::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesorder::Int64=6: order of the polynomial used to fit the samples; must be less thanwindowwindow::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesorder::Int64=6: order of the polynomial used to fit the samples; must be less thanwindowwindow::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number
Returns
Nothing
NeuroAnalyzer.generate_ssp_projectors — Function
generate_ssp_projectors(obj; <keyword arguments>)Generate SSP projectors from embedded projections.
Arguments
obj::NeuroAnalyzer.NEUROproj::Union{Int64, Vector{Int64}}=0: list of projections used for generating projectors, by default use all available projections
Returns
Named tuple containing:
ssp_projectors::Matrix{Float64}: projectorsU::Matrix{Float64}}: SVD U orthogonal matrix
NeuroAnalyzer.gh — Function
gh(locs; <keyword arguments>)Generate G and H matrices.
Arguments
locs::DataFramem::Int64=4: positive integer constant that affects spherical spline flexibility, highermvalues mean increased rigidityn::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_decompose — Function
ica_decompose(s; <keyword arguments>)Calculate n first Independent Components using FastICA algorithm.
Arguments
s::AbstractMatrixn::Int64: number of ICsiter::Int64=100: maximum number of iterations per each tolerance value ([0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 0.5, 0.9, 0.99])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 varianceic_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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesn::Int64=length(ch): number of ICs, default is the number of channelsiter::Int64=100: maximum number of iterations per each tolerance value ([0.000001, 0.00001, 0.0001, 0.001, 0.01, 0.1, 0.5, 0.9, 0.99]); hence 100 iterations will produce 900 stepsf::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 varianceic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n) (inv(W))ic_var::Vector{Float64}: variance of components
NeuroAnalyzer.ica_reconstruct — Function
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 keepkeep::Bool=false: iftrue, 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_idx::Union{Int64, Vector{Int64}, AbstractRange}: list of ICs to remove or keep or keepkeep::Bool=false: iftrue, 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.NEUROic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_idx::Union{Int64, Vector{Int64}, AbstractRange}: list of ICs to remove or keepkeep::Bool=false: iftrue, 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names, default is all channelsic_idx::Union{Int64, Vector{Int64}, AbstractRange}: list of ICs to remove or keepkeep::Bool=false: iftrue, 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.NEUROic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel names, default is all channelsic_idx::Union{Int64, Vector{Int64}, AbstractRange}: list of ICs to remove or keepkeep::Bool=false: iftrue, then the ICs are kept instead of removed
Returns
Nothing
NeuroAnalyzer.ica_remove — Function
ica_remove(obj, ic, ic_mw; <keyword arguments>)Remove external ICA components from the signal.
Arguments
obj::NeuroAnalyzer.NEUROic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_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.NEUROic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel names, default is all channelsic_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.NEUROch::Union{String, Vector{String}, Regex}: 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.icwd — Function
icwd(ct; <keyword arguments>)Perform inverse continuous wavelet transformation (iCWT).
Arguments
ct::Matrix{Float64}: CWT coefficients (by rows)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletstype::Symbol=:pd: inverse style type::pd: PenroseDelta:nd: NaiveDelta:df: DualFrames
Returns
s::Vector{Float64}: reconstructed signal
NeuroAnalyzer.idwd — Function
idwd(dc; <keyword arguments>)Perform inverse discrete wavelet decomposition (iDWD).
Arguments
dc::Matrix{Float64}: DWD coefficients (by rows)wt<:DiscreteWavelet=wavelet(WT.haar): discrete wavelet, see Wavelets.jl documentation for the list of available waveletstype::Symbol: transformation type::sdwt: average-based stationary discrete wavelet transform:acdwt: discrete autocorrelation wavelet transform
c::Union{Int64, Vector{Int64}, AbstractRange}=axes(dc, 1): which coefficients are used for reconstruction, default is all coefficients
Returns
s::AbstractArray: reconstructed signal
NeuroAnalyzer.intensity2od — Function
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.NEUROch::Union{String, Vector{String}, Regex}=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.NEUROch::Union{String, Vector{String}, Regex}=get_channel(obj, type="nirs_int")): list of channels, default is NIRS intensity channels
Returns
Nothing
NeuroAnalyzer.invert_polarity — Function
invert_polarity(obj; <keyword arguments>)Invert polarity.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROch::Union{String, Vector{String}, Regex}: channel(s) to invert
Returns
Nothing
NeuroAnalyzer.lrinterpolate_channel — Function
lrinterpolate_channel(obj; <keyword arguments>)Interpolate channel using linear regression.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel to interpolateep::Int64: epoch number(s) within to interpolateep_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.NEUROch::String: channel to interpolateep::Int64: epoch number(s) within to interpolateep_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_channel — Function
mlinterpolate_channel(obj; <keyword arguments>)Interpolate channel using a machine-learning model.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel to interpolateep::Int64: epoch number within to interpolateep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated onemodel<: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.NEUROch::String: channel to interpolateep::Int64: epoch number within to interpolateep_ref::Union{Int64, Vector{Int64}, AbstractRange}=setdiff(_c(nepochs(obj)), ep): reference epoch(s), default is all epochs except the interpolated onemodel::T where T <: DataType: MLJ regressor model
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.normalize — Function
normalize(s, n; <keyword arguments>)Normalize.
Arguments
s::AbstractVectorn::Real=1.0method::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]: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::AbstractArrayn::Real=1.0bych::Bool=false: if true, normalize each channel separatelymethod::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesmethod::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]: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
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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesmethod::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]: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
bych::Bool=false: if true, normalize each channel separately
Returns
Nothing
NeuroAnalyzer.normalize_fisher — Function
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::AbstractArraybych::Bool=false: ignored
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_gauss — Function
normalize_gauss(s)Normalize to Gaussian.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_gauss(s; <keyword arguments>)Normalize to Gaussian.
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_invroot — Function
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::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_log — Function
normalize_log(s)Normalize using log-transformation.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_log(s; <keyword arguments>)Normalize using log-transformation.
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_log10 — Function
normalize_log10(s)Normalize using log10-transformation.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_log10(s; <keyword arguments>)Normalize using log10-transformation.
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_mad — Function
normalize_mad(s)Normalize by MAD.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_mad(s; <keyword arguments>)Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_minmax — Function
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_n — Function
normalize_n(s, n)Normalize in [0, n], default is [0, +1].
Arguments
s::AbstractVectorn::Real=1.0
Returns
sn::AbstractVector
normalize_n(s, n; <keyword arguments>)Normalize in [0, n], default is [0, +1].
Arguments
s::AbstractArrayn::Real=1.0bych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_neg — Function
normalize_neg(s)Normalize in [-∞, 0].
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_neg(s)Normalize in [-∞, 0].
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_neglog — Function
normalize_neglog(s; <keyword arguments>)Normalize to using -log-transformation.
Arguments
s::AbstractArraybych::Bool=false: ignored
Returns
sn::Vector{Float64}
NeuroAnalyzer.normalize_neglog10 — Function
normalize_neglog10(s; <keyword arguments>)Normalize using -log10-transformation.
Arguments
s::AbstractArraybych::Bool=false: ignored
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_perc — Function
normalize_perc(s)Normalize in percentages.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_perc(s; <keyword arguments>)Normalize in percentages.
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_pos — Function
normalize_pos(s)Normalize in [0, +∞].
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_pos(s; <keyword arguments>)Normalize in [0, +∞].
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_rank — Function
normalize_rank(s)Normalize using tiedranks.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_rank(s; <keyword arguments>)Normalize using tiedranks.
Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_sigmoid — Function
normalize_sigmoid(s; <keyword arguments>)Normalize using sigmoid function: 1 / (1 + e^-x_i)
Arguments
s::AbstractArraybych::Bool=false: ignored
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_softmax — Function
normalize_softmax(s; <keyword arguments>)Softmax normalize: exp(x_i) / sum(exp(x))
Arguments
s::AbstractArraybych::Bool=false: ignored
Returns
sn::AbstractArray
NeuroAnalyzer.normalize_zscore — Function
normalize_zscore(s)Normalize by z-score.
Arguments
s::AbstractVector
Returns
sn::AbstractVector
normalize_zscore(s; <keyword arguments>)Arguments
s::AbstractArraybych::Bool=false: if true, normalize each channel separately
Returns
sn::AbstractArray
NeuroAnalyzer.normpower — Function
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.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
NeuroAnalyzer.npl — Function
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.od2conc — Function
od2conc(obj; <keyword arguments>)Convert NIRS optical density (OD) to concentration (HbO, HbR, HbT).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}=get_channel(obj, type="nirs_od")): list of channels, default is NIRS intensity channelsppf::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 setppf=1and 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.NEUROch::Union{String, Vector{String}, Regex}=get_channel(obj, type="nirs_od")): list of channels, default is NIRS intensity channelsppf::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 setppf=1and 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_decompose — Function
pca_decompose(s, n)Calculate n first Primary Components (PCs).
Arguments
s::AbstractArrayn::Int64: number of PCs
Returns
Named tuple containing:
pc::Array{Float64, 3}: PC(1)..PC(n) × epochpcv::Matrix{Float64}: PC(1)..PC(n) variances (fraction of total variance explained)pcm::Vector{Float64}: PC meanspc_model::MultivariateStats.PCA{Float64}: PC model
pca_decompose(obj; <keyword arguments>)Calculate n first Primary Components (PCs).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesn::Int64: number of PCs to calculate
Returns
Named tuple containing:
pc::Array{Float64, 3}: PC(1)..PC(n) × epochpcv::Matrix{Float64}: PC variances (fraction of total variance explained)pcm::Vector{Float64}: PC meanspc_model::MultivariateStats.PCA{Float64}: PC model
NeuroAnalyzer.pca_reconstruct — Function
pca_reconstruct(s, pc, pca)Reconstructs signal using PCA components.
Arguments
s::AbstractArraypc::AbstractArray: IC(1)..IC(n) × epochpc_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.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROpc::Array{Float64, 3}: PC(1)..PC(n) × epochpc_model::MultivariateStats.PCA{Float64}: PC modelch::Union{String, Vector{String}, Regex}: 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.NEUROch::Union{String, Vector{String}, Regex}: 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.NEUROpc::Array{Float64, 3}: PC(1)..PC(n) × epochpc_model::MultivariateStats.PCA{Float64}: PC modelch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
NeuroAnalyzer.plinterpolate — Function
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_sphch::Int64: channel to interpolateimethod::Symbol=:sh: interpolation method::sh: Shepard:mq: Multiquadratic:imq: InverseMultiquadratic:tp: ThinPlate:nn: NearestNeighbour:ga: Gaussian
nmethod::Symbol=:minmax: method for normalization, seenormalize()cart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesifactor::Int64=100: interpolation quality
Returns
Named tuple containing:
int_s::Matrix{Float64}: interpolated signalint_x::Vector{Float64}: X-axis coordinatesint_y::Vector{Float64}: Y-axis coordinates
NeuroAnalyzer.plinterpolate_channel — Function
plinterpolate_channel(obj; <keyword arguments>)Interpolate channel using planar interpolation.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel to interpolateep::Union{Int64, Vector{Int64}, AbstractRange}: epoch number(s) within to interpolateimethod::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.NEUROch::String: channel to interpolateep::Union{Int64, Vector{Int64}, AbstractRange}: epoch number(s) within to interpolateimethod::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_a — Function
reference_a(obj; <keyword arguments>)Reference to auricular (A1, A2) channels. Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROtype::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.NEUROtype::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_avg — Function
reference_avg(obj; <keyword arguments>)Reference to averaged reference. Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROexclude_fpo::Bool=false: exclude Fp1, Fp2 (due to eye blinks), O1, O2 (due to head movements) from CAR calculationexclude_current::Bool=false: exclude current channel from CAR calculationaverage::Bool=true: average reference channels prior to subtracting, otherwise add all reference channelsmed::Bool=false: use median instead of meanweighted::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.NEUROexclude_fpo::Bool=false: exclude Fp1, Fp2 (due to eye blinks), O1, O2 (due to head movements) from CAR calculationexclude_current::Bool=false: exclude current channel from CAR mean calculationaverage::Bool=true: average reference channels prior to subtracting, otherwise add all reference channelsmed::Bool=false: use median instead of meanweighted::Bool=false: use weighted reference channels (weights depend on the distance from the current electrode)
Returns
Nothing
NeuroAnalyzer.reference_ce — Function
reference_ce(obj; <keyword arguments>)Reference to common electrode(s). Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names used as reference; if multiple channels are specified, their average is used as the referencemed::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names used as reference; if multiple channels are specified, their average is used as the referencemed::Bool=false: use median instead of mean
Returns
Nothing
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.NEUROref_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 pairsref_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.NEUROref_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 pairsref_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_m — Function
reference_m(obj; <keyword arguments>)Reference to mastoid (M1, M2) channels. Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROtype::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.NEUROtype::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_plap — Function
reference_plap(obj; <keyword arguments>)Reference using planar Laplacian (using nn adjacent electrodes). Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROnn::Int64=4: usennadjacent electrodesweighted::Bool=false: use mean ofnnnearest channels if false; if true, mean ofnnnearest channels is weighted by distance to the referenced channelmed::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.NEUROnn::Int64=4: usennadjacent electrodesweighted::Bool=false: use distance weights; use mean of nearest channels if falsemed::Bool=false: use median instead of mean
Returns
Nothing
NeuroAnalyzer.reference_slap — Function
reference_slap(obj; <keyword arguments>)Reference using spherical Laplacian (using nn adjacent electrodes). Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROnn::Int64=4: usennadjacent electrodesweighted::Bool=false: use mean ofnnnearest channels if false; if true, mean ofnnnearest channels is weighted by distance to the referenced channelmed::Bool=false: use median instead of mean
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_slap! — Function
reference_slap!(obj; <keyword arguments>)Reference using spherical Laplacian (using nn adjacent electrodes). Only signal channels are processed.
Arguments
obj::NeuroAnalyzer.NEUROnn::Int64=4: usennadjacent electrodesweighted::Bool=false: use distance weights; use mean of nearest channels if falsemed::Bool=false: use median instead of mean
Returns
Nothing
NeuroAnalyzer.remove_dc — Function
remove_dc(s, n)Remove mean value (DC offset).
Arguments
s::AbstractVectorn::Union{Int64, Tuple{Int64, Int64}}=0: ifnis greater than 0, mean value is calculated for the firstnsamples or ifnis a tuple greater than (0, 0), mean value is calculated forn[1]ton[2]samples
Returns
s_new::Vector{Float64}
remove_dc(s, n)Remove mean value (DC offset).
Arguments
s::AbstractArrayn::Union{Int64, Tuple{Int64, Int64}}=0: ifnis greater than 0, mean value is calculated for the firstnsamples or ifnis a tuple greater than (0, 0), mean value is calculated forn[1]ton[2]samples
Returns
s::Array{Float64, 3}
remove_dc(obj; <keyword arguments>)Remove mean value (DC offset).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesn::Union{Int64, Tuple{Int64, Int64}}=0: ifnis greater than 0, mean value is calculated for the firstnsamples or ifnis a tuple greater than (0, 0), mean value is calculated forn[1]ton[2]samples
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.remove_dc! — Function
remove_dc!(obj; <keyword arguments>)Remove mean value (DC offset).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesn::Union{Int64, Tuple{Int64, Int64}}=0: ifnis greater than 0, mean value is calculated for the firstnsamples or ifnis a tuple greater than (0, 0), mean value is calculated forn[1]ton[2]samples
Returns
Nothing
NeuroAnalyzer.remove_pops — Function
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::AbstractVectorr::Int64=20: detection segment length; pops are checked withinpop_loc - r:pop_loc + rsamplesrepair::Bool=true: recover the segment iftrue
Returns
Named tuple containing:
s::Vector{Float64}pop_loc::Int64: sample number in the signall_seg::Int64: length of segment before the pop that starts when signal crosses 0r_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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesrepair::Bool=true: recover the segment iftruewindow::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 ifrepair=truepop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signall_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0r_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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesrepair::Bool=true: recover the segment iftruewindow::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 withinpop_loc - r:pop_loc + rsamples
Returns
pop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signall_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0r_seg::Vector{Int64}: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_powerline — Function
remove_powerline(obj; <keyword arguments>)Remove power line noise and its peaks above power line frequency.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespl_frq::Real=obj.header.recording[:line_frequency]: power line frequency, default is read from the OBJ headermethod::Symbol=:iir::iir: use IIR filter
pr::Real=2.0: prominence of noise peaks in dBd::Real=5.0: minimum distance between peaks in Hzq::Real=0.1: optimization step size
Returns
obj_new::NeuroAnalyzer.NEUROdf::DataFrame: list of peaks detected
NeuroAnalyzer.remove_powerline! — Function
remove_powerline!(obj; <keyword arguments>)Remove power line noise and harmonics.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespl_frq::Real=obj.header.recording[:line_frequency]: power line frequency, default is read from the OBJ headermethod::Symbol=:iir: use IIR filterpr::Real=2.0: prominence of noise peaks in dBd::Real=5.0: minimum distance between peaks in Hzq::Real=0.1: optimization step size
Returns
df::DataFrame: list of peaks detected
NeuroAnalyzer.resample — Function
resample(s; <keyword arguments>)Resample to new_sr sampling frequency.
Arguments
s::AbstractVectorold_sr::Int64: old sampling ratenew_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::AbstractArrayold_sr::Int64: old sampling ratenew_sr::Int64: new sampling rate
Returns
s_new::Array{Float64, 3}
resample(obj; <keyword arguments>)Resample (up- or down-sample).
Arguments
obj::NeuroAnalyzer.NEUROold_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.NEUROnew_sr::Int64: new sampling rate
Returns
Nothing
NeuroAnalyzer.scale — Function
scale(obj; <keyword arguments>)Multiply channel(s) by factor.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfactor::Real: signal is multiplied byfactor
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.scale! — Function
scale!(obj; <keyword arguments>)Multiply channel(s) by factor.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfactor::Real: signal is multiplied byfactor
Returns
Nothing
NeuroAnalyzer.sort_epochs — Function
sort_epochs(obj; <keyword arguments>)Sort epochs.
Arguments
obj::NeuroAnalyzer.NEUROs::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.NEUROs::Vector{Int64}: vector of sorting indices
Returns
Nothing
NeuroAnalyzer.standardize — Function
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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
obj_new::NeuroAnalyzer.NEUROscaler::Vector{ZScoreTransform{Float64, Vector{Float64}}}
NeuroAnalyzer.standardize! — Function
standardize!(obj; <keyword arguments>)Standardize channels.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
scaler::Vector{ZScoreTransform{Float64, Vector{Float64}}}
NeuroAnalyzer.taper — Function
taper(s; <keyword arguments>)Taper the signal.
Arguments
s::AbstractVectort::Vector{<:Real}
Returns
s_new::Vector{Float64}
taper(s; <keyword arguments>)Taper the signal.
Arguments
s::AbstractArrayt::Vector{<:Real}
Returns
s_new::Array{Float64, 3}
taper(obj; <keyword arguments>)Taper the signal.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namest::Vector{<:Real}
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.taper! — Function
taper!(obj; <keyword arguments>)Taper the signal.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namest::Vector{<:Real}
Returns
Nothing
NeuroAnalyzer.tconv — Function
tconv(s; <keyword arguments>)Performs convolution in the time domain.
Arguments
s::AbstractVectorkernel::AbstractVector
Returns
s_new::Union{Vector{Float64}, Vector{ComplexF64}}: convoluted signal
tconv(s; <keyword arguments>)Perform convolution in the time domain.
Arguments
s::AbstractArraykernel::AbstractVector: convolution kernel
Returns
s_new::Union{Array{Float64, 3}, Array{ComplexF64, 3}}: convoluted signal
tconv(obj; <keyword arguments>)Perform convolution in the time domain.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameskernel::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel nameskernel::AbstractVector: convolution kernel
NeuroAnalyzer.upsample — Function
upsample(obj; <keyword arguments>)Upsample.
Arguments
obj::NeuroAnalyzer.NEUROnew_sr::Int64: new sampling rate
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.upsample! — Function
upsample!(obj; <keyword arguments>)Upsample.
Arguments
obj::NeuroAnalyzer.NEUROnew_sr::Int64: new sampling rate
Returns
Nothing
NeuroAnalyzer.wbp — Function
wbp(s; <keyword arguments>)Perform wavelet band-pass filtering.
Arguments
s::AbstractVectorpad::Int64: pad withpadzerosfrq::Real: filter frequencyfs::Int64: sampling ratencyc::Int64=6: number of cycles for Morlet wavelet
Returns
s_new::Vector{Float64}
wbp(s; <keyword arguments>)Perform wavelet band-pass filtering.
Arguments
s::AbstractArraypad::Int64: pad thesignalwithpadzerosfrq::Real: filter frequencyfs::Int64: sampling ratencyc::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64: pad thesignalwithpadzerosfrq::Real: filter frequencyncyc::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64: pad thesignalwithpadzerosfrq::Real: filter frequencyncyc::Int64=6: number of cycles for Morlet wavelet
Returns
Nothing
Locs
NeuroAnalyzer.add_locs — Function
add_locs(obj; <keyword arguments>)Add electrode positions from locs.
Electrode locations:
labelschannel labelloc_thetapolar angleloc_radiuspolar radiusloc_xCartesian xloc_yCartesian yloc_zCartesian zloc_radius_sphspherical radiusloc_theta_sphspherical horizontal angleloc_phi_sphspherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEUROlocs::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 labelloc_theta: polar angleloc_radius: polar radiusloc_x: Cartesian Xloc_y: Cartesian Yloc_z: Cartesian Zloc_radius_sph: spherical radiusloc_theta_sph: spherical horizontal angleloc_phi_sph: spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEUROlocs::DataFrame
Returns
Nothing
NeuroAnalyzer.cart2pol — Function
cart2pol(x, y)Convert Cartesian coordinates to polar.
Arguments
x::Realy::Real
Returns
radius::Float64theta::Float64
NeuroAnalyzer.cart2sph — Function
cart2sph(x, y, z)Convert spherical coordinates to Cartesian.
Arguments
x::Realy::Realz::Real
Returns
radius::Float64: spherical radius, the distance from the origin to the pointtheta::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degreesphi::Float64: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
NeuroAnalyzer.edit_locs — Function
edit_locs(obj; <keyword arguments>)Edit electrode.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel namex::Union{Real, Nothing}=nothing: Cartesian X spherical coordinatey::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinatez::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinatetheta::Union{Real, Nothing}=nothing: polar angleradius::Union{Real, Nothing}=nothing: polar radiustheta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the pointphi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degreesname::String="": channel nametype::String="": channel type
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_locs! — Function
edit_locs!(obj; <keyword arguments>)Edit electrode.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel number or namex::Union{Real, Nothing}=nothing: Cartesian X spherical coordinatey::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinatez::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinatetheta::Union{Real, Nothing}=nothing: polar angleradius::Union{Real, Nothing}=nothing: polar radiustheta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the pointphi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degreesname::String="": channel nametype::String="": channel type
Returns
Nothing
NeuroAnalyzer.locs_cart2pol — Function
locs_cart2pol(locs)Convert Cartesian coordinates to polar.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
NeuroAnalyzer.locs_cart2pol! — Function
locs_cart2pol!(locs)Convert Cartesian coordinates to polar.
Arguments
locs::DataFrame
Returns
Nothing
NeuroAnalyzer.locs_cart2sph — Function
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_center — Function
locs_center(locs; <keyword arguments>)Center locs at (0, 0).
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
locs_new::DataFrame
NeuroAnalyzer.locs_center! — Function
locs_center!(locs; <keyword arguments>)Center locs at (0, 0).
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_details — Function
locs_details(obj; <keyword arguments>)Return channel location details.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameout::Bool=true: if true, print details
Returns
Named tuple containing:
label::String: location labeltheta_pl::Float64: polar angleradius_pl::Float64: polar radiusx::Float64: Cartesian X spherical coordinatey::Float64: Cartesian Y spherical coordinatez::Float64: Cartesian Z spherical coordinatetheta_sph::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Float64: spherical radius, the distance from the origin to the pointphi_sph::Float64: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
NeuroAnalyzer.locs_flipx — Function
locs_flipx(locs; <keyword arguments>)Flip channel locations along x axis.
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_flipy — Function
locs_flipy(locs; <keyword arguments>)Flip channel locations along y axis.
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_flipz — Function
locs_flipz(locs; <keyword arguments>)Flip channel locations along z axis.
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_generate — Function
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_normalize — Function
locs_normalize(locs; <keyword arguments>)Normalize channel locations to fit the unit sphere.
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_origin — Function
locs_origin(locs; <keyword arguments>)Move locs origin ([0, 0, 0]) along the axes.
Arguments
obj::NeuroAnalyzer.NEUROx::Real=0: move origin along X axisy::Real=0: move origin along Y axisz::Real=0: move origin along Z axis
Returns
locs_new::DataFrame
NeuroAnalyzer.locs_origin! — Function
locs_origin!(locs; <keyword arguments>)Move locs origin ([0, 0, 0]) along the axes.
Arguments
obj::NeuroAnalyzer.NEUROx::Real=0: move origin along X axisy::Real=0: move origin along Y axisz::Real=0: move origin along Z axis
Returns
Nothing
locs_origin!(locs; <keyword arguments>)Move locs origin ([0, 0, 0]) along the axes.
Arguments
locs::DataFramex::Real=0: move origin along X axisy::Real=0: move origin along Y axisz::Real=0: move origin along Z axis
Returns
Nothing
NeuroAnalyzer.locs_pol2cart — Function
locs_pol2cart(locs)Convert polar coordinates to Cartesian.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
NeuroAnalyzer.locs_pol2cart! — Function
locs_pol2cart!(locs)Convert polar coordinates to Cartesian.
Arguments
locs::DataFrame
Returns
Nothing
NeuroAnalyzer.locs_pol2sph — Function
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_rotx — Function
locs_rotx(locs; <keyword arguments>)Rotate channel locations around the X axis (in the YZ-plane).
Arguments
locs::DataFramea::Real: angle of rotation (in degrees); positive angle rotates anti-clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramea::Real: angle of rotation (in degrees); positive angle rotates anti-clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_roty — Function
locs_roty(locs; <keyword arguments>)Rotate channel locations around the Y axis (in the XZ-plane).
Arguments
locs::DataFramea::Real: angle of rotation (in degrees); positive angle rotates clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramea::Real: angle of rotation (in degrees); positive angle rotates clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_rotz — Function
locs_rotz(locs; <keyword arguments>)Rotate channel locations around the Z axis.
Arguments
locs::DataFramea::Real: angle of rotation (in degrees); positive angle rotates anti-clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramea::Real: angle of rotation (in degrees); positive angle rotates anti-clockwisepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_scale — Function
locs_scale(locs; <keyword arguments>)Scale channel locations.
Arguments
locs::DataFramer::Real: scaling factorpolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramer::Real: scaling factorpolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.locs_sph2cart — Function
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_sph2pol — Function
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_swapxy — Function
locs_swapxy(locs; <keyword arguments>)Swap channel locations x and y axes.
Arguments
locs::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::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::DataFramepolar::Bool=true: modify polar coordinatescart::Bool=true: modify Cartesian coordinatesspherical::Bool=true: modify spherical coordinates
Returns
Nothing
NeuroAnalyzer.pol2cart — Function
pol2cart(radius, theta)Convert polar coordinates to Cartesian.
Arguments
radius::Real: polar radius, the distance from the origin to the point, in degreestheta::Real: polar angle
Returns
x::Float64y::Float64
NeuroAnalyzer.pol2sph — Function
pol2sph(radius, theta)Convert polar coordinates to spherical.
Arguments
radius::Real: polar radius, the distance from the origin to the point, in degreestheta::Real: polar angle
Returns
radius::Float64: spherical radius, the distance from the origin to the pointtheta::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degreesphi::Float64: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
NeuroAnalyzer.sph2cart — Function
sph2cart(radius, theta, phi)Convert spherical coordinates to Cartesian.
Arguments
radius::Real: spherical radius, the distance from the origin to the pointtheta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degreesphi::Real: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
Returns
x::Float64y::Float64z::Float64
NeuroAnalyzer.sph2pol — Function
sph2pol(radius, theta, phi)Convert spherical coordinates to polar.
Arguments
radius::Real: spherical radius, the distance from the origin to the pointtheta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degreesphi::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 pointtheta::Real: polar horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
Analyze
Statistics.std — Function
std(obj)Calculate standard deviation of the signal data (along epochs).
Arguments
obj::NeuroAnalyzer.NEURO
Returns
s::Matrix{Float64}
NeuroAnalyzer.acor — Function
acor(s; <keyword arguments>)Calculate auto-correlation.
Arguments
s::AbstractVectorl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationbiased::Bool=true: calculate biased or unbiased autocovariancemethod::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]):stat: use StatsBaseautocor(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acor(s; <keyword arguments>)Calculate auto-correlation.
Arguments
s::AbstractMatrixl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationbiased::Bool=true: calculate biased or unbiased autocovariancemethod::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]):stat: use StatsBaseautocor(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acor(s; <keyword arguments>)Calculate auto-correlation.
Arguments
s::AbstractArrayl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationbiased::Bool=true: calculate biased or unbiased autocovariancemethod::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]):stat: use StatsBaseautocor(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acor(obj; <keyword arguments>)Calculate auto-correlation. For ERP return trial-averaged auto-correlation.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesl::Real=1: lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationbiased::Bool=true: calculate biased or unbiased autocovariancemethod::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]):stat: use StatsBaseautocor(),biasedvalue is ignored
Returns
Named tuple containing:
ac::Array{Float64, 3}l::Vector{Float64}: lags [s]
NeuroAnalyzer.acov — Function
acov(s; <keyword arguments>)Calculate autocovariance.
Arguments
s::AbstractVectorl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing autocovariancebiased::Bool=true: calculate biased or unbiased autocovariancemethod::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 StatsBaseautocov(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acov(s; <keyword arguments>)Calculate autocovariance.
Arguments
s::AbstractMatrixl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing autocovariancebiased::Bool=true: calculate biased or unbiased autocovariancemethod::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 StatsBaseautocor(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acov(s; <keyword arguments>)Calculate autocovariance.
Arguments
s::AbstractArrayl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is0:ldemean::Bool=true: demean signal before computing autocovariancebiased::Bool=true: calculate biased or unbiased autocovariancemethod::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 StatsBaseautocor(),biasedvalue is ignored
Returns
ac::Array{Float64, 3}
acov(obj; <keyword arguments>)Calculate autocovariance. For ERP return trial-averaged autocovariance.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesl::Int64=1: lags range is0:lag[samples]demean::Bool=true: demean signal before computing autocovariancebiased::Bool=true: calculate biased or unbiased autocovariancemethod::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 StatsBaseautocor(),biasedvalue is ignored
Returns
Named tuple containing:
ac::Array{Float64, 3}l::Vector{Float64}: lags [s]
NeuroAnalyzer.aecor — Function
aecor(s1, s2)Calculate Amplitude Envelope Correlation (AEC).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
aec::Float64: AEC value
Source
- Bruns, A., Eckhorn, R., Jokeit, H., & Ebner, A. (2000). Amplitude envelope correlation detects coupling among incoherent brain signals. Neuroreport, 11(7), 1509-1514.
aecor(obj1, obj2; <keyword arguments>)Calculate Amplitude Envelope Correlation (AEC).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
aec::Matrix{Float64}: AEC value
aecor(obj; <keyword arguments>)Calculate Amplitude Envelope Correlation (AEC).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
aec::Array{Float64, 3}: AEC value
NeuroAnalyzer.amp — Function
amp(s)Calculate amplitudes.
Arguments
s::AbstractVector
Returns
Named tuple containing:
p::Float64: peak amplituder::Float64: RMS amplitudep2p::Float64: peak-to-peak amplitudesemi_p2p::Float64: half of the peak-to-peak amplitudemsa::Float64: mean square amplitudermsa::Float64: root mean square amplitudees::Float64: total signal energyrmsq::Float64: root mean square
amp(s)Calculate amplitudes.
Arguments
s::AbstractArray
Returns
Named tuple containing:
p::Matrix{Float64}: peak amplituder::Matrix{Float64}: RMS amplitudep2p::Matrix{Float64}: peak-to-peak amplitudesemi_p2p::Matrix{Float64}: half of the peak-to-peak amplitudemsa::Matrix{Float64}: mean square amplitudermsa::Matrix{Float64}: root mean square amplitudeenergy::Matrix{Float64}: total signal energyrmsq::Matrix{Float64}: root mean square
amp(obj; <keyword arguments>)Calculate amplitudes.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
p::Matrix{Float64}: peak amplituder::Matrix{Float64}: RMS amplitudep2p::Matrix{Float64}: peak-to-peak amplitudesemi_p2p::Matrix{Float64}: half of the peak-to-peak amplitudemsa::Matrix{Float64}: mean square amplitudermsa::Matrix{Float64}: root mean square amplitudeenergy::Matrix{Float64}: total signal energyrmsq::Matrix{Float64}: root mean square
NeuroAnalyzer.amp_at — Function
amp_at(obj; <keyword arguments>)Calculate amplitude at given time.
Arguments
obj::NeuroAnalyzer.NEUROt::Real: time in seconds
Returns
p::Matrix{Float64}: amplitude for each channel per epoch
NeuroAnalyzer.ampdiff — Function
ampdiff(s; <keyword arguments>)Calculate amplitude difference between each channel and mean amplitude of reference channels.
Arguments
s::AbstractArraych::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.NEUROch::Union{String, Vector{String}, Regex}: index of reference channels
Returns
ad::Array{Float64, 3}
NeuroAnalyzer.avgamp_at — Function
avgamp_at(obj; <keyword arguments>)Calculate average amplitude at given time segment.
Arguments
obj::NeuroAnalyzer.NEUROt::Tuple{Real, Real}: time segment in seconds
Returns
p::Matrix{Float64}: mean amplitude for each channel per epoch
NeuroAnalyzer.axc2frq — Function
axc2frq(c, l)Detect peaks in auto-/cross- correlation/covariance and transform them into frequencies.
Arguments
c::AbstractVector: auto-/cross- correlation/covariance valuesl::AbstractVector: lags
Returns
frq::Vector{Float64}: list of frequencies dominating in the auto-/cross- correlation/covariance
NeuroAnalyzer.band_asymmetry — Function
band_asymmetry(obj; <keyword arguments>)Calculate band asymmetry: ln(channel 1 band power) - ln(channel 2 band power).
Arguments
obj::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channels, e.g. left frontal channelsch2::Union{String, Vector{String}}: list of channels, e.g. right frontal channelsfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
ba::Float64: band asymmetryba_norm::Float64: normalized band asymmetry
NeuroAnalyzer.band_mpower — Function
band_mpower(s; <keyword arguments>)Calculate mean and maximum band power and its frequency and amplitude.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
mbp::Float64: mean band powermaxfrq::Float64: frequency of maximum band powermaxbp::Float64: power at maximum band frequencymaxba::Float64: power at maximum band frequency
band_mpower(s; <keyword arguments>)Calculate mean and maximum band power and its frequency and amplitude.
Arguments
s::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
mbp::Matrix{Float64}: mean band power per channel per epochmaxfrq::Matrix{Float64}: frequency of maximum band power per channel per epochmaxbp::Matrix{Float64}: power at maximum band frequency per channel per epochmaxba::Matrix{Float64}: amplitude at maximum band frequency per channel per epoch
band_mpower(obj; <keyword arguments>)Calculate mean and maximum band power and its frequency and amplitude.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
mbp::Matrix{Float64}: mean band power per channel per epochmaxfrq::Matrix{Float64}: frequency of maximum band power per channel per epochmaxbp::Matrix{Float64}: power at maximum band frequency per channel per epochmaxba::Matrix{Float64}: amplitude at maximum band frequency per channel per epoch
NeuroAnalyzer.band_power — Function
band_power(s; <keyword arguments>)Calculate absolute band power between two frequencies.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
bp::Float64: band power
band_power(s; <keyword arguments>)Calculate absolute band power between two frequencies.
Arguments
s::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
bp::Matrix{Float64}: band power
band_power(obj; <keyword arguments>)Calculate absolute band power between two frequencies.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
bp::Matrix{Float64}: band power
NeuroAnalyzer.channel_stats — Function
channel_stats(obj)Calculate channels statistics per epoch.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
c_mean::Matrix{Float64}: meanc_median::Matrix{Float64}: medianc_std::Matrix{Float64}: standard deviationc_var::Matrix{Float64}: variancec_kurt::Matrix{Float64}: kurtosisc_skew::Matrix{Float64}: skewnessc_mean_diff::Matrix{Float64}: mean diff valuec_median_diff::Matrix{Float64}: median diff valuec_max_dif::Matrix{Float64}: max differencec_dev_mean::Matrix{Float64}: deviation from channel mean
NeuroAnalyzer.coherence — Function
coherence(s1, s2; <keyword arguments>)Calculate coherence, imaginary part of coherence and magnitude-squared coherence (MSC).
Arguments
s1::AbstractVectors2::AbstractVectormethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
fs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
coh::Vector{ComplexF64}: coherenceimcoh::Vector{Float64}: imaginary part of coherencemsc::Vector{Float64}: magnitude-squared coherencef::Vector{Float64}: frequencies
coherence(s1, s2; <keyword arguments>)Calculate coherence, imaginary part of coherence and magnitude-squared coherence (MSC).
Arguments
s1::AbstractArrays2::AbstractArraymethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
fs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
coh::Array{ComplexF64, 3}: coherenceimcoh::Array{Float64, 3}: imaginary part of coherencemsc::Array{Float64, 3}: magnitude-squared coherencef::Vector{Float64}: frequencies
coherence(obj1, obj2; <keyword arguments>)Calculate coherence, imaginary part of coherence and magnitude-squared coherence (MSC).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsmethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
fs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
coh::Array{ComplexF64, 3}: coherenceimcoh::Array{Float64, 3}: imaginary part of coherencemsc::Array{Float64, 3}: magnitude-squared coherencef::Vector{Float64}: frequencies
NeuroAnalyzer.corm — Function
corm(s; <keyword arguments>)Calculate correlation matrix of s * s'.
Arguments
s::AbstractVectornorm::Bool: normalize correlation matrix
Returns
cm::Matrix{Float64}: correlation matrix
corm(s1, s2; <keyword arguments>)Calculate correlation matrix of s1 * s2'.
Arguments
s1::AbstractVectors2::AbstractVectornorm::Bool: normalize correlation matrix
Returns
cm::Matrix{Float64}: correlation matrix
corm(s; <keyword arguments>)Calculate corelation matrix of channels × time points matrix.
Arguments
s::AbstractMatrixnorm::Bool=false: normalize correlation
Returns
cm::Matrix{Float64}: corelation matrix
corm(s; <keyword arguments>)Calculate correlation matrix.
Arguments
s::AbstractArraynorm::Bool=false: normalize covariance
Returns
cm::Array{Float64, 3}: correlation matrix for each epoch
corm(obj; <keyword arguments>)Calculate correlation matrix.
Arguments
obj::NeuroAnalyzer.NEURO- `ch::Union{String, Vector{String}, Regex}: list of channels
norm::Bool=true: normalize matrix
Returns
cm::Array{Float64, 3}: correlation matrix for each epoch
NeuroAnalyzer.corr — Function
corr(obj1, obj2; <keyword arguments>)Calculate correlation.
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
cr::Matrix{Float64}: correlation coefficient
corr(obj; <keyword arguments>)Calculate correlation.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
cr::Array{Float64, 3}: correlation coefficient
NeuroAnalyzer.cosim — Function
cosim(s1, s2)Calculate Cosine Similarity.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
cs::Float64: CS value
cosim(obj1, obj2; <keyword arguments>)Calculate Cosine Similarity.
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
cs::Matrix{Float64}: CS value
cosim(obj; <keyword arguments>)Calculate Cosine Similarity.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
cs::Array{Float64, 3}: CS value
NeuroAnalyzer.covm — Function
covm(s; <keyword arguments>)Calculate covariance matrix of s * s'.
Arguments
s::AbstractVectornorm::Bool=false: normalize covariance
Returns
cm::Matrix{Float64}: covariance matrix
covm(s1, s2; <keyword arguments>)Calculate covariance matrix of s1 * s2'.
Arguments
s1::AbstractVectors2::AbstractVectornorm::Bool=false: normalize covariance
Returns
cm::Matrix{Float64}: covariance matrix
covm(s; <keyword arguments>)Calculate covariance matrix of channels × time points matrix.
Arguments
s::AbstractMatrixnorm::Bool=false: normalize covariance
Returns
cm::Matrix{Float64}: covariance matrix
covm(s; <keyword arguments>)Calculate covariance matrix.
Arguments
s::AbstractArraynorm::Bool=false: normalize covariance
Returns
cm::Array{Float64, 3}: covariance matrix
covm(obj; <keyword arguments>)Calculate covariance matrix of signal * signal'.
Arguments
obj::NeuroAnalyzer.NEURO- `ch::Union{String, Vector{String}, Regex}: list of channels
norm::Bool=false: normalize matrix
Returns
cm::Array{Float64, 3}: covariance matrix for each epoch
NeuroAnalyzer.cph — Function
cph(s1, s2; <keyword arguments>)Calculate cross-phases.
Arguments
s1::AbstractVectors2::AbstractVectorfs::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::AbstractArrayfs::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::AbstractArrays2::AbstractArrayfs::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.NEUROch::Union{String, Vector{String}, Regex}: 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 epochsep2::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.cpsd — Function
cpsd(s1, s2; <keyword arguments>)Calculate cross power spectral density (CPSD).
Arguments
s1::AbstractVectors2::AbstractVectormethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
fs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
pxy::Vector{ComplexF64}: cross-power spectrumf::Vector{Float64}: frequencies
cpsd(s1, s2; <keyword arguments>)Calculate cross power spectral density (CPSD).
Arguments
s1::AbstractArrays2::AbstractArraymethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
fs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
pxy::Array{ComplexF64, 3}: cross-power spectrumf::Vector{Float64}: frequencies
cpsd(obj1, obj2; <keyword arguments>)Calculate cross power spectral density (CPSD).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsmethod::Symbol=:mt: method used to calculate CPSD::mt: multi-tapered cross-power spectra:fft: fast Fourier transformation:stft: short time Fourier transformation
frq_lim::Tuple{Real, Real}=(0, sr(obj1) / 2): frequency boundsdemean::Bool=false: if true, the channel-wise mean will be subtracted from the input signals before the cross spectral powers are computednt::Int64=7: number of Slepian taperswlen::Int64=sr(obj1): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
pxy::Array{ComplexF64, 3}: cross-power spectrumf::Vector{Float64}: frequencies
NeuroAnalyzer.cwtspectrogram — Function
cwtspectrogram(s; <keyword arguments>)Calculate scaleogram using continuous wavelet transformation (CWT).
Arguments
s::AbstractVectorfs::Int64: sampling ratewt::T where {T <: CWT}=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
Named tuple containing:
m::Matrix{Float64}: magnitudef::Vector{Float64}: frequenciest::Vector{Float64}: time
NeuroAnalyzer.dirinrg — Function
dirinrg(s)Calculate Dirichlet energy.
Arguments
s::AbstractVector
Returns
dn::Float64
dirinrg(s)Calculate Dirichlet energy.
Arguments
s::AbstractArray
Returns
dn::Matrix{Float64}
dirinrg(obj; <keyword arguments>)Calculate Dirichlet energy.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
dn::Matrix{Float64}
NeuroAnalyzer.diss — Function
diss(s1, s2)Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).
Arguments
s1::AbstractMatrixs2::AbstractMatrix
Returns
Named tuple containing:
gd::Vector{Float64}: global dissimilaritysc::Vector{Float64}: spatial correlation
diss(obj1, obj2; <keyword arguments>)Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels). This works for ERP/ERF objects only and calculates DISS for the first epoch (ERP/ERF) only.
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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
gd::Vector{Float64}: global dissimilaritysc::Vector{Float64}: spatial correlation
NeuroAnalyzer.dpli — Function
dpli(s1, s2)Calculate Directed Phase Lag Index (dPLI).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
pv::Float64: dPLI valuesd::Vector{Float64}: signal difference (s2 - s1)phd::Vector{Float64}: phase difference (s2 - s1)s1ph::Vector{Float64}: signal 1 phases2ph::Vector{Float64}: signal 2 phase
Source
- Stam, C. J., & van Straaten, E. C. W. (2012). Go with the flow: Use of a directed phase lag index (dPLI) to characterize patterns of phase relations in a large-scale model of brain dynamics. NeuroImage, 62(3), 1415–1428.
dpli(obj1, obj2; <keyword arguments>)Calculate Directed Phase Lag Index (dPLI).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
pv::Matrix{Float64}: dPLI valuesd::Array{Float64, 3}: signal difference (s2 - s1)phd::Array{Float64, 3}: phase difference (s2 - s1)s1ph::Array{Float64, 3}: signal 1 phases2ph::Array{Float64, 3}: signal 2 phase
dpli(obj; <keyword arguments>)Calculate Directed Phase Lag Index (dPLI).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
pv::Array{Float64, 3}: dPLI value
NeuroAnalyzer.emd — Function
emd(s, x; <keyword arguments>)Perform Empirical Mode Decomposition (EMD).
Arguments
s::AbstractVectorx::AbstractVector: x-axis points (e.g. time points)epsilon::Real=0.3: decomposition stops when sum of the difference is lower thanepsilon
Returns
imf::Matrix{Float64}: intrinsic mode functions (IMF) (by rows) and residue (last row in the matrix)
emd(obj; <keyword arguments>)Perform Empirical Mode Decomposition (EMD).
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel nameep::Int64: epoch numberepsilon::Real=0.3: decomposition stops when sum of the difference is lower thanepsilon
Returns
imf::Matrix{Float64}: intrinsic mode functions (IMF) (by rows) and residue (last row in the matrix)
NeuroAnalyzer.entropy — Function
entropy(s)Calculate entropy.
Arguments
s::AbstractVector
Returns
Named tuple containing:
ent::Float64: entropy in bitsshent::Float64: Shanon entropyleent::Float64: log energy entropysent::Float64: sample entropynsent::Float64: normalized sample entropy
Note
Entropy of the signal is calculated using its histogram bins (number of bins is calculated using the Freedman-Diaconis formula) using the formulas p = n / sum(n) and entropy = -sum(p .* log2(p)), where p is the probability of each bin and n are bins' weights.
Shannon entropy and log energy entropy are calculated using Wavelets.coefentropy().
Completely regular signals should have sample entropy approaching zero, while less regular signals should have higher sample entropy.
entropy(s)Calculate entropy.
Arguments
s::AbstractArray
Returns
Named tuple containing:
ent::Matrix{Float64}: entropy in bitsshent::Matrix{Float64}: Shanon entropyleent::Matrix{Float64}: log energy entropysent::Matrix{Float64}: sample entropynsent::Matrix{Float64}: normalized sample entropy
entropy(obj; <keyword arguments>)Calculate entropy.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
ent::Matrix{Float64}: entropy in bitsshent::Matrix{Float64}: Shanon entropyleent::Matrix{Float64}: log energy entropysent::Matrix{Float64}: sample entropynsent::Matrix{Float64}: normalized sample entropy
NeuroAnalyzer.env_cor — Function
env_cor(env1, env2)Calculate envelope correlation.
Arguments
env1::Array{Float64, 3}env2::Array{Float64, 3}
Returns
Named tuple containing:
ec::Vector{Float64}: envelope correlation coefficientp::Vector{Float64}: p-value
NeuroAnalyzer.env_lo — Function
env_lo(s, x; <keyword arguments>)Calculate lower envelope.
Arguments
s::AbstractVectorx::AbstractVector: x-axis points (e.g. time points)d::Int64=32: distance between peeks in points, lower values get better envelope fit
Returns
e::Vector{Float64}: envelope
NeuroAnalyzer.env_up — Function
env_up(s, x; <keyword arguments>)Calculate upper envelope.
Arguments
s::AbstractVectorx::AbstractVector: x-axis points (e.g. time points)d::Int64=32: distance between peeks in points, lower values get better envelope fit
Returns
e::Vector{Float64}: envelope
NeuroAnalyzer.epoch_stats — Function
epoch_stats(obj)Calculate epochs statistics.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
e_mean::Vector{Float64}: meane_median::Vector{Float64}: mediane_std::Vector{Float64}: standard deviatione_var::Vector{Float64}: variancee_kurt::Vector{Float64}: kurtosise_skew::Vector{Float64}: skewnesse_mean_diff::Vector{Float64}: mean diff valuee_median_diff::Vector{Float64}: median diff valuee_max_dif::Vector{Float64}: max differencee_dev_mean::Vector{Float64}: deviation from channel mean
NeuroAnalyzer.erop — Function
erop(obj; <keyword arguments>)Calculate ERO (Event-Related Oscillations) power-spectrum. If obj is ERP or ERF, 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.NEUROch::String: channel to analyzemethod::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
nt::Int64=7: number of Slepian taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowdb::Bool=true: normalize powers to dBncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Matrix{Float64}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.eros — Function
eros(obj; <keyword arguments>)Calculate ERO (Event-Related Oscillations) spectrogram. If obj is ERP or ERF, 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.NEUROch::String: channel to analyzemethod::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 taperswlen::Int64=sr(obj): window length, default is 4 secondswoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowpad::Int64=0: number of zeros to adddb::Bool=true: normalize powers to dBgw::Real=5: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available wavelets
Returns
Named tuple containing:
s::Array{Float64, 3}: spectrogram(s)f::Vector{Float64}: frequenciest::Vector{Float64}: time
NeuroAnalyzer.erp_peaks — Function
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.escor — Function
escor(s1, s2)Calculate Envelope-to-Signal Correlation (ESC).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
esc::Float64: ESC value
Source
- Bruns, A., & Eckhorn, R. (2004). Task-related coupling from high-to low-frequency signals among visual cortical areas in human subdural recordings. International Journal of Psychophysiology, 51(2), 97-116.
escor(obj1, obj2; <keyword arguments>)Calculate Envelope-to-Signal Correlation (ESC).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
esc::Matrix{Float64}: ESC value
escor(obj; <keyword arguments>)Calculate Envelope-to-Signal Correlation (ESC).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
esc::Array{Float64, 3}: ESC value
NeuroAnalyzer.flim — Function
flim(p, f; <keyword arguments>)Trim power spectrum or spectrogram array to a range of frequencies.
Arguments
p::AbstractArray: powersf::AbstractVector: frequenciesfrq_lim::Tuple{Real, Real}: frequency bounds
Returns
Named tuple containing:
p::Union{Array{Float64, 3}, Array{Float64, 4}}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.frqinst — Function
frqinst(s; <keyword arguments>)Calculate instantaneous frequencies.
Arguments
s::AbstractVector
Returns
f::Vector{Float64}: instantaneous frequencies (in rad/s)
frqinst(s; <keyword arguments>)Calculate instantaneous frequencies.
Arguments
s::AbstractVector
Returns
f::Array{Float64, 3}: instantaneous frequencies (in rad/s)
frqinst(obj; <keyword arguments>)Calculate instantaneous frequencies.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
f::Array{Float64, 3}: instantaneous frequencies (in Hz)
NeuroAnalyzer.ftransform — Function
ftransform(s; <keyword arguments>)Calculate Fourier transformation.
Arguments
s::AbstractVectorpad::Int64=0: number of zeros padding the signaldb::Bool=false: normalize powers to dBnf::Bool=false: if true, return Fourier coefficients for negative and positive frequencies, otherwise return Fourier coefficients for positive frequencies only
Returns
Named tuple containing:
c::Vector{ComplexF64}: Fourier coefficientsa::Vector{Float64}: amplitudesp::Vector{Float64}: powersph::Vector{Float64}: phases (in radians)
Notes
To get frequencies for the signal, use f, _ = freqs(s, fs).
ftransform(s; <keyword arguments>)Calculate Fourier transformation.
Arguments
s::AbstractArraypad::Int64: number of zeros padding the signaldb::Bool=false: normalize powers to dBnf::Bool=false: if true, return Fourier coefficients for negative and positive frequencies, otherwise return Fourier coefficients for positive frequencies only
Returns
Named tuple containing:
c::Array{ComplexF64, 3}: Fourier coefficientsa::Array{Float64, 3}: amplitudesp::Array{Float64, 3}: powersph::Array{Float64, 3}: phases (in radians)
NeuroAnalyzer.ftt_analyze — Function
ftt_analyze(t)Analyze taps in TPT recording.
Arguments
Named tuple containing:
taps::Vector{Int64}: number of taps per trialtap_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 intervalstap_t_int::Vector{Vector{Float64}}: taps time point [ms] during intervalstap_d_int::Vector{Vector{Float64}}: taps duration [ms] during intervals`
Returns
Named tuple containing:
n::Int64: number of tapst_mean::Float64: mean interval between taps [ms]t_median::Float64: median interval between taps [ms]t_rmssd::Float64: ("root mean square of successive differences"), the square root of the mean of the squares of the successive differences between adjacent taps [ms]t_sdsd::Float64: ("standard deviation of successive differences"), the standard deviation of the successive differences between adjacent taps [ms]
NeuroAnalyzer.ged — Function
ged(s1, s2)Perform generalized eigendecomposition.
Arguments
s1::AbstractMatrix: signal to be analyzeds2::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: object to be analyzedobj2::NeuroAnalyzer.NEURO: original object- `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 epochsep2::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.gfp — Function
gfp(s)Calculate GFP (Global Field Power).
Arguments
s::AbstractMatrix
Returns
g::Vector{Float64}: GFP values over time points
gfp(obj; <keyword arguments>)Calculate global field power (GFP). This works for ERP/ERF object only and calculates GFP for the first epoch (ERP/ERF) only.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}}: channels to analyze
Returns
g::Vector{Float64}: GFP values over time points
NeuroAnalyzer.gfp_norm — Function
gfp_norm(s)Calculate signal normalized for GFP (Global Field Power).
Arguments
s::AbstractMatrix
Returns
gn::Matrix{Float64}: normalized signal
gfp_norm(obj; <keyword arguments>)Calculate signal normalized for GFP (Global Field Power). This works for ERP/ERF object only and normalizes the first epoch (ERP/ERF) only.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}}: channels to analyze
Returns
gn::Vector{Float64}: normalized signal
NeuroAnalyzer.ghexp — Function
ghexp(s; tau_range, q_range)Calculate the Generalised Hurst Exponents (GHEs).
Arguments
s::AbstractVectortau_range::UnitRange{Int64}: GHEs are estimated the moments of the absolute increments over time delayq_range::Union{Nothing, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}=nothing: moments at which GHE are estimated
Returns
ghe::Matrix{Float64}
ghexp(s)Calculate the Generalised Hurst Exponents (GHEs).
Arguments
s::AbstractArraytau_range::UnitRange{Int64}: GHEs are estimated the moments of the absolute increments over time delayq_range::Union{Nothing, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}=nothing: moments at which GHE are estimated
Returns
ghe::Array{Float64, 4}
ghexp(obj; <keyword arguments>)Calculate the Generalised Hurst Exponents (GHEs).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namestau_range::UnitRange{Int64}: GHEs are estimated the moments of the absolute increments over time delayq_range::Union{Nothing, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}=nothing: moments at which GHE are estimated
Returns
ghe::Array{Float64, 4}
NeuroAnalyzer.ghpsd — Function
ghpsd(s; <keyword arguments>)Calculate power spectrum using Gaussian and Hilbert transform.
Arguments
s::AbstractVectorfs::Int64: sampling ratedb::Bool=true: normalize powers to dBgw::Real=5: Gaussian width in Hzw::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
p::Vector{Float64}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.ghtspectrogram — Function
ghtspectrogram(s; <keyword arguments>)Calculate spectrogram using Gaussian and Hilbert transform.
Arguments
s::AbstractVectorfs::Int64: sampling ratedb::Bool=true: normalize powers to dBgw::Real=10: Gaussian width in Hzw::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
p::Matrix{Float64}: powersph::Matrix{Float64}: phasesf::Vector{Float64}: frequenciest::Vector{Float64}: time
NeuroAnalyzer.hanalytic — Function
hanalytic(s)Calculate complex analytic signal using Hilbert transformation.
Arguments
s::AbstractVectorpad::Int64: number of zeros padding the signal
Returns
ha::Vector{ComplexF64}:
hanalytic(s; <keyword arguments>)Calculate complex analytic signal using Hilbert transformation.
Arguments
s::AbstractArraypad::Int64: number of zeros padding the signal
Returns
ha::Vector{ComplexF64}:
hanalytic(obj; <keyword arguments>)Calculate complex analytic signal using Hilbert transformation.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to add signal for FFT
Returns
ha::Vector{ComplexF64}:
NeuroAnalyzer.henv — Function
henv(obj; <keyword arguments>)Calculate Hilbert spectrum amplitude envelope.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesd::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 envelopes_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_lo — Function
henv_lo(s)Calculate lower envelope using Hilbert transform.
Arguments
s::AbstractVector
Returns
e::Vector{Float64}: envelope
Notes
Hilbert transform works best for narrowband signals (i.e., signals with all energy centered about a single frequency).
NeuroAnalyzer.henv_mean — Function
henv_mean(obj; <keyword arguments>)Calculate Hilbert spectrum amplitude envelope: mean and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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: meanh_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper boundh_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bounds_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_median — Function
henv_median(obj; <keyword arguments>)Calculate Hilbert spectrum amplitude envelope of obj: median and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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: medianh_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper boundh_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bounds_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_up — Function
henv_up(s)Calculate upper envelope using Hilbert transform.
Arguments
s::AbstractVector
Returns
e::Vector{Float64}: envelope
Notes
Hilbert transform works best for narrowband signals (i.e., signals with all energy centered about a single frequency).
NeuroAnalyzer.hfd — Function
hfd(s)Calculate the Higuchi fractal dimension (Higuchi, 1988).
Arguments
s::AbstractVector
Returns
hd::Float64
hfd(s)Calculate the Higuchi fractal dimension (Higuchi, 1988).
Arguments
s::AbstractArray
Returns
hd::Matrix{Float64}
hfd(obj; <keyword arguments>)Calculate the Higuchi fractal dimension (Higuchi, 1988).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
hd::Matrix{Float64}
NeuroAnalyzer.hhtspectrogram — Function
hhtspectrogram(s; <keyword arguments>)Calculate spectrogram using Hilbert-Huang transform.
Arguments
s::AbstractMatrix: components × time pointsfs::Int64: sampling ratedb::Bool=true: normalize powers to dB
Returns
Named tuple containing:
p::Matrix{Float64}: powersph::Matrix{Float64}: phasesf::Vector{Float64}: frequenciest::Vector{Float64}: time
NeuroAnalyzer.hjorth — Function
hjorth(s)Calculate Hjorths parameters.
Arguments
s::AbstractVector
Returns
Named tuple containing:
h_act::Float64: activityh_mob::Float64: mobilityh_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}: activityh_mob::Matrix{Float64}: mobilityh_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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
h_act::Matrix{Float64}: activityh_mob::Matrix{Float64}: mobilityh_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.hmspectrum — Function
hmspectrum(obj; ch)Calculate Hilbert marginal spectrum.
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel name
Returns
Named tuple containing:
p::Array{Float64, 3}: Hilbert marginal spectra for each epocht::Vector{Float64}: time points
NeuroAnalyzer.hrv_analyze — Function
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 segmentsmdnn::Float64: the median of NN segmentsvnn::Float64: the variance of NN segmentssdnn::Float64: the standard deviation of NN segmentsrmssd::Float64: ("root mean square of successive differences"), the square root of the mean of the squares of the successive differences between adjacent NNssdsd::Float64: ("standard deviation of successive differences"), the standard deviation of the successive differences between adjacent NNsnn50::Float64: the number of pairs of successive NNs that differ by more than 50 mspnn50::Float64, the proportion of NN50 divided by total number of NNsnn20::Float64, the number of pairs of successive NNs that differ by more than 20 mspnn20::Float64, the proportion of NN20 divided by total number of NNs
NeuroAnalyzer.hrv_detect — Function
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.htransform — Function
htransform(s; <keyword arguments>)Calculate Hilbert transformation.
Arguments
s::AbstractVectorpad::Int64: number of zeros padding the signaldb::Bool=false: normalize powers to dB
Returns
Named tuple containing:
c::Vector{ComplexF64}: Hilbert coefficientsa::Vector{Float64}: amplitudesp::Vector{Float64}: powersph::Vector{Float64}: phases (in radians)
htransform(s; <keyword arguments>)Calculate Hilbert transformation.
Arguments
s::AbstractArraypad::Int64: number of zeros padding the signaldb::Bool=false: normalize powers to dB
Returns
Named tuple containing:
c::Array{ComplexF64, 3}: Hilbert coefficientsa::Array{Float64, 3}: amplitudesp::Array{Float64, 3}: powersph::Array{Float64, 3}: phases (in radians)
NeuroAnalyzer.iplv — Function
iplv(s1, s2)Calculate Imaginary Phase Locking Value (IPLV).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
pv::Float64: PLV valuesd::Vector{Float64}: signal difference (s2 - s1)phd::Vector{Float64}: phase difference (s2 - s1)s1ph::Vector{Float64}: signal 1 phases2ph::Vector{Float64}: signal 2 phase
Source
- Aydore S, Pantazis D, Leahy RM. A note on the phase locking value and its properties. NeuroImage. 2013 July;74:231–44.
iplv(obj1, obj2; <keyword arguments>)Calculate Imaginary Phase Locking Value (IPLV).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
pv::Matrix{Float64}: PLV valuesd::Array{Float64, 3}: signal difference (s2 - s1)phd::Array{Float64, 3}: phase difference (s2 - s1)s1ph::Array{Float64, 3}: signal 1 phases2ph::Array{Float64, 3}: signal 2 phase
iplv(obj; <keyword arguments>)Calculate Imaginary Phase Locking Value (IPLV).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
pv::Array{Float64, 3}: PLV value
NeuroAnalyzer.ispc — Function
ispc(s1, s2)Calculate ISPC (Inter-Site-Phase Clustering) between s1 and s2.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
ispc_val::Float64: ISPC valueispc_ang::Float64: ISPC angles_diff::Vector{Float64}: signal difference (s2 - s1)ph_diff::Vector{Float64}: phase difference (s2 - s1)s1_phase::Vector{Float64}: signal 1 phases2_phase::Vector{Float64}: signal 2 phase
ispc(obj; <keyword arguments>)Calculate ISPCs (Inter-Site-Phase Clustering).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
ispc_val::Array{Float64, 3}: ISPC value matrices over epochsispc_ang::Array{Float64, 3}: ISPC angle matrices over epochs
ispc(obj1, obj2; <keyword arguments>)Calculate ISPC (Inter-Site-Phase Clustering).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
ispc_val::Matrix{Float64}: ISPC valueispc_ang::Matrix{Float64}: ISPC angles_diff::Array{Float64, 3}: signal difference (s2 - s1)ph_diff::Array{Float64, 3}: phase difference (s2 - s1)s1_phase::Array{Float64, 3}: signal 1 phases2_phase::Array{Float64, 3}: signal 2 phase
NeuroAnalyzer.itpc — Function
itpc(s; <keyword arguments>)Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.
Arguments
s::AbstractArray: one channel over epochst::Int64: time point (sample number) at which ITPC is calculatedw::Union{AbstractVector, Nothing}: optional vector of epochs/trials weights for wITPC calculation
Returns
Named tuple containing:
itpc_val::Float64: ITPC valueitpcz_val::Float64: Rayleigh's ITPC z valueitpc_ang::Float64: ITPC angleitpc_ph::Vector{Float64}: phases at timetaveraged across trials/epochs
Source
- Cohen, M. X. (2014). Analyzing Neural Time Series Data: Theory and Practice.Cambridge: MIT Press
itpc(obj; <keyword arguments>)Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namest::Int64: time point (sample number) at which ITPC is calculatedw::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 valueitpcz_val::Vector{Float64}: Rayleigh's ITPC z valueitpc_ang::Vector{Float64}: ITPC angleitpc_ph::Matrix{Float64}: phase difference (channel2 - channel1)
NeuroAnalyzer.itpc_spec — Function
itpc_spec(s; <keyword arguments>)Calculate spectrogram of ITPC (Inter-Trial-Phase Clustering).
Arguments
s::AbstractArray: one channel over epochsw::Union{AbstractVector, Nothing}: optional vector of epochs/trials weights for wITPC calculation
Returns
Named tuple containing:
itpc_val::Vector{Float64}: ITPC valuesitpcz_val::Vector{Float64}: Rayleigh's ITPC z valuesitpc_ang::Vector{Float64}: ITPC anglesitpc_ph::Matrix{Float64}: phases at timetaveraged across trials/epochs
itpc_spec(obj; <keyword arguments>)Calculate spectrogram of ITPC (Inter-Trial-Phase Clustering).
Arguments
obj::NeuroAnalyzer.NEUROch::String: channel to analyzefrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds for the spectrogramfrq_n::Int64=_tlength(frq_lim): number of frequenciesfrq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies scalingw::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 valuesitpcz_s::Matrix{Float64}: spectrogram of ITPCZ valuesitpc_f::Vector{Float64}: frequencies list
NeuroAnalyzer.lat_idx — Function
lat_idx(obj; <keyword arguments>)Calculate lateralization index (log(A / B), where A is average power at given frequency (default is 10 Hz, α) for the right hemisphere and B is average power at that frequency for the left hemisphere).
Arguments
obj::NeuroAnalyzer.NEUROfrq::Union{Real, Tuple{<:Real, <:Real}}=10: frequency at which the index is calculated; if range is provided, than averaged index across the range is calculatedmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
lidx::Float64: lateralization index
NeuroAnalyzer.maxamp_at — Function
maxamp_at(obj; <keyword arguments>)Calculate maximum amplitude at given time segment.
Arguments
obj::NeuroAnalyzer.NEUROt::Tuple{Real, Real}: time segment in seconds
Returns
p::Matrix{Float64}: maximum amplitude for each channel per epoch
NeuroAnalyzer.mdiff — Function
mdiff(s1, s2; <keyword arguments>)Calculate mean difference and 95% confidence interval for 2 signals.
Arguments
s1::AbstractMatrixs2::AbstractMatrixn::Int64=3: number of bootstrapsmethod::Symbol=:absdiff::absdiff: maximum difference:diff2int: integrated area of the squared difference
Returns
Named tuple containing:
st::Vector{Float64}sts::Float64p::Float64
mdiff(s1, s2; <keyword arguments>)Calculate mean difference and its 95% CI between channels.
Arguments
s1::AbstractArrays2::AbstractArrayn::Int64=3: number of bootstrapsmethod::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.NEUROobj2:NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsn::Int64: number of bootstrapsmethod::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.mep_peaks — Function
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_at — Function
minamp_at(obj; <keyword arguments>)Calculate minimum amplitude at given time segment.
Arguments
obj::NeuroAnalyzer.NEUROt::Tuple{Real, Real}: time segment in seconds
Returns
p::Matrix{Float64}: minimum amplitude for each channel per epoch
NeuroAnalyzer.msci95 — Function
msci95(s; <keyword arguments>)Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractVectorn::Int64=3: number of bootstrapsmethod::Symbol=:normal: use normal method (:normal) orn-times boostrapping (:boot)
Returns
Named tuple containing:
sm::Float64: meanss::Float64: standard deviationsu::Float64: upper 95% CIsl::Float64: lower 95% CI
msci95(s; <keyword arguments>)Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractMatrixn::Int64=3: number of bootstrapsmethod::Symbol=:normal: use normal method (:normal) orn-times boostrapping (:boot)
Returns
Named tuple containing:
sm::Vector{Float64}: meanss::Vector{Float64}: standard deviationsu::Vector{Float64}: upper 95% CIsl::Vector{Float64}: lower 95% CI
msci95(s; <keyword arguments>)Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractArrayn::Int64=3: number of bootstrapsmethod::Symbol=:normal: use normal method (:normal) orn-times boostrapping (:boot)
Returns
Named tuple containing:
sm::Matrix{Float64}: meanss::Matrix{Float64}: standard deviationsu::Matrix{Float64}: upper 95% CIsl::Matrix{Float64}: lower 95% CI
msci95(s1, s2)Calculate mean difference, standard deviation and 95% confidence interval.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
sm::Float64: meanss::Float64: standard deviationsu::Float64: upper 95% CIsl::Float64: lower 95% CI
msci95(s1, s2)Calculate mean difference, standard deviation and 95% confidence interval.
Arguments
s1::AbstractArrays2::AbstractArray
Returns
Named tuple containing:
sm::Matrix{Float64}: meanss::Matrix{Float64}: standard deviationsu::Matrix{Float64}: upper 95% CIsl::Matrix{Float64}: lower 95% CI
msci95(obj; <keyword arguments>)Calculate mean, standard deviation and 95% confidence interval.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesn::Int64=3: number of bootstrapsmethod::Symbol=:normal: use normal (:normal) method orn-times bootstrapping (:boot)
Returns
Named tuple containing:
sm::Matrix{Float64}: meanss::Matrix{Float64}: standard deviationsu::Matrix{Float64}: upper 95% CIsl::Matrix{Float64}: lower 95% CI
msci95(obj1, obj2; <keyword arguments>)Calculate mean difference, standard deviation and 95% confidence interval.
Arguments
obj1::NeuroAnalyzer.NEUROobj2:NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
sm::Matrix{Float64}: meanss::Matrix{Float64}: standard deviationsu::Matrix{Float64}: upper 95% CI boundsl::Matrix{Float64}: lower 95% CI bound
NeuroAnalyzer.mutual_information — Function
mutual_information(s1, s2)Calculate mutual information.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
mutual_information::Float64
mutual_information(s1, s2)Calculate mutual information (channels of s1 vs channels of s2).
Arguments
s1::AbstractArrays2::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. Currently only one estimator (maximum likelihood) is available. Internally it uses InformationMeasures.get_mutual_information().
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
m::Array{Float64, 3}
mutual_information(obj1, obj2; <keyword arguments>)Calculate mutual information between two channels. Currently only one estimator (maximum likelihood) is available. Internally it uses InformationMeasures.get_mutual_information().
Arguments
obj1::NeuroAnalyzer.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: channel name or list of channel namesch2::Union{String, Vector{String}}: channel name or list of channel namesep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
m::Matrix{Float64}
NeuroAnalyzer.mwpsd — Function
mwpsd(s; <keyword arguments>)Calculate power spectrum using Morlet wavelet convolution.
Arguments
s::AbstractVectorpad::Int64=0: pad withpadzerosdb::Bool=true: normalize powers to dBfs::Int64: sampling ratencyc::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), wherefrq_nis the length of0:(fs / 2)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
p::Vector{Float64}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.mwspectrogram — Function
mwspectrogram(s; <keyword arguments>)Calculate spectrogram using wavelet convolution.
Arguments
s::AbstractVectorpad::Int64: pad withpadzerosdb::Bool=true: normalize powers to dBfs::Int64: sampling ratencyc::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), wherefrq_nis the length of0:(fs / 2)w::Bool=true: if true, apply Hanning window
Returns
Named tuple containing:
cs::Matrix{ComplexF64}: convoluted signalp::Matrix{Float64}: powersph::Matrix{Float64}: phasesf::Vector{Float64}: frequenciest::Vector{Float64}: time
NeuroAnalyzer.negentropy — Function
negentropy(signal)Calculate negentropy.
Arguments
signal::AbstractVector
Returns
ne::Float64
negentropy(s)Calculate negentropy.
Arguments
s::AbstractArray
Returns
ne::Matrix{Float64}
negentropy(obj; <keyword arguments>)Calculate negentropy.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
ne::Matrix{Float64}
NeuroAnalyzer.pacor — Function
pacor(s; <keyword arguments>)Calculate partial auto-correlation.
Arguments
s::AbstractVectorl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationmethod::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::AbstractMatrixl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationmethod::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::AbstractArrayl::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationmethod::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesl::Real=1: lags range is-l:ldemean::Bool=true: demean signal before computing auto-correlationmethod::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_amp — Function
peak_amp(s; <keyword arguments>)Calculate amplitude at peak frequency in a band.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pa::Float64: amplitude at peak frequency
peak_amp(s; <keyword arguments>)Calculate amplitude at peak frequency in a band.
Arguments
s::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pa::Matrix{Float64}: amplitude at peak frequency
peak_amp(obj; <keyword arguments>)Calculate amplitude at peak frequency in a band.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
pa::Matrix{Float64}: amplitude at peak frequency
NeuroAnalyzer.peak_frq — Function
peak_frq(s; <keyword arguments>)Calculate peak frequency in a band.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pf::Float64: peak frequency
peak_frq(s; <keyword arguments>)Calculate peak frequency in a band.
Arguments
s::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pf::Matrix{Float64}: peak frequency
peak_frq(obj; <keyword arguments>)Calculate peak frequency in a band.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
pf::Matrix{Float64}: peak frequency
NeuroAnalyzer.peak_pow — Function
peak_pow(s; <keyword arguments>)Calculate power at peak frequency in a band.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pp::Float64: power at peak frequency
peak_pow(s; <keyword arguments>)Calculate power at peak frequency in a band.
Arguments
s::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
pp::Matrix{Float64}: power at peak frequency
peak_pow(obj; <keyword arguments>)Calculate power at peak frequency in a band.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}: lower and upper frequency boundsmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
pw::Matrix{Float64}: power at peak frequency
NeuroAnalyzer.penv — Function
penv(obj; <keyword arguments>)Calculate power spectrum (in dB) envelope.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesd::Int64=8: distance between peeks in samples, lower values get better envelope fitmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
Named tuple containing:
p_env::Array{Float64, 3}: power spectrum envelopep_env_frq::Vector{Float64}: frequencies for each envelope
NeuroAnalyzer.penv_mean — Function
penv_mean(obj; <keyword arguments>)Calculate power spectrum (in dB) envelope: mean and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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 fitmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
Named tuple containing:
p_env_m::Array{Float64, 3}: power spectrum envelope: meanp_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper boundp_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower boundp_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.penv_median — Function
penv_median(obj; <keyword arguments>)Calculate power spectrum (in dB) envelope: median and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::Int64: median over channels (dims = 1) or epochs (dims = 2)d::Int64=8: distance between peeks in samples, lower values get better envelope fitmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
Named tuple containing:
p_env_m::Array{Float64, 3}: power spectrum envelope: medianp_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper boundp_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower boundp_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.phdiff — Function
phdiff(s1, s2; <keyword arguments>)Calculate phase difference between signals.
Arguments
s1::AbstractVectors2::AbstractVectorpad::Int64=0: number of zeros to addh::Bool=false: use Hilbert transform, otherwise use Fourier transform
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::AbstractArraych::Union{Int64, Vector{Int64}}=_c(size(s, 1)): index of reference channels, default is all channels except the analyzed oneavg::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 0sh::Bool=false: use Hilbert transform, otherwise use Fourier transform
Returns
phd::Array{Float64, 3}
phdiff(obj; <keyword arguments>)Calculate phase difference between channels and mean phase of reference ch.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: index of reference channelsavg::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 0sh::Bool=false: use Hilbert transform, otherwise use Fourier transform
Returns
phd::Array{Float64, 3}
NeuroAnalyzer.phsd — Function
phsd(s; <keyword arguments>)Calculate phase spectral density.
Arguments
s::Vector{Float64}fs::Int64: sampling rate
Returns
Named tuple containing:
ph::Vector{Float64}: phases (in radians)f::Vector{Float64}: frequencies
phsd(s; <keyword arguments>)Calculate phase spectral density.
Arguments
s::AbstractMatrixfs::Int64: sampling rate
Returns
Named tuple containing:
ph::Matrix{Float64}: phases (in radians)f::Vector{Float64}: frequencies
phsd(s; <keyword arguments>)Calculate phase spectral density.
Arguments
s::AbstractArrayfs::Int64: sampling rate
Returns
Named tuple containing:
ph::Array{Float64, 3}: phases (in radians)f::Vector{Float64}: frequencies
phsd(obj; <keyword arguments>)Calculate phase spectral density.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Named tuple containing:
ph::Array{Float64, 3}: phases (in radians)f::Vector{Float64}: frequencies
NeuroAnalyzer.pli — Function
pli(s1, s2)Calculate Phase Locking Index (PLI).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
pv::Float64: PLI valuesd::Vector{Float64}: signal difference (s2 - s1)phd::Vector{Float64}: phase difference (s2 - s1)s1ph::Vector{Float64}: signal 1 phases2ph::Vector{Float64}: signal 2 phase
Source
- Stam CJ, Nolte G, Daffertshofer A. Phase lag index: assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources. Hum Brain Mapp. 2007 Nov;28(11):1178-93.
- Aydore S, Pantazis D, Leahy RM. A note on the phase locking value and its properties. NeuroImage. 2013 July;74:231–44.
pli(obj1, obj2; <keyword arguments>)Calculate Phase Locking Index (PLI).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
pv::Matrix{Float64}: PLI valuesd::Array{Float64, 3}: signal difference (s2 - s1)phd::Array{Float64, 3}: phase difference (s2 - s1)s1ph::Array{Float64, 3}: signal 1 phases2ph::Array{Float64, 3}: signal 2 phase
pli(obj; <keyword arguments>)Calculate Phase Locking Index (PLI).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
pv::Array{Float64, 3}: PLI value
NeuroAnalyzer.plv — Function
plv(s1, s2)Calculate Phase Locking Value (PLV).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
Named tuple containing:
pv::Float64: PLV valuesd::Vector{Float64}: signal difference (s2 - s1)phd::Vector{Float64}: phase difference (s2 - s1)s1ph::Vector{Float64}: signal 1 phases2ph::Vector{Float64}: signal 2 phase
Source
- Aydore S, Pantazis D, Leahy RM. A note on the phase locking value and its properties. NeuroImage. 2013 July;74:231–44.
plv(obj1, obj2; <keyword arguments>)Calculate Phase Locking Value (PLV).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
Named tuple containing:
pv::Matrix{Float64}: PLV valuesd::Array{Float64, 3}: signal difference (s2 - s1)phd::Array{Float64, 3}: phase difference (s2 - s1)s1ph::Array{Float64, 3}: signal 1 phases2ph::Array{Float64, 3}: signal 2 phase
plv(obj; <keyword arguments>)Calculate Phase Locking Value (PLV).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
pv::Array{Float64, 3}: PLV value
NeuroAnalyzer.psa — Function
psa(s1, s2)Calculate Phase Synchronization Analysis.
Arguments
s1::AbstractVectors2::AbstractVector
Returns
ps::Float64: PSA value
psa(obj1, obj2; <keyword arguments>)Calculate Phase Synchronization Analysis.
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
ps::Matrix{Float64}: PSA value
psa(obj; <keyword arguments>)Calculate Phase Synchronization Analysis.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
ps::Array{Float64, 3}: PSA value
NeuroAnalyzer.psd — Function
psd(s; <keyword arguments>)Calculate power spectrum density. Default method is Welch's periodogram.
Arguments
s::Vector{Float64}fs::Int64: sampling ratedb::Bool=false: normalize do dBmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Vector{Float64}: powersf::Vector{Float64}: frequencies
psd(s; <keyword arguments>)Calculate power spectrum density. Default method is Welch's periodogram.
Arguments
s::AbstractMatrixfs::Int64: sampling ratedb::Bool=false: normalize do dBmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)
Returns
Named tuple containing:
p::Matrix{Float64}: powersf::Vector{Float64}: frequencies
psd(s; <keyword arguments>)Calculate power spectrum density. Default method is Welch's periodogram.
Arguments
s::AbstractArrayfs::Int64: sampling ratedb::Bool=false: normalize do dBmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Array{Float64, 3}: powersf::Vector{Float64}: frequencies
psd(obj; <keyword arguments>)Calculate power spectrum density. Default method is Welch's periodogram.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdb::Bool=false: normalize do dBmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Array{Float64, 3}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_rel — Function
psd_rel(s; <keyword arguments>)Calculate relative power spectrum density. Default method is Welch's periodogram.
Arguments
s::AbstractVectorfs::Int64: sampling ratedb::Bool=false: normalize do dBfrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total powermethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Vector{Float64}: powersf::Vector{Float64}: frequencies
psd_rel(s; <keyword arguments>)Calculate relative power spectrum density. Default method is Welch's periodogram.
Arguments
s::AbstractMatrixfs::Int64: sampling ratedb::Bool=false: normalize do dBfrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total powermethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Matrix{Float64}: powersf::Vector{Float64}: frequencies
psd_rel(s; <keyword arguments>)Calculate relative power spectrum density. Default method is Welch's periodogram.
Arguments
s::AbstractArrayfs::Int64: sampling ratedb::Bool=false: normalize do dBfrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total powermethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Array{Float64, 3}: powersf::Vector{Float64}: frequencies
psd_rel(obj; <keyword arguments>)Calculate relative power spectrum density. Default method is Welch's periodogram.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdb::Bool=false: normalize do dBfrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: frequency range to calculate relative power to; if nothing, than calculate relative to total powermethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
p::Array{Float64, 3}: powersf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_slope — Function
psd_slope(s; <keyword arguments>)Calculate PSD linear fit and slope. Default method is Welch's periodogram.
Arguments
s::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency rangefrq_lim[1]tofrq_lim[2]db::Bool=false: normalize do dBmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
lf::Vector{Float64}: linear fitls::Float64: slopes of linear fitpf::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::AbstractArrayfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency rangefrq_lim[1]tofrq_lim[2]db::Bool=false: normalize do dBmethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
lf::Array{Float64, 3}: linear fitls::Matrix{Float64}: slope of linear fitpf::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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_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 dBmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
Named tuple containing:
lf::Array{Float64, 3}: linear fitls::Matrix{Float64}: slope of linear fitpf::Vector{Float64}: range of frequencies for the linear fit
NeuroAnalyzer.psi — Function
psi(s1, s2; <keyword arguments>)Calculate Phase Slope Index (PSI).
Arguments
s1::AbstractVectors2::AbstractVectorfs::Int64: sampling ratefrq_lim::Tuple{Real, Real}=(1, fs / 2 - 1)): frequency bounds
Returns
pv::Tuple{Float64, Float64}: PSI value (signal1 -> signal2, signal2 -> signal1)
Source
- Nolte, G., Ziehe, A., Nikulin, V. V., Schlögl, A., Krämer, N., Brismar, T., & Müller, K.-R. (2008). Robustly Estimating the Flow Direction of Information in Complex Physical Systems. Physical Review Letters. 2008; 100(23).
psi(obj1, obj2; <keyword arguments>)Calculate Phase Slope Index (PSI).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsfrq_lim::Tuple{Real, Real}=(1, sr(obj1) / 2 - 1)): frequency bounds
Returns
pv::Matrix{Float64}: PSI value
psi(obj; <keyword arguments>)Calculate Phase Slope Index (PSI).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}=(1, sr(obj) / 2 - 1)): frequency bounds
Returns
pv::Array{Tuple{Float64, Float64}, 3}: PSI value
NeuroAnalyzer.rms — Function
rms(s)Calculate Root Mean Square (RMS).
Arguments
s::AbstractVector
Returns
r::Float64: RMS
rms(s)Calculate Root Mean Square (RMS).
Arguments
s::AbstractArray
Returns
r::Matrix{Float64}: RMS
rms(obj; <keyword arguments>)Calculate Root Mean Square (RMS).
Arguments
obj::NeuroAnalyzer.NEURO- `ch::Union{String, Vector{String}}: list of channels
ep::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj)): default use all epochs
Returns
r::Matrix{Float64}: RMS
NeuroAnalyzer.rmse — Function
rmse(s1, s2)Calculate Root Mean Square Error (RMSE).
Arguments
s1::AbstractVectors2::AbstractVector
Returns
r::Float64: RMSE
rmse(s1, s2)Calculate Root Mean Square Error (RMSE).
Arguments
s1::AbstractArrays2::AbstractArray
Returns
r::Matrix{Float64}: RMSE
rmse(obj1, obj2; <keyword arguments>)Calculate Root Mean Square Error (RMSE).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochs
Returns
r::Matrix{Float64}: RMSE
NeuroAnalyzer.sef — Function
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::AbstractVectorx::Float64=0.95: thresholdfs::Int64: sampling ratef::Tuple{Real, Real}=(0, fs / 2): lower and upper frequency bounds, default is total powermethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(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::AbstractArrayx::Float64=0.95: thresholdfs::Int64: sampling ratef::Tuple{Real, Real}=(0, fs / 2): lower and upper frequency bounds, default is total powermethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesx::Float64=0.95: thresholdf::Tuple{Real, Real}=(0, sr(obj) / 2): lower and upper frequency bounds, default is total powermethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)
Returns
sef_frq::Matrix{Float64}: spectral edge frequency
NeuroAnalyzer.seg_extract — Function
seg_extract(m, rc; <keyword arguments>)Extract segment from a matrix.
Arguments
m::AbstractMatrixrc::NTuple{4, Int64}: upper-left corner row and column, bottom-right corner row and columnc::Bool=false: if true, use circular segment; for circular segment the segment is always returned as vectorv::Bool=false: if true, return as vector (matrix m by rows over columns)
Returns
seg::Union{AbstractMatrix, AbstractVector}
seg_extract(m; <keyword arguments>)Extract segment from a matrix using thresholding.
Arguments
m::AbstractMatrixthreshold::Real=0: thresholdthreshold_type::Symbol=:neq: rule for thresholding::eq: return equal to threshold:neq: return not equal to threshold:geq: return ≥ to threshold:leq: return ≤ to threshold:g: return > to threshold:l: return < to threshold
Returns
Named tuple containing:
idx::Vector{CartesianIndex{2}}: Cartesian coordinates of matrix elementsbm::Matrix{Bool}: map of the segment
NeuroAnalyzer.seg_mean — Function
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::AbstractArrayseg2::AbstractArray
Returns
Named tuple containing:
seg1::Vector{Float64}: averaged segment 1seg2::Vector{Float64}: averaged segment 2
NeuroAnalyzer.senv — Function
senv(obj; <keyword arguments>)Calculate spectral envelope.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesd::Int64=2: distance between peeks in samples, lower values get better envelope fitt::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 adddb::Bool=true: normalize powers to dBnt::Int64=7: number of Slepian tapersgw::Real=5: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::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 envelopes_env_t::Vector{Float64}: spectrogram time
NeuroAnalyzer.senv_mean — Function
senv_mean(obj; <keyword arguments>)Calculate spectral envelope: mean and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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 fitt::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 adddb::Bool=true: normalize powers to dBnt::Int64=7: number of Slepian tapersgw::Real=5: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::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: means_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bounds_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bounds_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.senv_median — Function
senv_median(obj; <keyword arguments>)Calculate spectral envelope: median and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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 fitt::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 adddb::Bool=true: normalize powers to dBnt::Int64=7: number of Slepian tapersgw::Real=5: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::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: medians_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bounds_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bounds_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.snr — Function
snr(s1, s2)Calculate SNR between two signals
Arguments
s1::AbstractVectors2::AbstractVector
Returns
snr::Float64: SNR
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::AbstractArrayt::Vector{Float64}: epoch timetype::Symbol=:rms: SNR type::mean: mean-based:rms: RMS-based
Returns
Named tuple containing:
sn::Matrix{Float64}: SNR for each channel over frequencies 1:Nyquistf::Vector{Float64}: frequencies
snr(obj; <keyword arguments>)Calculate SNR.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namestype::Symbol=:rms: SNR type::mean: mean-based:rms: RMS-based
Returns
Named tuple containing:
sn::Matrix{Float64}: SNR for each channel over frequencies 1:Nyquistf::Vector{Float64}: frequencies
NeuroAnalyzer.snr2 — Function
snr2(s)Calculate RMS-based SNR.
Arguments
s::AbstractVector
Returns
snr2::Float64: SNR
NeuroAnalyzer.spec_seg — Function
spec_seg(sp, st, sf; <keyword arguments>)Return spectrogram segment.
Arguments
sp::Matrix{Float64}: spectrogram powerssf::Vector{Float64}: spectrogram frequenciesst::Vector{Float64}: spectrogram timet::Tuple{Real, Real}: time boundsf::Tuple{Real, Real}: frequency bounds
Returns
Named tuple containing:
segp::Matrix{Float64}: powerssegs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted byPlots.Shape(segs)tidx::Tuple{Real, Real}: time indicesfidx::Tuple{Real, Real}: frequency indices
spec_seg(sp, sf, st; <keyword arguments>)Return spectrogram segment.
Arguments
sp::AbstractArray: spectrogram powerssf::AbstractVector: spectrogram frequenciesst::AbstractVector: spectrogram timech::Int64: channelt::Tuple{Real, Real}: time boundsf::Tuple{Real, Real}: frequency bounds
Returns
Named tuple containing:
segp::Array{Float64, 3}: segment of powerssegs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted byPlots.Shape(segs)tidx::Tuple{Real, Real}: time indicesfidx::Tuple{Real, Real}: frequency indices
NeuroAnalyzer.spectrogram — Function
spectrogram(s; <keyword arguments>)Calculate spectrogram. Default method is short time Fourier transform.
Arguments
s::AbstractVectorfs::Int64: sampling frequencydb::Bool=true: normalize powers to dBmethod::Symbol=:stft: method used to calculate PSD::stft: short time Fourier transform:mt: multi-tapered periodogram
nt::Int64=7: number of Slepian taperswlen::Int64=fs: window length, default is 1 secondwoverlap::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}: powersf::Vector{Float64}: frequenciest::Vector{Float64}: time
spectrogram(obj; <keyword arguments>)Calculate spectrogram. Default method is short time Fourier transform.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to addmethod::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:hht: Hilbert-Huang transform
db::Bool=true: normalize powers to dBnt::Int64=7: number of Slepian tapersgw::Real=10: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt::T where {T <: CWT}=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::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 (magnitudes for:cwt)f::Vector{Float64}: frequenciest::Vector{Float64}: time points
NeuroAnalyzer.stationarity — Function
stationarity(obj; <keyword arguments>)Calculate stationarity.
Arguments
obj::NeuroAnalyzer.NEURO- `ch::Union{String, Vector{String}, Regex}: list of channels
window::Int64=10: time window in samplesmethod::Symbol=:euclid: stationarity method::mean: mean acrosswindow-long windows:var: variance acrosswindow-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_hilbert — Function
stationarity_hilbert(s)Calculate phase stationarity using Hilbert transformation.
Arguments
s::AbstractVector
Returns
stph::Vector{Float64}
NeuroAnalyzer.stationarity_mean — Function
stationarity_mean(s; <keyword arguments>)Calculate mean stationarity. Signal is split into window-long windows and averaged across windows.
Arguments
s::AbstractVectorwindow::Int64: time window in samples
Returns
stm::Vector{Float64}
NeuroAnalyzer.stationarity_var — Function
stationarity_var(s; <keyword arguments>)Calculate variance stationarity. Signal is split into window-long windows and variance is calculated across windows.
Arguments
s::AbstractVectorwindow::Int64: time window in samples
Returns
stv::Vector{Float64}
NeuroAnalyzer.sumsim — Function
sumsim(s1, s2; theta)Calculate summed similarity using an exponential decay model between two signals.
Arguments
s1::AbstractVectors2::AbstractVectortheta::Real: decay parameter
Returns
ss::Float64: summed similarity
Notes
Values of ss are in the range [0, 1]; higher value indicates larger similarity.
sumsim(s1, s2; theta)Calculate summed similarity using an exponential decay model between two signals.
Arguments
s1::AbstractArrays2::AbstractArraytheta::Real: decay parameter
Returns
ss::Matrix{Float64}: signal symmetry
Notes
Values of ss are in the range [0, 1]; higher value indicates larger similarity.
sumsim(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
obj1::NeuroAnalyzer.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochstheta::Real: decay parameter
Returns
ss::Matrix{Float64}: signal symmetry
Notes
Values of ss are in the range [0, 1]; higher value indicates larger similarity.
NeuroAnalyzer.symmetry — Function
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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
sym::Matrix{Float64}: signal symmetry
NeuroAnalyzer.tenv — Function
tenv(obj; <keyword arguments>)Calculate temporal envelope (amplitude).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesd::Int64=32: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
t_env::Array{Float64, 3}: temporal envelopes_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_mean — Function
tenv_mean(obj; <keyword arguments>)Calculate temporal envelope (amplitude): mean and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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: meant_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper boundt_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bounds_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_median — Function
tenv_median(obj; <keyword arguments>)Calculate temporal envelope (amplitude): median and 95% CI.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdims::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: mediant_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper boundt_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bounds_t::Vector{Float64}: signal time
NeuroAnalyzer.tkeo — Function
tkeo(s, t; <keyword arguments>)Calculate Teager-Kaiser energy-tracking operator.
Arguments
s::AbstractVectort::AbstractVector=collect(1:length(s)): time pointsmethod::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::AbstractArrayt::AbstractArray=collect(1:length(s)): time pointsmethod::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}, Regex}: 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.tlim — Function
tlim(p, f; <keyword arguments>)Trim spectrogram array to a range of time points.
Arguments
p::AbstractArray: powerst::AbstractVector: time pointsseg::Tuple{Real, Real}: time segment
Returns
Named tuple containing:
p::Array{Float64, 4}: powerst::Vector{Float64}: time points
NeuroAnalyzer.topo_var — Function
topo_var(obj; <keyword arguments>)Calculate topographical variance (variance calculated at each time point across all channels).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}}: channels to analyze
Returns
tv::Vector{Float64}: topographical variance
NeuroAnalyzer.total_power — Function
total_power(s; <keyword arguments>)Calculate total power.
Arguments
s::AbstractVectorfs::Int64: sampling ratemethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
tp::Float64: total power
total_power(s; <keyword arguments>)Calculate total power.
`# Arguments
s::AbstractArrayfs::Int64: sampling ratemethod::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 taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(fs / 2)gw::Real=5: Gaussian width in Hz
Returns
tp::Matrix{Float64}: total power
total_power(obj, ch, method, nt, wlen, woverlap, w, ncyc, gw, wt)Calculate total power.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesmethod::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 taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hz
Returns
tp::Matrix{Float64}: total power
NeuroAnalyzer.tpt_analyze — Function
tpt_analyze(nn_seg)Analyze pinches in TPT recording.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
n::Int64: number of pinchest_mean::Float64: mean interval between pinches [ms]t_median::Float64: median interval between pinches [ms]t_rmssd::Float64: ("root mean square of successive differences"), the square root of the mean of the squares of the successive differences between adjacent pinches [ms]t_sdsd::Float64: ("standard deviation of successive differences"), the standard deviation of the successive differences between adjacent pinches [ms]
Note
Return nothing if no pinches are detected.
NeuroAnalyzer.tpt_detect — Function
tpt_detect(obj)Detect pinches in TPT recording.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
p_idx::Vector{Int64}: index of pinches locations
NeuroAnalyzer.transform — Function
transform(s; <keyword arguments>)Calculate Fourier/Hilbert transformation.
Arguments
s::AbstractArraypad::Int64=0: number of zeros padding the signalh::Bool=false: perform Hilbert transformationdb::Bool=false: normalize powers to dBnf::Bool=false: if true, return Fourier coefficients for negative and positive frequencies, otherwise return Fourier coefficients for positive frequencies only
Returns
Named tuple containing:
c::Array{ComplexF64, 3}: Fourier or Hilbert coefficientsa::Array{Float64, 3}: amplitudesp::Array{Float64, 3}: powers- `ph::Array{Float64, 3}: phases (in radians)
transform(obj; <keyword arguments>)Calculate Fourier/Hilbert transformation.
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namespad::Int64=0: number of zeros to add signal for FFTh::Bool=false: use Hilbert transform for calculations instead of FFTdb::Bool=false: normalize powers to dBnf::Bool=false: if true, return Fourier coefficients for negative and positive frequencies, otherwise return Fourier coefficients for positive frequencies only
Returns
Named tuple containing:
c::Array{ComplexF64, 3}: Fourier or Hilbert coefficientsa::Array{Float64, 3}: amplitudesp::Array{Float64, 3}: powers- `ph::Array{Float64, 3}: phases (in radians)
NeuroAnalyzer.vartest — Function
vartest(obj; <keyword arguments>)Calculate variance F-test.
Arguments
obj::NeuroAnalyzer.NEURO- `ch::Union{String, Vector{String}, Regex}: 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.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::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.wpli — Function
wpli(s1, s2; <keyword arguments>)Calculate weighted PLI (Phase Locking Index).
Arguments
s1::AbstractVectors2::AbstractVectordebiased::Bool=false: iftrue, calculate debiased wPLI
Returns
Named tuple containing:
pv::Float64: wPLI valuesd::Vector{Float64}: signal difference (s2 - s1)phd::Vector{Float64}: phase difference (s2 - s1)s1ph::Vector{Float64}: signal 1 phases2ph::Vector{Float64}: signal 2 phase
wpli(obj1, obj2; <keyword arguments>)Calculate weighted PLI (Phase Locking Index).
Arguments
obj1::NeuroAnalyzer.NEUROobj2::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 epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsdebiased::Bool=false: iftrue, calculate debiased wPLI
Returns
Named tuple containing:
pv::Matrix{Float64}: PLI valuesd::Array{Float64, 3}: signal difference (s2 - s1)phd::Array{Float64, 3}: phase difference (s2 - s1)s1ph::Array{Float64, 3}: signal 1 phases2ph::Array{Float64, 3}: signal 2 phase
wpli(obj; <keyword arguments>)Calculate weighted PLI (Phase Locking Index).
Arguments
obj::NeuroAnalyzer.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesdebiased::Bool=false: iftrue, calculate debiased wPLI
Returns
pv::Array{Float64, 3}: wPLI value
NeuroAnalyzer.xcor — Function
xcor(s1, s2; <keyword arguments>)Calculate cross-correlation.
Arguments
s1::AbstractVectors2::AbstractVectorl::Int64=round(Int64, min(length(s1) - 1, 10 * log10(length(s1)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-correlationbiased::Bool=true: calculate biased or unbiased cross-correlationmethod::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]),biasedvalue is ignored:stat: use StatsBasecrosscor(),biasedvalue is ignored
Returns
xc::Array{Float64, 3}
xcor(s1, s2; <keyword arguments>)Calculate cross-correlation.
Arguments
s1::AbstractMatrixs2::AbstractMatrixl::Int64=round(Int64, min(size(s1[1, :, 1], 1) - 1, 10 * log10(size(s1[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-correlationbiased::Bool=true: calculate biased or unbiased cross-correlationmethod::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 StatsBasecrosscor(),biasedvalue is ignored
Returns
xc::Array{Float64, 3}
xcor(s1, s2; <keyword arguments>)Calculate cross-correlation.
Arguments
s1::AbstractArrays2::AbstractArrayl::Int64=round(Int64, min(size(s1[1, :, 1], 1) - 1, 10 * log10(size(s1[1, :, 1], 1)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-correlationbiased::Bool=true: calculate biased or unbiased cross-correlationmethod::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 StatsBasecrosscor(),biasedvalue 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.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsl::Real=1: lags range is-l:ldemean::Bool=true: demean signal before computing cross-correlationbiased::Bool=true: calculate biased or unbiased cross-correlationmethod::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 StatsBasecrosscor(),biasedvalue is ignored
Returns
Named tuple containing:
xc::Array{Float64, 3}: cross-correlationl::Vector{Float64}: lags [s]
NeuroAnalyzer.xcov — Function
xcov(s1, s2; <keyword arguments>)Calculate cross-covariance.
Arguments
s1::AbstractVectors2::AbstractVectorl::Int64=round(Int64, min(length(s1) - 1, 10 * log10(length(s1)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-covariancebiased::Bool=true: calculate biased or unbiased cross-covariancemethod::Symbol=:sum: method of calculating cross-covariance::sum:xcf = Σ(s1[1:end - l] .* s2[1+l:end]):cov:xcf = cov(s1[1:end - l], s2[1+l:end]):stat: use StatsBasecrosscov(),biasedvalue is ignored
Returns
xc::Array{Float64, 3}
xcov(s1, s2; <keyword arguments>)Calculate cross-covariance.
Arguments
s1::AbstractMatrixs2::AbstractMatrixl::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-covariancebiased::Bool=true: calculate biased or unbiased cross-covariancemethod::Symbol=:sum: method of calculating cross-covariance::sum:xcf = Σ(s1[1:end - l] .* s2[1+l:end]):cov:xcf = cov(s1[1:end - l], s2[1+l:end]):stat: use StatsBasecrosscov(),biasedvalue is ignored
Returns
xc::Array{Float64, 3}
xcov(s1, s2; <keyword arguments>)Calculate cross-covariance.
Arguments
s1::AbstractArrays2::AbstractArrayl::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2)))): lags range is-l:ldemean::Bool=true: demean signal before computing cross-covariancebiased::Bool=true: calculate biased or unbiased cross-covariancemethod::Symbol=:sum: method of calculating cross-covariance::sum:xcf = Σ(s1[1:end - l] .* s2[1+l:end]):cov:xcf = cov(s1[1:end - l], s2[1+l:end]):stat: use StatsBasecrosscov(),biasedvalue 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.NEUROobj2::NeuroAnalyzer.NEUROch1::Union{String, Vector{String}}: list of channelsch2::Union{String, Vector{String}}: list of channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj1)): default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(nepochs(obj2)): default use all epochsl::Real=1: lags range is-l:ldemean::Bool=true: demean signal before computing cross-covariancebiased::Bool=true: calculate biased or unbiased cross-covariancemethod::Symbol=:sum: method of calculating cross-covariance::sum:xcf = Σ(s1[1:end - l] .* s2[1+l:end]):cov:xcf = cov(s1[1:end - l], s2[1+l:end]):stat: use StatsBasecrosscov(),biasedvalue is ignored
Returns
Named tuple containing:
xc::Array{Float64, 3}: cross-covariancel::Vector{Float64}: lags [s]
NeuroAnalyzer.zipratio — Function
zipratio(obj)Calculate zip ratio for the object data (ratio of zip-compressed to uncompressed object data).
Arguments
obj::NeuroAnalyzer.NEURO
Returns
zip_ratio::Array{Float64, 3}
Notes
Zip ratio is an intermediate marker of signal complexity (with lower values indicating lower complexity).
zipratio() requires zip (Linux/Mac) or zip.exe (Windows) command in the PATH.
Model
NeuroAnalyzer.efield2d — Function
efield2d(; <keyword arguments>)Create model of 2-dimensional electric field.
Arguments
q::Vector{Int64}: charges values, qy::Vector{Int64}::String`: anode locationqx::Vector{Int64}: charges X positions (1 to 100)qy::Vector{Int64}: charges Y positions (1 to 100)
Returns
Named tuple containing:
qq::Vector{Vector{Float64}}: charges positionsnorm_e::Matrix{Float64}: normalized electric fieldex::Matrix{Float64}: electric field X axis vectorey::Matrix{Float64}: electric field Y axis vector
NeuroAnalyzer.tes_model — Function
tes_model(; <keyword arguments>)Create model of TES stimulation.
Arguments
anode::String: anode locationcathode::String: cathode locationanode_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
Plot
NeuroAnalyzer.add_plot_locs — Function
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 plotp2::Plots.Plot{Plots.GRBackend}: locations plotview::Bool=true: view the output imagefile_name::String="": output image filename
Returns
c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.add_to_canvas — Function
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::Int64y::Int64title::String="": title of the subplotview::Bool=true: view the output imagefile_name::String="": output image filename
Returns
c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.add_topmargin_canvas — Function
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.plot — Function
plot(obj; <keyword arguments>)Plot signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectep::Union{Int64, AbstractRange}=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterxlabel::String="default": x-axis label, default is Time [s]ylabel::String="default": y-axis label, default is no labeltitle::String="default": plot titlemono::Bool=false: use color or gray paletteemarkers::Bool: draw epoch markers if availablemarkers::Bool: draw markers if availablescale::Bool=true: draw scaletype::Symbol=:normal: plot type::normal:mean: mean ± 95%CI:butterfly: butterfly plot
avg::Bool=false: plot average EDAbad::Bool=false: plot bad channelss_pos::Tuple{Real, Real}=(0, 0): draw segment borders if different than (0, 0), used byiedit()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 objectc::Union{Symbol, AbstractArray}: component to plotep::Union{Int64, AbstractRange}=0: epoch to displayc_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component channel to display, default is all component channelsseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterxlabel::String="default": x-axis label, default is Time [s]ylabel::String="default": y-axis label, default is no labeltitle::String="default": plot titlemono::Bool=false: use color or gray paletteemarkers::Bool: draw epoch markers if availablescale::Bool=true: draw scaletype::Symbol=:normal: plot type::normal:mean: mean ± 95%CI:butterfly: butterfly plot
avg::Bool=false: plot average EDAkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
plot(obj1, obj2; <keyword arguments>)Plot signal.
Arguments
obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectobj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectep::Union{Int64, AbstractRange}=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterxlabel::String="default": x-axis label, default is Time [s]ylabel::String="default": y-axis label, default is no labeltitle::String="default": plot titlescale::Bool=true: draw scalekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot2canvas — Function
plot2canvas(p)Convert Plots.Plot to CairoSurfaceBase.
Arguments
p::Plots.Plot{Plots.GRBackend}
Returns
c::Cairo.CairoSurfaceBase{UInt32}
NeuroAnalyzer.plot_bar — Function
plot_bar(s; <keyword arguments>)Bar plot.
Arguments
s::AbstractVectorxlabels::Vector{String}: x-ticks labelsxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_box — Function
plot_box(s; <keyword arguments>)Box plot.
Arguments
s::AbstractArrayglabels::Vector{String}: group labels (X ticks)xlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_ci — Function
plot_ci(s, s_ci_l, s_ci_h; <keyword arguments>)Confidence interval plot.
Arguments
s::AbstractVector: signals_l::AbstractVector: CI lower bounds_u::AbstractVector: CI upper boundt::AbstractVector: time pointsxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_coherence — Function
plot_coherence(coh, f; <keyword arguments>)Plot coherence.
Arguments
coh::Vector{Float64}: coherencef::Vector{Float64}: frequenciesfrq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axisxlabel::String="Frequency [Hz]": x-axis labelylabel::String="Coherence": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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}: coherencef::Vector{Float64}: frequenciesclabels::Vector{String}=[""]: channel pairs labels vectorfrq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axisxlabel::String="Frequency [Hz]": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_avg — Function
plot_coherence_avg(coh, f; <keyword arguments>)Plot coherence mean and ±95% CI of averaged channels.
Arguments
coh::Matrix{Float64}: coherencef::Vector{Float64}: frequenciesclabels::Vector{String}=[""]: channel pairs labels vectorfrq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the X-axisxlabel::String="Frequency [Hz]": x-axis labelylabel::String="Coherence": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_butterfly — Function
plot_coherence_butterfly(coh, f; <keyword arguments>)Butterfly PSD plot.
Arguments
coh::Array{Float64, 3}: coherencef::Vector{Float64}: frequenciesclabels::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 labelylabel::String="Coherence": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_compose — Function
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 layoutgrid(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@layoutmacro
Arguments
p::Vector{Plots.Plot{Plots.GRBackend}}: vector of plotslayout::Union(Matrix{Any}, Tuple{Int64, Int64}, Plots.GridLayout}: layoutmono::Bool=false: use color or gray palettekwargs: optional arguments forpvector plots
Returns
pc::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_connectivity_circle — Function
plot_connectivity_circle(m; <keyword arguments>)Plot connectivity circle.
Arguments
m::AbstractMatrix: matrix of connectivities (channel vs. channel)clabels=Vector{String}: channels labelstitle::String="": plot titlethreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_dipole2d — Function
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_dipole3d — Function
plot_dipole3d(d; <keyword arguments>)Plot dipole in 3D.
Arguments
d::NeuroAnalyzer.DIPOLEproject::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_dots — Function
plot_dots(s; <keyword arguments>)Dots plot.
Arguments
s::Vector{Vector{Float64}}glabels::Vector{String}: group labels (X ticks)xlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_dwc — Function
plot_dwc(dc; <keyword arguments>)Plot discrete wavelet decomposition coefficients.
Arguments
dc::Matrix{Float64}: coefficientsn::Int64=size(dc, 1) - 1: number of coefficients to plott::AbstractVector: time pointsmono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eda — Function
plot_eda(t, s, bad; <keyword arguments>)Plot EDA.
Arguments
t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)s::AbstractVector: data to plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: 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 plotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eda_avg — Function
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 plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eda_butterfly — Function
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 plotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteavg::Bool=false: plot average EDAkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_efield2d — Function
plot_efield2d(; <keyword arguments>)Plot 2-dimensional electric field.
Arguments
q::Vector{Int64}: charges values, qy::Vector{Int64}::String`: anode locationqq::Vector{Vector{Float64}}: charges positionsnorm_e::Matrix{Float64}: normalized electric fieldex::Matrix{Float64}: electric field X axis vectorey::Matrix{Float64}: electric field Y axis vectord::Int64=2: density of field vectors
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_empty — Function
plot_empty()Return an empty plot, useful for filling matrices of plots.
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erop — Function
plot_erop(p, f; <keyword arguments>)Plot ERO (Event-Related Oscillations) power-spectrum.
Arguments
p::AbstractArray: ERO powersf::AbstractVector: ERO frequenciesdb::Bool=true: whether ERO powers are normalized to dBxlabel::String="default"ylabel::String="default"title::String="default"frq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the Y axisax::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 palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eros — Function
plot_eros(s, f, t; <keyword arguments>)Plot ERO (Event-Related Oscillations) spectrogram.
Arguments
s::AbstractArray: ERO spectrogramf::AbstractVector: ERO frequenciest::AbstractVector: ERO timedb::Bool=true: whether ERO powers are normalized to dBfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingfrq_lim::Tuple{Real, Real}=(f[1], f[end]): frequency limit for the Y axistm::Union{Int64, Vector{Int64}}=0: time markers (in milliseconds) to be plot as vertical lines, useful for adding topoplots at these time pointsxlabel::String="default"ylabel::String="default"title::String="default"cb::Bool=true: draw color barmono::Bool=false: use color or gray paletteunits::String="μV"smooth::Bool=false: smooth the image using Gaussian blurn::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 — Function
plot_erp(t, s, bad; <keyword arguments>)Plot ERP/ERF.
Arguments
t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)s::AbstractVector: data to plotrt::Union{Nothing, Real}=nothing:: response time valuexlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteyrev::Bool=false: reverse Y axiskwargs: 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 objectch::Union{String, Vector{String}, Regex}: channel name or list of channel namestm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time pointsxlabel::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 barcb_title::String="default": color bar title, default is Amplitude [units]mono::Bool=false: use color or gray palettepeaks::Bool=true: draw peakschannel_labels::Bool=true: draw labels legend (using channel labels) for multi-channel:butterflyplottype::Symbol=:normal: plot type::normal:butterfly: butterfly plot:topo: topographical plot of ERPs:stack: stacked epochs/channels
yrev::Bool=false: reverse Y axisavg::Bool=false: plot average ERP for:butterflyplotsmooth::Bool=false: smooth the image using Gaussian blurn::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:stackplotsort_epochs::Bool=false:: sort epochs by rt vectorkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_avg — Function
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 plotrt::Union{Nothing, Real}=nothing:: response time valuexlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteyrev::Bool=false: reverse Y axiskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_butterfly — Function
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 plotrt::Union{Nothing, Real}=nothing:: response time valueclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteavg::Bool=false: plot average ERPyrev::Bool=false: reverse Y axiskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_stack — Function
plot_erp_stack(s; <keyword arguments>)Plot EPRs stacked by channels or by epochs.
Arguments
t::AbstractVector: x-axis valuess::AbstractArrayrt::Union{Nothing, AbstractVector}=nothing: response time for each epoch; if provided, the response time line will be plotted over the:stackplotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlecb::Bool=true: plot color barcb_title::String="": color bar titlemono::Bool=false: use color or gray palettesmooth::Bool=false: smooth the image using Gaussian blurn::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_topo — Function
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_spht::Vector{Float64}: time vectors::Matrix{Float64}: ERPsch::Union{Vector{Int64}, AbstractRange}: which channels to plotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titleyrev::Bool=false: reverse Y axiscart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesmono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_fi — Function
plot_fi(fi, st; <keyword arguments>)Plot instantaneous frequencies.
Arguments
fi::Vector{Float64}: instantaneous frequenciesst::Vector{Float64}: timexlabel::String="default": X axis label, default is Time [s]ylabel::String="default": Y axis label, default is Power [μV^2/Hz]title::String="default": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_filter_response — Function
plot_filter_response(<keyword arguments>)Plot filter response.
Arguments
fs::Int64: sampling ratefprototype::Symbol: filter prototype::fir: FIR filter:firls: weighted least-squares FIR filter:remez: Remez FIR filter:butterworth: IIR filter:chebyshev1IIR filter:chebyshev2IIR filter:ellipticIIR filter:iirnotch: second-order IIR notch 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}}: filter cutoff in Hz (must be a pair of frequencies for:bpand:bs)order::Int64: filter orderrp::Union{Nothing, Real}=nothing: maximum ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: minimum ripple attenuation in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersbw::Union{Nothing, Real}=nothing: transition band width in Hz for:firls,:remezand:iirnotchfiltersw::Union{Nothing, AbstractVector}=nothing: window for:firfilter (default is Hamming window) or weights for:firlsfiltermono::Bool=false: use color or gray palette- `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the X-axis
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
plot_filter_response(obj, <keyword arguments>)Plot filter response.
Arguments
obj::NeuroAnalyzer.NEUROn::Int64: signal length in samplesfprototype::Symbol: filter prototype::fir: FIR filter:firls: weighted least-squares FIR filter:remez: Remez FIR filter:butterworth: IIR filter:chebyshev1IIR filter:chebyshev2IIR filter:ellipticIIR filter:iirnotch: second-order IIR notch 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}}: filter cutoff in Hz (must be a pair of frequencies for:bpand:bs)order::Int64: filter orderrp::Union{Nothing, Real}=nothing: maximum ripple amplitude in dB in the pass band; default: 0.0025 dB for:elliptic, 2 dB for othersrs::Union{Nothing, Real}=nothing: minimum ripple attenuation in dB in the stop band; default: 40 dB for:elliptic, 20 dB for othersbw::Union{Nothing, Real}=nothing: transition band width in Hz for:firls,:remezand:iirnotchfiltersw::Union{Nothing, AbstractVector}=nothing: window for:firfilter (default is Hamming window) or weights for:firlsfiltermono::Bool=false: use color or gray palette- `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the X-axis
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_gridlocs — Function
plot_gridlocs()Plot a simplified plot of 10-20 EEG channels on a grid.
Arguments
mono::Bool=false: use color or gray palette
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_heatmap — Function
plot_heatmap(m; <keyword arguments>)Plot heatmap.
Arguments
m::AbstractMatrixx::AbstractVectory::AbstractVectorxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettecb::Bool=true: draw color barcb_title::String="": color bar titlethreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_histogram — Function
plot_histogram(s; <keyword arguments>)Plot histogram.
Arguments
s::AbstractVectorx::Union{Nothing, Real}=nothing: value to plot against the histogramtype::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,:scottor:fd)label::String="": channel labelxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettedraw_mean::Bool=truedraw_median::Bool=truekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_hs — Function
plot_hs(sp, st; <keyword arguments>)Plot Hilbert spectrum.
Arguments
sp::Vector{Float64}: Hilbert transform powersst::Vector{Float64}: timexlabel::String="default": X axis label, default is Time [s]ylabel::String="default": Y axis label, default is Power [μV^2/Hz]title::String="default": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_icatopo — Function
plot_icatopo(obj; <keyword arguments>)Topographical plot of embedded ICA components.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component(s) to plot, default is all componentsseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shortercb::Bool=false: plot color barcb_label::String="[A.U.]": color bar labelamethod::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, seenormalize()plot_contours::Bools=true: plot contours over topo plotplot_electrodes::Bools=true: plot electrodes over topo plotkwargs: 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 objectic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel namesic_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component(s) to plot, default is all componentsseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shortercb::Bool=false: plot color barcb_label::String="[A.U.]": color bar labelamethod::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, seenormalize()plot_contours::Bools=true: plot contours over topo plotplot_electrodes::Bools=true: plot electrodes over topo plotkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_imf — Function
plot_imf(imf; <keyword arguments>)Plot intrinsic mode functions (IMF), the residual and reconstructed signal.
Arguments
imf::Matrix{Float64}: IMFsn::Int64=size(imf, 1) - 1: number of IMFs to plott::AbstractVector: time pointsmono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_line — Function
plot_line(s; <keyword arguments>)Line plot.
Arguments
s::AbstractVectorxlabels::Vector{String}: x-ticks labelsxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
plot_line(s; <keyword arguments>)Line plot.
Arguments
s::AbstractArrayrlabels::Vector{String}: signal rows labelsxlabels::Vector{String}: x-ticks labelsxlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs — Function
plot_locs(locs; <keyword arguments>)Preview channel locations.
Arguments
locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}, AbstractRange}=1:DataFrames.nrow(locs): list of locations to plot, default is all locationsselected::Union{Int64, Vector{Int64}, AbstractRange}=0: which channels should be highlightedch_labels::Bool=true: plot locations labelshead::Bool=true: draw headhead_labels::Bool=false: plot head labelsmono::Bool=false: use color or gray palettegrid::Bool=false: draw grid, useful for locating positionslarge::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plotcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesplane::Symbol=:xy: which plane to plot::xy: horizontal (top):xz: coronary (front):yz: sagittal (side)
transparent::Bool=false: if true, do not paint the backgroundconnections::Matrix{<:Real}=[0 0; 0 0]: matrix of connections weights (channels by channels)threshold::Real=0: threshold for plotting, see belowthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < 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.NEUROch::Union{String, Vector{String}, Regex}: channel name or list of channel namesselected::Union{String, Vector{String}}: which channels should be highlightedch_labels::Bool=true: plot channel labelssrc_labels::Bool=false: plot source labelsdet_labels::Bool=false: plot detector labelsopt_labels::Bool=false: plot optode type (S for source, D for detector) and numberhead::Bool=true: draw headhead_labels::Bool=false: plot head labelsd::Int64=2: 2- or 3-dimensional plotmono::Bool=false: use color or gray palettegrid::Bool=false: draw grid, useful for locating positionslarge::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plotcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesplane::Symbol=:xy: which plane to plot::xy: horizontal (top):xz: coronary (front):yz: sagittal (side)
interactive::Bool=true: if true, use interactive 3-dimensional plottransparent::Bool=false: if true, do not paint the backgroundconnections::Matrix{<:Real}=[0 0; 0 0]: matrix of connections weights (channels by channels)threshold::Real=0: threshold for plotting, see belowthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < 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 weightscamera::Tuple{Real, Real}=(20, 45): camera position - (XY plane angle, XZ plane angle)mesh_type::Union{Nothing, Symbol}=nothing: type of mesh to plot (:brainor:head)mesh_alpha::Float64=0.95: mesh opacity, from 1 (no opacity) to 0 (complete opacity)
Returns
Union{Plots.Plot{Plots.GRBackend}, GLMakie.Figure, Nothing}
NeuroAnalyzer.plot_locs3d — Function
plot_locs3d(locs; <keyword arguments>)3D preview of channel locations.
Arguments
locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}}=1:DataFrames.nrow(locs): list of channels, default is all channelsselected::Union{Int64, Vector{Int64}, AbstractRange}=0: which channel should be highlightedch_labels::Bool=true: plot channel labelshead_labels::Bool=true: plot head labelsmono::Bool=false: use color or gray palettecart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinatescamera::Tuple{Real, Real}=(20, 45): camera position - (XY plane angle, XZ plane angle)
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs3d_mesh — Function
plot_locs3d_mesh(locs; <keyword arguments>)3D preview of channel locations with brain or head mesh.
Arguments
locs::DataFrame: columns: channel, labels, locradius, loctheta, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}}=1:DataFrames.nrow(locs): list of channels, default is all channelsselected::Union{Int64, Vector{Int64}, AbstractRange}=0: which channel should be highlightedch_labels::Bool=true: plot channel labelshead_labels::Bool=true: plot head labelsmono::Bool=false: use color or gray palettecart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinatescamera::Tuple{Real, Real}=(20, 45): camera position - (XY plane angle, XZ plane angle)mesh_type::Symbol=:brain: type of mesh to plot (:brainor:head)mesh_alpha::Float64=0.95: mesh opacity, from 1 (no opacity) to 0 (complete opacity)
Returns
f::GLMakie.Figure
NeuroAnalyzer.plot_locs_nirs — Function
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_sphopt_pairs::Matrix{Int64}: pairs of source and detectorsrc_n::Int64: number of sourcesdet_n::Int64: number of detectorssrc_labels::Bool=false: plot source labelsdet_labels::Bool=false: plot detector labelsopt_labels::Bool=false: plot optode type (S for source, D for detector) and numberhead_labels::Bool=true: plot head labelsmono::Bool=false: use color or gray palettegrid::Bool=false: draw grid, useful for locating positionsplot_size::Int64=400: plot dimensions in pixels (size × size)
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_matrix — Function
plot_matrix(m; <keyword arguments>)Plot matrix.
Arguments
m::Matrix{<:Real}xlabels::Vector{String}ylabels::Vector{String}xlabel::String=""ylabel::String=""title::String=""cb::Bool=true: draw color barcb_title::String="": color bar titlexrot::Int64=0: rotate xlabels by xrot degreesmono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep — Function
plot_mep(t, s, bad; <keyword arguments>)Plot MEP.
Arguments
t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)s::AbstractVector: data to plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteyrev::Bool=false: reverse Y axiskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
plot_mep(obj; <keyword arguments>)Plot MEP.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::Union{String, Vector{String}, Regex}: channel name or list of channel namestm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time pointsxlabel::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 barcb_title::String="default": color bar title, default is Amplitude [units]mono::Bool=false: use color or gray palettepeaks::Bool=true: draw peakspeaks_detect::Bool=true: if true, detect MEP peaks, otherwise use embeddedchannel_labels::Bool=true: draw labels legend (using channel labels) for multi-channel:butterflyplottype::Symbol=:normal: plot type::normal, butterfly plot (:butterfly), topographical plot of ERPs (:topo) or stacked epochs/channels (:stack)yrev::Bool=false: reverse Y axisavg::Bool=false: plot average MEP for:butterflyplotkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_avg — Function
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 plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteyrev::Bool=false: reverse Y axiskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_butterfly — Function
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 plotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteavg::Bool=false: plot average MEPyrev::Bool=false: reverse Y axiskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_mep_stack — Function
plot_mep_stack(s; <keyword arguments>)Plot EPRs stacked by channels or by epochs.
Arguments
t::AbstractVector: x-axis valuess::AbstractArrayclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlecb::Bool=true: plot color barcb_title::String="": color bar titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_paired — Function
plot_paired(signal; <keyword arguments>)Plot paired data.
Arguments
signal::Vector{Vector{Float64}}glabels::Vector{String}: group labels (X ticks)xlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phase — Function
plot_phase(ph, sf; <keyword arguments>)Plot phases.
Arguments
ph::Vector{Float64}: phasessf::Vector{Float64}: frequenciesunit::Symbol=:rad: phase unit (radians or degrees)type::Symbol=:line: plot type (:line: line,:stem: stems)xlabel::String="default": x-axis label, default is Time [s]ylabel::String="default": y-axis label, default is Power [μV^2/Hz]title::String="default": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_phsd — Function
plot_phsd(sf, sp; <keyword arguments>)Plot PHSD (phase spectral density).
Arguments
sf::Vector{Float64}: frequenciessp::Vector{Float64}:phasesfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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}: frequenciessp::Matrix{Float64}:phasesclabels::Vector{String}=[""]: signal channel labels vectorfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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 objectseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency boundsax::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] [epoch: 1, time window: 0 ms:10 s]mono::Bool=false: use color or gray palettetype::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 objectc::Union{Symbol, AbstractArray}: component to plotseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displayc_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component channel to display, default is all component channelsfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency boundsax::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] [epoch: 1, time window: 0 ms:10 s]mono::Bool=false: use color or gray palettetype::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_3d — Function
plot_phsd_w3d(sf, sp; <keyword arguments>)Plot 3-d waterfall PHSD plot.
Arguments
sf::Vector{Float64}: frequenciessp::Array{Float64, 3}:phasesclabels::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 labelylabel::String="": y-axis labelzlabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_avg — Function
plot_phsd_avg(sf, sp; <keyword arguments>)Plot PHSD mean and ±95% CI of averaged channels.
Arguments
sf::Vector{Float64}: frequenciessp::Array{Float64, 3}:phasesxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_butterfly — Function
plot_phsd_butterfly(sf, sp; <keyword arguments>)Butterfly PHSD plot.
Arguments
sf::Vector{Float64}: frequenciessp::Array{Float64, 3}:phasesclabels::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 labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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_topo — Function
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_sphsf::Vector{Float64}: frequenciessp::Array{Float64, 3}:phasesch::Union{Vector{Int64}, AbstractRange}: which channels to plotclabels::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 labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteax::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 planeskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_polar — Function
plot_polar(s; <keyword arguments>)Polar plot.
Arguments
s::Union{AbstractVector, AbstractArray}m::Tuple{Real, Real}=(0, 0): major value to plottitle::String="": plot titlemono::Bool=false: use color or gray paletteticks::Bool=false: draw X and Y tickskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_polezero — Function
plot_polezero(s; <keyword arguments>)Polar pole-zero map.
Arguments
p::Vector{Complex{Float64}}: vector of polesz::Vector{Complex{Float64}}: vector of zerosm::Tuple{Real, Real}=(0, 0): major value to plottitle::String="": plot titlemono::Bool=false: use color or gray paletteticks::Bool=false: draw X and Y ticksms::Symbol=:circle: marker shape for drawing complex numbers (:circleor:xcross)kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd — Function
plot_psd(sf, sp; <keyword arguments>)Plot PSD (power spectrum density).
Arguments
sf::Vector{Float64}: frequenciessp::Vector{Float64}: powersfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingkwargs: 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}: frequenciessp::Matrix{Float64}: powersclabels::Vector{String}=[""]: signal channel labels vectorfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingkwargs: 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 objectseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesdb::Bool=true: normalize powers to dBmethod::Symbol=:welch: method used to calculate PSD::welch: Welch's periodogram:fft: fast Fourier transform:mt: multi-taper periodogram:stft: short time Fourier transform:mw: Morlet wavelet convolution:gh: Gaussian and Hilbert transform
nt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency boundsncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hzref::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_loweror:gamma_higherfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingxlabel::String="default": x-axis label, default is Frequency [Hz]ylabel::String="default": y-axis label, default isPower [dB units^2/Hz] or Power [units^2/Hz]zlabel::String="default": z-axis label for 3-d plots, default isPower [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 palettetype::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 objectc::Union{Symbol, AbstractArray}: component to plotseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displayc_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component channel to display, default is all component channelsdb::Bool=true: normalize powers to dBmethod::Symbol=:welch: method used to calculate PSD::welch: Welch's periodogram:fft: fast Fourier transform:mt: multi-taper periodogram:stft: short time Fourier transform:mw: Morlet wavelet convolution:gh: Gaussian and Hilbert transform
nt::Int64=7: number of Slepian taperswlen::Int64=fs: window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency boundsncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)gw::Real=5: Gaussian width in Hzref::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_loweror:gamma_higherfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingxlabel::String="default": x-axis label, default is Frequency [Hz]ylabel::String="default": y-axis label, default isPower [dB units^2/Hz] or Power [units^2/Hz]zlabel::String="default": z-axis label for 3-d plots, default isPower [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 palettetype::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_3d — Function
plot_psd_w3d(sf, sp; <keyword arguments>)Plot 3-d waterfall PSD plot.
Arguments
sf::Vector{Float64}: frequenciessp::Array{Float64, 3}: powersclabels::Vector{String}=[""]: signal channel labels vectordb::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 labelylabel::String="": y-axis labelzlabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingvariant::Symbol: waterfall (:w) or surface (:s)kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_avg — Function
plot_psd_avg(sf, sp; <keyword arguments>)Plot PSD mean and ±95% CI of averaged channels.
Arguments
sf::Vector{Float64}: frequenciessp::Matrix{Float64}: powersdb::Bool=true: whether powers are normalized to dBfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the X-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_butterfly — Function
plot_psd_butterfly(sf, sp; <keyword arguments>)Butterfly PSD plot.
Arguments
sf::Vector{Float64}: frequenciessp::Array{Float64, 3}: powersclabels::Vector{String}=[""]: signal channel labels vectordb::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 labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingkwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_topo — Function
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_sphsf::Vector{Float64}: frequenciessp::Array{Float64, 3}: powersch::Union{Vector{Int64}, AbstractRange}: which channels to plotclabels::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 labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettefrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planeskwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_save — Function
plot_save(p; <keyword arguments>)Saves plot as file (PNG/PDF). File format is determined using file_name extension.
Arguments
p::Union{Plots.Plot{Plots.GRBackend}, Makie.Figure}file_name::String
Returns
Nothing
NeuroAnalyzer.plot_signal — Function
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 plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlebad::Bool=false: is this a bad channelkwargs: 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 plotclabels::Vector{String}=repeat([""], size(s, 1)): channel labelsctypes:::Vector{String}=repeat([""], size(s, 1)): channel typescunits::Vector{String}=repeat([""], size(s, 1)): channel unitsxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettescale::Bool=true: draw scalebad::Vector{Bool}=zeros(Bool, size(s, 1)): list of bad channelskwargs: 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 plots2::AbstractVector: data to plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlekwargs: 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 plots2::AbstractArray: data to plotclabels::Vector{String}=repeat([""], size(s1, 1)): channel labelsctypes:::Vector{String}=repeat([""], size(s1, 1)): channel typescunits::Vector{String}=repeat([""], size(s1, 1)): channel unitsxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettescale::Bool=true: draw scalekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_avg — Function
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 plotxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_butterfly — Function
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 plotclabels::Vector{String}=[""]: signal channel labels vectorxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titleavg::Bool=false: plot average channelsmono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogram — Function
plot_spectrogram(st, sf, sp; <keyword arguments>)Plot single-channel spectrogram.
Arguments
st::Vector{Float64}: timesf::Vector{<:Real}: frequenciessp::Matrix{Float64}: powersdb::Bool=true: whether powers are normalized to dBfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteunits::String=""smooth::Bool=false: smooth the image using Gaussian blurn::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)cb::Bool=true: plot color barthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
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 labelssf::Vector{<:Real}: frequenciessp::Matrix{Float64}: powersdb::Bool=true: whether powers are normalized to dBfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingfrq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axisxlabel::String="": x-axis labelylabel::String="": y-axis labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteunits::String=""smooth::Bool=false: smooth the image using Gaussian blurn::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)cb::Bool=true: plot color barthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
plot_spectrogram(obj; <keyword arguments>)Plots spectrogram.
Arguments
obj::NeuroAnalyzer.NEUROseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesdb::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 signalmethod::Symbol=:stft: method of calculating spectrogram::stft: short-time Fourier:mt: multi-tapered periodogram:mw: Morlet wavelet convolution:gh: Gaussian and Hilbert transform:cwt: continuous wavelet transformation:hht: Hilbert-Huang transform
nt::Int64=7: number of Slepian taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowgw::Real=10: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletsfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): y-axis limitsxlabel::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 palettemarkers::Bool: draw markers if availablesmooth::Bool=false: smooth the image using Gaussian blurn::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)cb::Bool=true: plot color barthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
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.NEUROc::Union{Symbol, AbstractArray}: component to plotseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterep::Int64=0: epoch to displayc_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component channel to display, default is all component channelsdb::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 signalmethod::Symbol=:stft: method of calculating spectrogram::stft: short-time Fourier:mt: multi-tapered periodogram:mw: Morlet wavelet convolution:gh: Gaussian and Hilbert transform:cwt: continuous wavelet transformation:hht: Hilbert-Huang transform
nt::Int64=7: number of Slepian taperswlen::Int64=sr(obj): window length (in samples), default is 1 secondwoverlap::Int64=round(Int64, wlen * 0.97): window overlap (in samples)w::Bool=true: if true, apply Hanning windowgw::Real=10: Gaussian width in Hzncyc::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), wherefrq_nis the length of0:(sr(obj) / 2)wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, see ContinuousWavelets.jl documentation for the list of available waveletsfrq::Symbol=:lin: linear (:lin) or logarithmic (:log) frequencies scalingfrq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): y-axis limitsxlabel::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 palettemarkers::Bool: draw markers if availableunits::String=""smooth::Bool=false: smooth the image using Gaussian blurn::Int64=3: kernel size of the Gaussian blur (larger kernel means more smoothing)cb::Bool=true: plot color barthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_topo — Function
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_sphch::Union{Int64, Vector{Int64}}=1:DataFrames.nrow(locs): list of channels, default is all channelscb::Bool=true: plot color barcb_label::String="[A.U.]": color bar labeltitle::String="": plot titlemono::Bool=false: use color or gray paletteimethod::Symbol=:sh: interpolation method::sh: Shepard:mq: Multiquadratic:imq: InverseMultiquadratic:tp: ThinPlate:nn: NearestNeighbour:ga: Gaussian
nmethod::Symbol=:minmax: method for normalization, seenormalize()plot_contours::Bools=true: plot contours over topo plotplot_electrodes::Bools=true: plot electrodes over topo plotlarge::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plothead::Bool=true: draw headcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
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 objectep::Union{Int64, AbstractRange}=0: epoch to displaych::Union{String, Vector{String}, Regex}: channel name or list of channel namesseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shortertitle::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 palettecb::Bool=true: plot color barcb_label::String="[A.U.]": color bar labelamethod::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, seenormalize()plot_contours::Bools=true: plot contours over topo plotplot_electrodes::Bools=true: plot electrodes over topo plotlarge::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plothead::Bool=true: draw headcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
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 objectc::Union{Symbol, AbstractArray}: component to plotep::Union{Int64, AbstractRange}=0: epoch to displayc_idx::Union{Int64, Vector{Int64}, AbstractRange}=0: component channel to display, default is all component channelsseg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shortertitle::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 palettecb::Bool=true: plot color barcb_label::String="[A.U.]": color bar labelamethod::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, seenormalize()plot_contours::Bools=true: plot contours over topo plotplot_electrodes::Bools=true: plot electrodes over topo plotlarge::Bool=true: draw large (size of electrodes area 600×600 px, more details) or small (size of electrodes area 240×240 px, less details) plothead::Bool=true: draw headcart::Bool=false: if true, use Cartesian coordinates, otherwise use polar coordinates for XY plane and spherical coordinates for XZ and YZ planesthreshold::Union{Nothing, Real}=nothing: if set, use threshold to mark a regionthreshold_type::Symbol=:neq: rule for thresholding::eq: draw region is values are equal to threshold:neq: draw region is values are not equal to threshold:geq: draw region is values are ≥ to threshold:leq: draw region is values are ≤ to threshold:g: draw region is values are > to threshold:l: draw region is values are < to threshold
kwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_violin — Function
plot_violin(s; <keyword arguments>)Violin plot.
Arguments
s::AbstractArrayglabels::Vector{String}: group labels (X ticks)xlabel::String="": X axis labelylabel::String="": Y axis labeltitle::String="": plot titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_xac — Function
plot_xac(m, lags; <keyword arguments>)Plot cross/auto-covariance/correlation.
Arguments
m::Abstractvector: covariance matrixlags::AbstractVector: covariance lagsxlabel::String="lag"ylabel::String=""title::String=""cb_title::String="": color bar titlemono::Bool=false: use color or gray palettekwargs: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.resize_canvas — Function
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.iedit — Function
iedit(obj; <keyword arguments>)Interactive edit signal channels properties and locations.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::String: initial channel
Returns
Nothing
NeuroAnalyzer.ifilter — Function
ifilter(obj)Interactive filter design.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
flt::Union{Nothing, Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}
Notes
The returned filter is based on sampling rate and epoch length of the OBJ used for designing the filter. Therefore, it should not be applied for objects of different sampling rate or epoch length.
NeuroAnalyzer.iplot_locs3d — Function
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_sphch::Union{Int64, Vector{Int64}, AbstractRange}=1:DataFrames.nrow(locs): channel(s) to plot, default is all channelsselected::Union{Int64, Vector{Int64}, AbstractRange}=0: selected channel(s) to plotch_labels::Bool=true: plot channel labelshead_labels::Bool=true: plot head labelsmono::Bool=false: use color or gray palettecart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinatescamera::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.NEUROch::Union{String, Vector{String}, Regex}: channel(s) to plotselected::Union{String, Vector{String}}="": selected channel(s) to plotch_labels::Bool=true: plot channel labelshead_labels::Bool=true: plot head labelsmono::Bool=false: use color or gray palettecart::Bool=false: if true, use Cartesian coordinates, otherwise use spherical coordinatescamera::Tuple{Real, Real}=(20, 45): camera position - (XY plane angle, XZ plane angle)
Returns
Nothing
NeuroAnalyzer.ipsd — Function
ipsd(obj; <keyword arguments>)Interactive PSD of continuous signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::String: channel namezoom::Real=10: how many seconds are displayed in one segment
Returns
Nothing
NeuroAnalyzer.ipsd_ep — Function
ipsd_ep(obj, ch)Interactive PSD of epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::String: channel name
Returns
Nothing
NeuroAnalyzer.iselect_seg — Function
iselect_seg(m; <keyword arguments>)Interactive selection of matrix area.
Arguments
m::AbstractMatrixshape::Symbol=:r: selection shape::r: rectangular:c: circular:p: point
extract::Bool=false: if true, return values of the matrixv::Bool=false: if true, return as vector (matrix m by rows over columns)
Returns
r1::Int64: upper-left cornerr2::Int64: bottom-right cornerc1::Int64: upper-left cornerc2::Int64: bottom-right corner
or
seg::Union{Nothing, <:Real, Tuple{Int64, Int64}, Tuple{Int64, Int64, Int64, Int64}, Union{AbstractMatrix, AbstractVector, Tuple{AbstractVector, AbstractVector}}}: extracted segment or its coordinates
NeuroAnalyzer.ispectrogram — Function
ispectrogram(obj; <keyword arguments>)Interactive spectrogram of continuous signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::String: channel namezoom::Real=10: how many seconds are displayed in one segment
Returns
Nothing
NeuroAnalyzer.ispectrogram_ep — Function
ispectrogram_ep(obj; <keyword arguments>)Interactive spectrogram of epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::String: channel name
Returns
Nothing
NeuroAnalyzer.itopo — Function
itopo(obj; <keyword arguments>)Interactive topographical map of continuous signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::Union{String, Vector{String}, Regex}: channels to plot
Returns
Nothing
NeuroAnalyzer.itopo_ep — Function
itopo_ep(obj; <keyword arguments>)Interactive topographical map of epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::Union{String, Vector{String}, Regex}: channels to plot
Returns
Nothing
NeuroAnalyzer.iview — Function
iview(obj; <keyword arguments>)Interactive view of continuous signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectmch::Bool=true: draw multichannel signal (up to 20 channels in one plot)zoom::Real=10: how many seconds are displayed in one segmentbad::Bool=true: list of bad channels; if not false - plot bad channels using this listsnap::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 objectobj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectzoom::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 objectc::Union{Symbol, AbstractArray}: component to plotzoom::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_ep — Function
iview_ep(obj; <keyword arguments>)Interactive view of epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectmch::Bool=true: draw multichannel signal (up to 20 channels in one plot)ep::Int64=1: initial epoch to displaybad::Bool=true: list of bad channels; if not false - plot bad channels using this listsnap::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 objectobj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectep::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 objectc::Union{Symbol, AbstractArray}: component to plotep::Int64=1: initial epoch to display
Returns
Nothing
NeuroAnalyzer.iview_ica — Function
iview_ica(obj; <keyword arguments>)Interactive view of embedded ("ic" and "ic_mw") ICA components.
Arguments
obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO objectch::Union{String, Vector{String}, Regex}: 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 objectic::Matrix{Float64}: components IC(1)..IC(n)ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)ch::Union{String, Vector{String}, Regex}: channel name or list of channel names
Returns
Nothing
NeuroRecorder
NeuroAnalyzer.edar — Function
edar(; <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 secondsport_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.iedar — Function
iedar(; <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 secondsport_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.rt_plotter — Function
rt_plotter(; <keyword arguments>)Plot recorded signal in real time.
Arguments
fs::Int64l::Int64=5: displayed segment length (in seconds)duration::Int64=20: duration of recording (in seconds)
Returns
Plots.Plot{Plots.GRBackend}
NeuroStim
NeuroAnalyzer.ect_charge — Function
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_dose — Function
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_dose — Function
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_protocol — Function
tes_protocol(; <keyword arguments>)Create TES (tDCS/tACS/tRNS/tPCS) protocol.
Arguments
type::Symbol: stimulation type (:tDCS,:tACS,:tRNS,:tPCS)hd::Bool: high-density electrodescurrent::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_dose — Function
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
NeuroAnalyzer.ftt — Function
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=20: single trial duration in secondstrials::Int64=2: number of trialsinterval::Int64=2: interval between trials in secondsgpio::Int64=-1: Raspberry Pi GPIO to which the switch is connected (e.g.gpio=23is Pi board pin 16); set to -1 to disable using GPIOport_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 trialtap_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 intervalstap_t_int::Vector{Vector{Float64}}: taps time point [ms] during intervalstap_d_int::Vector{Vector{Float64}}: taps duration [ms] during intervals
NeuroAnalyzer.iavh — Function
iavh()Interactive tool for subjective recreation of auditory hallucinations. Four languages are available (English, German, Spanish and Polish). Four types of auditory hallucinations are available: speech (Auditory Verbal Hallucinations), whispers, noise and ringing (8000 Hz).
Patient may locate the sounds in space to recreate how distant or close they are. Also, volume of the auditory experiences may be modified. In case of AVH, emotional content (negative, neutral or positive) and voice gender (male or female) may be chosen.
When done, patient's settings may be easily exported to a CSV file for further analysis.
Arguments
Nothing
Returns
Nothing
NeuroAnalyzer.iftt — Function
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=20: single trial duration in secondstrials::Int64=2: number of trialsinterval::Int64=2: interval between trials in secondsgpio::Int64=-1: Raspberry Pi GPIO to which the switch is connected (e.g.gpio=23is Pi board pin 16); set to -1 to disable using GPIOport_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 trialtap_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 intervalstap_t_int::Vector{Vector{Float64}}: taps time point [ms] during intervalstap_d_int::Vector{Vector{Float64}}: taps duration [ms] during intervals
NeuroAnalyzer.itpt — Function
itpt(; <keyword arguments>)Perform Two-point Pinch Test (TPT) in GUI mode. TPT is recorded using MMA7660 accelerometer via Arduino attached to the PC via USB cable (virtual serial port). Sampling rate is 50 Hz.
Arguments
duration::Int64=20: recording duration in secondsport_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected
Returns
obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.tpt — Function
tpt(; <keyword arguments>)Perform Two-point Pinch Test (TPT) in CLI mode. TPT is recorded using MMA7660 accelerometer via Arduino attached to the PC via USB cable (virtual serial port). Sampling rate is 50 Hz.
Arguments
duration::Int64=20: recording duration in secondsport_name::String="/dev/ttyUSB0": serial port to which the Arduino is connected
Returns
obj_new::NeuroAnalyzer.NEURO