NeuroAnalyzer.jl documentation

This documentation has been generated using Documenter.jl.

NeuroAnalyzer

NeuroAnalyzer.na_plugins_updateFunction
na_plugins_update(plugin)

Install NeuroAnalyzer plugin.

Arguments

  • plugin::String: plugin to update; if empty, update all
NeuroAnalyzer.na_set_prefsMethod
na_set_prefs(use_cuda, plugins_path, progress_bar, verbose)

Save NeuroAnalyzer preferences.

Arguments

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

Utils

NeuroAnalyzer.applyMethod
apply(obj; ch, f)

Apply custom function.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • f::String: function to be applied, e.g. f="mean(obj, dims=3)"; OBJ signal is given using variableobj` here.

Returns

  • out::Array{Float64, 3}
NeuroAnalyzer.l1Method
l1(a1, a2)

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

Arguments

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

Returns

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

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

Arguments

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

Returns

  • l2::Float64
NeuroAnalyzer.perm_cmpMethod
perm_cmp(a1, a2; p, perm_n)

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

Arguments

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

Returns

Named tuple containing:

  • zmap::Array{Float64, 3}: array of Z-values
  • bm::Array{Float64, 3}: binarized mask of statistically significant positions
NeuroAnalyzer.component_typeMethod
component_type(obj, c)

Return component data type.

Arguments

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

Return

  • c_type::DataType
NeuroAnalyzer.rename_componentMethod
rename_component(obj, c_old, c_new)

Rename component.

Arguments

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

Return

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

Rename component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c_old::Symbol: old component name
  • c_new::Symbol: new component name
NeuroAnalyzer.add_componentMethod
add_component(obj; c, v)

Add component.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_component!Method
add_component!(obj; c, v)

Add component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Symbol: component name
  • v::Any: component value
NeuroAnalyzer.list_componentMethod
list_component(obj)

List component names.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • components::Vector{Symbol}
NeuroAnalyzer.extract_componentMethod
extract_component(obj, c)

Extract component values.

Arguments

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

Returns

  • c::Any
NeuroAnalyzer.delete_componentMethod
delete_component(obj; c)

Delete component.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reset_componentsMethod
reset_components(obj)

Remove all components.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.fft0Function
fft0(x, n)

Zeros-padded FFT.

Arguments

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

Returns

  • fft0::Vector{ComplexF64}
NeuroAnalyzer.ifft0Function
ifft0(x, n)

IFFT of zero-padded vector.

Arguments

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

Returns

  • ifft0::Vector{Float64}: real part of the signal trimmed to original length
NeuroAnalyzer.fft2Method
fft2(x)

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

Arguments

  • x::AbstractVector

Returns

  • fft2::Vector{ComplexF64}
NeuroAnalyzer.nextpow2Method
nextpow2(x)

Return the next power of 2 for given number x.

Argument

  • x::Int64

Returns

  • nextpow2::Int64
NeuroAnalyzer.dftMethod
dft(signal; fs, pad)

Return FFT and DFT sample frequencies for a DFT.

Arguments

  • signal::AbstractVector
  • fs::Int64: sampling rate
  • pad::Int64=0: number of zeros to add

Returns

Named tuple containing:

  • ft::Vector{ComplexF64}: FFT
  • f::Vector{Float64}: sample frequencies
NeuroAnalyzer.dftMethod
dft(obj; channel)

Return FFT and DFT sample frequencies for a DFT.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • pad::Int64=0: number of zeros to add signal for FFT

Returns

Named tuple containing:

  • ft::Array{ComplexF64, 3}: FFT
  • f::Vector{Float64}: sample frequencies
NeuroAnalyzer.findpeaksMethod
findpeaks(signal; d)

Find peaks.

Arguments

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

Returns

  • p_idx::Vector{Int64}
NeuroAnalyzer.hz2radsMethod
hz2rads(f)

Convert frequency f in Hz to rad/s.

Arguments

  • f::Real

Returns

  • f_rads::Float64
NeuroAnalyzer.rads2hzMethod
rads2hz(f)

Convert frequency f in rad/s to Hz.

Arguments

  • f::Real

Returns

  • f_rads::Float64
NeuroAnalyzer.t2fMethod
t2f(t)

Convert cycle length in ms to frequency.

Arguments

  • t::Real: cycle length in ms

Returns

  • f::Float64: frequency in Hz
NeuroAnalyzer.f2tMethod
f2t(f)

Convert frequency to cycle length in ms.

Arguments

  • f::Real: frequency in Hz

Returns

  • f::Float64: cycle length in ms
NeuroAnalyzer.freqsMethod
freqs(t)

Return vector of frequencies and Nyquist frequency for time vector.

Arguments

  • t::AbstractVector, AbstractRange}: time vector

Returns

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

Return vector of frequencies and Nyquist frequency for signal.

Arguments

  • s::Vector{Float64}
  • fs::Int64

Returns

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

Return vector of frequencies and Nyquist frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • hz::Vector{Float64}
  • nf::Float64
NeuroAnalyzer.generate_windowMethod
generate_window(type, n; even)

Return the n-point long symmetric window type.

Arguments

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

Returns

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

Generates sine wave.

Arguments

  • f::Real: frequency [Hz]
  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude
  • p::Real: initial phase

Returns

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

Generates complex sine wave.

Arguments

  • f::Real: frequency [Hz]
  • t::Union{AbstractVector, AbstractRange}: time vector
  • a::Real: amplitude

Returns

  • cs::Vector{ComplexF64}`
NeuroAnalyzer.generate_sincFunction
generate_sinc(t, f, peak, norm)

Generate sinc function.

Arguments

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

Returns

  • s::Vector{Float64}
NeuroAnalyzer.generate_morletFunction
generate_morlet(fs, f, t; ncyc, complex)

Generate Morlet wavelet.

Arguments

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

Returns

  • morlet::Union{Vector{Float64}, Vector{ComplexF64}}
NeuroAnalyzer.generate_gaussianFunction
generate_gaussian(fs, f, t; ncyc, a)

Generate Gaussian wave.

Arguments

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

Returns

  • g::Vector{Float64}
NeuroAnalyzer.generate_noiseFunction
generate_noise(n, amp; type)

Generate noise.

Arguments

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

Returns

  • s::Float64
NeuroAnalyzer.generate_morlet_fwhmFunction
generate_morlet_fwhm(fs, f, t; h)

Generate Morlet wavelet using Mike X Cohen formula.

Arguments

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

Returns

  • mw::Vector{ComplexF64}

Source

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

NeuroAnalyzer.generate_squareFunction
generate_square(t, a, p, w, offset)

Generates square wave.

Arguments

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

Returns

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

Generates triangle wave.

Arguments

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

Returns

  • s::Vector{Float64}`
NeuroAnalyzer.srMethod
sr(obj)

Return sampling rate.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • sr::Int64
NeuroAnalyzer.channel_nMethod
channel_n(obj; type)

Return number of channels of type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Vector{Symbol}=:all: channel type (stored in the global channel_types constant variable)

Returns

  • ch_n::Int64
NeuroAnalyzer.epoch_nMethod
epoch_n(obj)

Return number of epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • ep_n::Int64
NeuroAnalyzer.signal_lenMethod
signal_len(obj)

Return signal length.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • s_len::Int64
NeuroAnalyzer.epoch_lenMethod
epoch_len(obj)

Return epoch length.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • ep_len::Int64
NeuroAnalyzer.historyMethod
history(obj)

Show processing history.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • history::Vector{String}
NeuroAnalyzer.labelsMethod
labels(obj)

Return channel labels.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • labels::Vector{String}
NeuroAnalyzer.channel_clusterMethod
channels_cluster(obj, cluster)

Return channels belonging to a cluster of channels.

Arguments

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

Returns

  • ch::Vector{Int64}: list of channel numbers belonging to a given cluster of channels
NeuroAnalyzer.band_frqMethod
band_frq(obj, band)

Return frequency limits for a band.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • band::Symbol: band range name:
    • :list
    • :total
    • :delta
    • :theta
    • :alpha
    • :beta
    • :beta_high
    • :gamma
    • :gamma_1
    • :gamma_2
    • :gamma_lower
    • :gamma_higher.

Returns

  • band_frequency::Tuple{Real, Real}
NeuroAnalyzer.band_frqMethod
band_frq(fs, band)

Return frequency limits of a band.

Arguments

  • fs::Int64: sampling rate
  • band::Symbol: band range name:
    • :list
    • :total
    • :delta
    • :theta
    • :alpha
    • :beta
    • :beta_high
    • :gamma
    • :gamma_1
    • :gamma_2
    • :gamma_lower
    • :gamma_higher.

Returns

  • band_frq::Tuple{Real, Real}
NeuroAnalyzer.describeMethod
describe(obj)

Return basic descriptive statistics of obj.data.

Arguments

  • obj::NeuroAnalyzer.NEURO
Base.sizeMethod
size(obj)

Return size of the obj data.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • size::Tuple{Int64, Int64, Int64}
NeuroAnalyzer.m_pad0Method
m_pad0(m)

Pad matrix with zeros to make it square.

Arguments

  • m::Matrix{<:Number}

Returns

  • m::Matrix{<:Number}
NeuroAnalyzer.m_sortpermMethod
m_sortperm(m; rev=false, dims=1)

Generates sorting index for matrix m by columns (dims = 1) or by rows (dims = 2).

Arguments

  • m::AbstractMatrix
  • rev::Bool
  • dims::Int64

Returns

  • idx::Matrix{Int64}
NeuroAnalyzer.m_sortMethod
m_sort(m, m_idx; rev=false, dims=1)

Sorts matrix m using sorting index m_idx

Arguments

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

Returns

  • m_sorted::Matrix
NeuroAnalyzer.m_normMethod
m_norm(m)

Normalize matrix.

Arguments

  • m::AbstractArray

Returns

  • m_norm::AbstractArray
NeuroAnalyzer.linspaceMethod
linspace(start, stop, length)

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

Arguments

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

Returns

  • range::Vector
NeuroAnalyzer.logspaceMethod
logspace(start, stop, n)

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

Arguments

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

Returns

  • range::Vector{<:Number}
NeuroAnalyzer.cmaxMethod
cmax(x)

Return maximum value of the complex vector.

Arguments

  • x::Vector{ComplexF64}

Returns

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

Return minimum value of the complex vector.

Arguments

  • x::Vector{ComplexF64}

Returns

  • cmin::ComplexF64
NeuroAnalyzer.tuple_orderFunction
tuple_order(t, rev)

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

Arguments

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

Returns

  • t::Tuple{Real, Real}
NeuroAnalyzer.cumsMethod
cums(signal)

Calculate cumulative sum.

Arguments

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

Returns

  • signal_cs::Array{Float64, 3}
NeuroAnalyzer.f_nearestMethod
f_nearest(m, pos)

Find nearest position tuple pos in vector of positions m.

Arguments

  • m::Matrix{Tuple{Float64, Float64}}
  • p::Tuple{Float64, Float64}

Returns

  • pos::Tuple{Int64, Int64}: row and column in m
NeuroAnalyzer.add_noteMethod
add_note(obj; note)

Add recording note.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_note!Method
add_note!(obj; note)

Add recording note.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • note::String
NeuroAnalyzer.delete_noteMethod
delete_note(obj)

Delete recording note.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.pad0Method
pad0(x, n)

Pad vector / rows of matrix / array with zeros. Works with 1-, 2- and 3-dimensional arrays.

Arguments

  • x::Union{AbstractVector, AbstractArray
  • n::Int64: number of zeros to add

Returns

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

Pad vector / rows of matrix / array with zeros to the nearest power of 2 length.

Arguments

  • x::Union{AbstractVector, AbstractArray

Returns

  • pad2::Union{AbstractVector, AbstractArray
NeuroAnalyzer.phasesFunction
phases(s; pad)

Calculate phases.

Arguments

  • s::AbstractVector
  • pad::Int64=0: number of zeros to add

Returns

  • phases::Vector{Float64}
NeuroAnalyzer.pickMethod
pick(obj; p)

Return set of channel indices corresponding with p of electrodes

Arguments

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

Returns

  • channels::Vector{Int64}: channel numbers
NeuroAnalyzer.t2sMethod
t2s(t, fs)

Convert time to sample number.

Arguments

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

Returns

  • t2s::Int64: sample number
NeuroAnalyzer.s2tMethod
s2t(s, fs)

Convert sample number to time.

Arguments

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

Returns

  • s2t::Float64: time in s
NeuroAnalyzer.t2sMethod
t2s(obj; t)

Convert time in seconds to samples.

Arguments

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

Returns

  • t2s::Int64: time in samples
NeuroAnalyzer.s2tMethod
s2t(obj; s)

Convert time in samples to seconds.

Arguments

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

Returns

  • s2t::Float64: time in seconds
NeuroAnalyzer.to_dfMethod
to_df(obj)

Export OBJ data to DataFrame.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • df::DataFrame: DataFrame containing time points and channels
NeuroAnalyzer.vsearchMethod
vsearch(y, x; acc)

Return the positions of the y value in the vector x.

Arguments

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

Returns

  • idx::Int64
  • d::Real: the difference between y and x[idx]
NeuroAnalyzer.vsearchMethod
vsearch(y, x; acc)

Return the positions of the y vector in the vector x.

Arguments

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

Returns

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

Splits the vector x into n-long pieces.

Argument

  • x::AbstractVector
  • n::Int64

Returns

  • x::Vector{AbstractVector}

IO

NeuroAnalyzer.export_csvMethod
export_csv(obj; file_name, header, components, markers, overwrite)

Export NeuroAnalyzer.NEURO object to CSV.

Arguments

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

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • overwrite::Bool=false
NeuroAnalyzer.export_locsMethod
export_locs(locs; file_name, overwrite)

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

Arguments

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

Returns

  • success::Bool
NeuroAnalyzer.export_markersMethod
export_markers(obj; file_name, overwrite)

Export NeuroAnalyzer.NEURO object markers to CSV.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • overwrite::Bool=false
NeuroAnalyzer.import_recordingMethod
import_recording(file_name; detect_type)

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

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

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

Arguments

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

Returns

  • ::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_alice4Method
import_alice4(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

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

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

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

Source

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

NeuroAnalyzer.import_bvMethod
import_bv(file_name; detect_type)

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_csvMethod
import_csv(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

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

NeuroAnalyzer.import_digitrackMethod
import_digitrack(file_name; detect_type)

Load Digitrack ASCII file and return NeuroAnalyzer.NEURO object.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.import_edfMethod
import_edf(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

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

Source

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

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_fiffMethod
import_fiff(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Source

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

NeuroAnalyzer.import_gdfMethod
import_gdf(file_name; detect_type)

Load GDF file and return NeuroAnalyzer.NEURO object.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

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

Source

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

Load channel locations. Supported formats:

  • CED
  • ELC
  • LOCS
  • TSV
  • SFP
  • CSD
  • GEO
  • MAT

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
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_cedMethod
import_locs_ced(file_name; maximize)

Load channel locations from CED file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_locsMethod
import_locs_locs(file_name; maximize)

Load channel locations from LOCS file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_elcMethod
import_locs_elc(file_name; maximize)

Load channel locations from ELC file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_tsvMethod
import_locs_tsv(file_name; maximize)

Load channel locations from TSV file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_sfpMethod
import_locs_sfp(file_name; maximize)

Load channel locations from SFP file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_csdMethod
import_locs_csd(file_name; maximize)

Load channel locations from CSD file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_geoMethod
import_locs_geo(file_name; maximize)

Load channel locations from GEO file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • locs::DataFrame
NeuroAnalyzer.import_locs_matMethod
import_locs_mat(file_name; maximize)

Load channel locations from MAT file.

Arguments

  • file_name::String
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

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

Load montage from a text file. The structure of the file is:

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

Each channel/channel pair must be in a separate line

Arguments

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

Returns

Named tuple containing:

  • ref_list::Vector{String}: list of channel pairs
  • ref_name::Vector{String}: name of the montage
NeuroAnalyzer.import_nirsMethod
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_nirxMethod
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_nwbMethod
import_nwb(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Source

  1. https://www.biorxiv.org/content/10.1101/523035v1
NeuroAnalyzer.import_setMethod
import_set(file_name; detect_type)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Source

  1. https://eeglab.org/tutorials/ConceptsGuide/Data_Structures.html
NeuroAnalyzer.import_snirfMethod
import_snirf(file_name; n)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Source

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

NeuroAnalyzer.load_locsMethod
load_locs(obj; file_name)

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

Channel locations:

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String: name of the file to load
  • maximize::Bool=true: maximize locations to a unit circle after importing

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.load_locs!Method
load_locs!(obj; file_name, maximize)

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

Channel locations:

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • file_name::String
  • maximize::Bool=true: maximize locations after importing
NeuroAnalyzer.saveMethod
save(obj; file_name, overwrite)

Save obj to file_name file (HDF5-based).

Arguments

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

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO

Edit

NeuroAnalyzer.signal_channelsMethod
signal_channels(obj)

Return all signal (e.g. EEG or MEG) channels; signal is determined by :data_type variable in obj.header.recording). For MEG data type, 'meg', grad and mag channels are returned.

Arguments

  • obj::NeuroAnalyzer.NEURO:

Returns

  • chs::Vector{Int64}
NeuroAnalyzer.get_channel_bytypeMethod
get_channel_bytype(obj; type)

Return channel number(s) for channel of type type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Union{Symbol, Vector{Symbol}}=:all: channel type

Returns

  • ch_idx::Vector{Int64}
NeuroAnalyzer.get_channel_bywlMethod
get_channel_bywl(obj; wl)

Return NIRS channel number(s) for wavelength wl.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • wl::Real: wavelength (in nm)

Returns

  • ch_idx::Vector{Int64}
NeuroAnalyzer.channel_typeMethod
channel_type(obj; ch, type)

Change channel type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}
  • type::String

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.channel_type!Method
channel_type!(obj; ch, new_name)

Change channel type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}
  • type::String
NeuroAnalyzer.get_channelMethod
get_channel(obj; ch)

Return channel number (if provided by name) or name (if provided by number).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name

Returns

  • ch_idx::Union{Int64, String}: channel number or name
NeuroAnalyzer.rename_channelMethod
rename_channel(obj; ch, name)

Rename channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name
  • name::String: new name

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.rename_channel!Method
rename_channel!(obj; ch, name)

Rename channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name
  • name::String: new name
NeuroAnalyzer.edit_channelMethod
edit_channel(obj; ch, field, value)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64
  • field::Symbol
  • value::Any

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_channel!Method
edit_channel!(obj; ch, field, value)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64
  • field::Symbol
  • value::Any
NeuroAnalyzer.replace_channelMethod
replace_channel(obj; ch, s)

Replace channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name
  • s::Array{Float64, 3}

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.replace_channel!Method
replace_channel!(obj; ch, s)

Replace channel.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name
  • s::Array{Float64, 3}: signal to replace with
NeuroAnalyzer.add_labelsMethod
add_labels(obj; labels)

Add channel labels.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_labels!Method
add_labels!(obj::NeuroAnalyzer.NEURO; clabels::Vector{String})

Add OBJ channel labels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • clabels::Vector{String}
NeuroAnalyzer.add_channelMethod
add_channel(obj; data, label, type)

Add channel(s) data to empty NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{<:Number, 3}: channel(s) data
  • label::Union{String, Vector{String}}=string.(_c(size(data, 1))): channel(s) label(s)
  • type::Union{Symbol, Vector{Symbol}}: channel(s) type(s)

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_channel!Method
add_channel!(obj; data, label, type)

Add channel(s) data to empty NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • data::Array{<:Number, 3}: channel(s) data
  • label::Union{String, Vector{String}}=string.(_c(size(data, 1))): channel(s) label(s)
  • type::Union{Symbol, Vector{Symbol}}: channel(s) type(s)
NeuroAnalyzer.createMethod
create(; data_type)

Create an empty NeuroAnalyzer.NEURO object.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.create_timeMethod
create_time(obj)

Create time points vector for NeuroAnalyzer.NEURO object.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.create_time!Method
create_time!(obj)

Create time points vector for NeuroAnalyzer.NEURO object.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • `fs::Int64
NeuroAnalyzer.delete_channelMethod
delete_channel(obj; ch)

Delete channel(s).

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_channel!Method
delete_channel!(obj; ch)

Delete channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number(s) to be removed
NeuroAnalyzer.keep_channelMethod
keep_channel(obj; ch)

Keep channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number(s) to keep

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_channel!Method
keep_channel!(obj; ch)

Keep channel(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number(s) to keep
NeuroAnalyzer.keep_channel_typeMethod
keep_channel_type(obj; type)

Keep channel(s) of type type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:eeg: type of channels to keep

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_channel_type!Method
keep_channel_type!(obj; type)

Keep OBJ channels of type type.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:eeg: type of channels to keep
NeuroAnalyzer.delete_epochMethod
delete_epoch(obj; ep)

Remove epoch(s).

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_epoch!Method
delete_epoch!(obj; ep)

Remove epoch(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) to be removed
NeuroAnalyzer.keep_epochMethod
keep_epoch(obj; ep)

Keep epoch(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) to keep

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.keep_epoch!Method
keep_epoch!(obj; ep)

Keep OBJ epoch(s).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) to keep
NeuroAnalyzer.detect_badMethod
detect_bad(obj; method, ch_t)

Detect bad channels and epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • method::Vector{Symbol}=[:flat, :rmse, :rmsd, :euclid, :p2p, :var]: detection method:
    • :flat: flat channel(s)
    • :p2p: peak-to-peak amplitude; good for detecting transient artifacts
    • :var: mean signal variance outside of 95%CI and variance inter-quartile outliers
    • :rmse: RMSE vs average channel outside of 95%CI
    • :rmsd: RMSD
    • :euclid: Euclidean distance
  • w::Int64=10: window width in samples (signal is averaged within w-width window)
  • ftol::Float64=0.1: tolerance (signal is flat within -tol to +tol), eps() gives very low tolerance
  • fr::Float64=0.3: acceptable ratio (0.0 to 1.0) of flat segments within a channel before marking it as flat
  • p::Float64=0.95: probability threshold (0.0 to 1.0) for marking channel as bad; also threshold for :p2p detection: above mean + p * std and below mean - p * std, here p (as percentile) will be converted to z-score (0.9 (90th percentile): 1.282, 0.95 (95th percentile): 1.645, 0.975 (97.5th percentile): 1.960, 0.99 (99th percentile): 2.326)
  • tc::Float64=0.3: threshold (0.0 to 1.0) of bad channels ratio to mark the epoch as bad

Returns

Named tuple containing:

  • bm::Matrix{Bool}: matrix of bad channels × epochs
  • be::Vector{Int64}: list of bad epochs
NeuroAnalyzer.epochMethod
epoch(obj; marker, offset, ep_n, ep_len)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.epoch!Method
epoch!(obj; marker, offset, ep_n, ep_len)

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

Arguments

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

Edit epochs time start.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.epoch_ts!Method
epoch_ts!(obj; ts)

Edit OBJ epochs time start.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.extract_channelMethod
extract_channel(obj; ch)

Extract channel data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name

Returns

  • extract_channel::Vector{Float64}
NeuroAnalyzer.extract_epochMethod
extract_epoch(obj; ep)

Extract epoch.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.extract_dataMethod
extract_data(obj; ch)

Extract data.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}=1:epoch_n(obj): index of epochs, default is all epochs
  • time::Bool=false: return time vector
  • etime::Bool=false: return epoch time vector

Returns

  • signal::Array{Float64, 3}
  • time::Vector{Float64}
  • etime::Vector{Float64}
NeuroAnalyzer.extract_timeMethod
extract_time(obj)

Extract time.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • tpts::Array{Float64, 3}
NeuroAnalyzer.joinMethod
join(obj1, obj2)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.join!Method
join!(obj1, obj2)

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

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
NeuroAnalyzer.delete_markerMethod
delete_marker(obj; n)

Delete marker.

Arguments

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

Returns

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

Add marker.

Arguments

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

Returns

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

Add marker.

Arguments

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

Edit marker.

Arguments

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

Returns

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

Edit marker.

Arguments

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

Convert event channel to markers.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.channel2marker!Method
channel2marker!(obj; ch, v, id, desc)

Convert event channel to markers.

Arguments

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

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reflect!Method
reflect!(obj; n)

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

Arguments

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

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.chop!Method
chop!(obj; v)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • n::Int64=sr(obj): number of samples to remove, default is 1 second
NeuroAnalyzer.trimMethod
trim(s; seg, inverse)

Remove segment from the signal.

Arguments

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

Returns

  • trim::Vector{Float64}
NeuroAnalyzer.trimMethod
trim(m; seg, inverse)

Remove segment from the signal.

Arguments

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

Returns

  • trim::Array{Float64}
NeuroAnalyzer.trimMethod
trim(a; seg, inverse)

Remove segment from the signal.

Arguments

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

Returns

  • trim::Array{Float64}
NeuroAnalyzer.trimMethod
trim(obj; seg, inverse, remove_epochs)

Trim signal by removing parts of the signal.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.trim!Method
trim!(obj; seg, inverse, remove_epochs)

Trim signal by removing parts of the signal.

Arguments

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

Calculate virtual channel using formula f.

Arguments

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

Returns

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

Process

NeuroAnalyzer.add_signalMethod
add_signal(s1, s2)

Add signal.

Arguments

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

Returns

  • s_noisy::AbstractVector
NeuroAnalyzer.add_signalMethod
add_signal(obj; ch, s)

Add signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • s::AbstractVector: signal to be added to each channel

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_signal!Method
add_signal!(obj; ch, n)

Add signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • s::AbstractVector: signal to be added to each channel
NeuroAnalyzer.averageMethod
average(s)

Average all channels.

Arguments

  • s::AbstractArray

Returns

  • average::AbstractArray
NeuroAnalyzer.averageMethod
average(s1, s2)

Averages two signals.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • average::Vector{Float64}
NeuroAnalyzer.averageMethod
average(obj; ch)

Return the average signal of channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.average!Method
average!(obj; ch)

Return the average signal of channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
NeuroAnalyzer.averageMethod
average(obj1, obj2)

Return the average signal of all obj1 and obj2 channels.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.bpsplitMethod
bpsplit(obj; ch, order, window)

Split signal into frequency bands using IIR band-pass filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • order::Int64=8: number of taps for FIR band-pass filter
  • window::Union{Nothing, AbstractVector, Int64}=nothing: window for :fir filter; default is Hamming window, number of taps is calculated using Fred Harris' rule-of-thumb

Returns

Named tuple containing:

  • s::Array{Float64, 4}: split signal
  • bn::Vector{Symbol}: band names
  • bf::Vector{Tuple{Real, Real}}: band frequencies
NeuroAnalyzer.cbpMethod
cbp(s; pad, frq, fs)

Perform convolution band-pass filtering.

Arguments

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

Returns

  • cbp::Vector{Float64}
NeuroAnalyzer.cbpMethod
cbp(obj; ch, pad, frq)

Perform convolution bandpass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.cbp!Method
cbp!(obj; ch, pad, frq)

Perform convolution bandpass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64: pad the signal with pad zeros
  • frq::Tuple{Real, Real}: filter frequency
NeuroAnalyzer.ch_zeroMethod
ch_zero(obj)

Zero channels at the beginning and at the end.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

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

Zero channels at the beginning and at the end.

Arguments

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.csdMethod
csd(obj; m, n, lambda)

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

Arguments

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

Returns

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

Source

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

NeuroAnalyzer.csd!Method
csd!(obj; m, n, lambda)

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

Arguments

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

Returns

  • 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.ghMethod
gh(locs; m, n)

Generate G and H matrices.

Arguments

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

Returns

Named tuple containing:

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

Source

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

NeuroAnalyzer.cw_transMethod
cw_trans(s; wt, type, l)

Perform continuous wavelet transformation (CWT).

Arguments

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

Returns

  • ct::Array{Float64, 2}: CWT coefficients (by rows)
NeuroAnalyzer.icw_transMethod
icw_trans(ct; wt, type)

Perform inverse continuous wavelet transformation (iCWT).

Arguments

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

Returns

  • s::Vector{Float64}: reconstructed signal
NeuroAnalyzer.cw_transMethod
cw_trans(s; wt)

Perform continuous wavelet transformation (CWT).

Arguments

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

Returns

  • ct::Array{Float64, 4}: CWT coefficients (by rows)
NeuroAnalyzer.cw_transMethod
cw_trans(obj; ch, wt)

Perform continuous wavelet transformation (CWT).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

  • ct::Array{Float64, 4}: CWT coefficients (by rows)
NeuroAnalyzer.denoise_fftMethod

denoise_fft(s; pad, t)

Perform FFT denoising.

Arguments

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

Returns

Named tuple containing:

  • s::Vector{Float64}
  • f_idx::BitVector: index of components zeroed
NeuroAnalyzer.denoise_fftMethod
denoise_fft(s; pad, t)

Perform FFT denoising.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_fftMethod
denoise_fft(obj; ch, pad, t)

Perform FFT denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64=0: number of zeros to add signal for FFT
  • t::Int64=100: PSD threshold for keeping frequency components

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_fft!Method
denoise_fft!(obj; ch, pad, t)

Perform FFT denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64=0: number of zeros to add signal for FFT
  • t::Int64=100: PSD threshold for keeping frequency components
NeuroAnalyzer.denoise_waveletMethod
denoise_wavelet(s; wt)

Perform wavelet denoising.

Arguments

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

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.denoise_waveletMethod
denoise_wavelet(s; wt)

Perform wavelet denoising.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_waveletMethod
denoise_wavelet(obj; ch, wt)

Perform wavelet denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_wavelet!Method
denoise_wavelet!(obj; ch, wt)

Perform wavelet denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • wt<:DiscreteWavelet: discrete wavelet, e.g. wt = wavelet(WT.haar), see Wavelets.jl documentation for the list of available wavelets
NeuroAnalyzer.denoise_wienMethod
denoise_wien(s)

Perform Wiener deconvolution denoising.

Arguments

  • s::AbstractArray

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.denoise_wienMethod
denoise_wien(obj; ch)

Perform Wiener deconvolution denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.denoise_wien!Method
denoise_wien!(obj; ch)

Perform Wiener deconvolution denoising.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
NeuroAnalyzer.derivativeMethod
derivative(s)

Return derivative of the same length.

Arguments

  • s::AbstractVector

Returns

  • s_new::AbstractVector
NeuroAnalyzer.derivativeMethod
derivative(s)

Return derivative of the same length.

Arguments

  • s::AbstractArray

Returns

  • s_new::Array{Float64, 3}
NeuroAnalyzer.derivativeMethod
derivative(obj; ch)

Return derivative of the same length.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.derivative!Method
derivative!(obj; ch)

Return derivative of the same length.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
NeuroAnalyzer.detrendMethod
detrend(s; type, offset, order, span, fs)

Perform piecewise detrending.

Arguments

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

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.detrendMethod
detrend(s; type, offset, order, f)

Perform piecewise detrending.

Arguments

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

Returns

  • s_new::Array{Float64, 3}
NeuroAnalyzer.detrendMethod
detrend(obj; ch, type, offset, order, f)

Perform piecewise detrending.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • type::Symbol=:linear: detrending method
    • :loess: fit and subtract loess approximation
    • :poly: polynomial of order is subtracted
    • :constant: offset or the mean of s (if offset = 0) is subtracted
    • :linear: linear trend is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.detrend!Method
detrend!(obj; ch, type, offset, order, span)

Perform piecewise detrending.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • type::Symbol=:linear: detrending method
    • :loess: fit and subtract loess approximation
    • :poly: polynomial of order is subtracted
    • :constant: offset or the mean of s (if offset = 0) is subtracted
    • :linear: linear trend is subtracted from s
    • :ls: the result of a linear least-squares fit to s is subtracted from s
  • offset::Real=0: constant for :constant detrending
  • order::Int64=1: polynomial fitting order
  • f::Float64=1.0: smoothing factor for :loess or frequency for :hp
NeuroAnalyzer.dw_transMethod
dw_trans(s; wt, type, l)

Perform discrete wavelet transformation (DWT).

Arguments

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

Returns

  • dt::Array{Float64, 2}: DWT coefficients cAl, cD1, ..., cDl (by rows)
NeuroAnalyzer.dw_transMethod
dw_trans(s; wt, type, l)

Perform discrete wavelet transformation (DWT).

Arguments

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

Returns

  • dt::Array{Float64, 4}: DWT coefficients cAl, cD1, ..., cDl (by rows)
NeuroAnalyzer.dw_transMethod
dw_trans(obj; ch, wt, type, l)

Perform discrete wavelet transformation (DWT).

Arguments

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

Returns

  • dt::Array{Float64, 4}: DWT coefficients cAl, cD1, ..., cDl (by rows)
NeuroAnalyzer.idw_transMethod
idw_trans(dwt_coefs; wt, type)

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

Arguments

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

Returns

  • s_new::Vector{Float64}: reconstructed signal
NeuroAnalyzer.dwtsplitMethod
dwtsplit(obj; ch, wt, type, n)

Split into bands using discrete wavelet transformation (DWT).

Arguments

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

Returns

  • b::Array{Float64, 4}: bands from lowest to highest frequency (by rows)
NeuroAnalyzer.erpMethod
erp(obj; bl)

Average epochs. Non-signal channels are removed. OBJ.header.recording[:data_type] becomes erp. First epoch is the ERP.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • bl::Real=0: baseline is the first bl seconds; if bl is greater than 0, DC value is calculated as mean of the first bl seconds and subtracted from the signal

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.erp!Method
erp!(obj; bl)

Average epochs. Non-signal channels are removed. OBJ.header.recording[:data_type] becomes erp. First epoch is the ERP.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • bl::Real=0: baseline is the first bl seconds; if bl is greater than 0, DC value is calculated as mean of the first n samples and subtracted from the signal
NeuroAnalyzer.fconvMethod
fconv(s; kernel, norm)

Perform convolution in the frequency domain.

Arguments

  • s::AbstractVector
  • kernel::AbstractVector
  • pad::Int64=0: number of zeros to add
  • norm::Bool=true: normalize kernel

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.fconvMethod
fconv(s; kernel, norm)

Perform convolution in the frequency domain.

Arguments

  • s::AbstractArray
  • kernel::Union{Vector{<:Real}, Vector{ComplexF64}}: kernel for convolution
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data
  • pad::Int64=0: number of zeros to add signal for FFT

Returns

  • s_new::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.fconvMethod
fconv(obj; ch, kernel, norm)

Perform convolution in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • kernel::Union{Vector{<:Real}, Vector{ComplexF64}}: kernel for convolution
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data
  • pad::Int64=0: number of zeros to add signal for FFT

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal
NeuroAnalyzer.fconv!Method
fconv!(obj; ch)

Perform convolution in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • kernel::Union{Vector{<:Real}, Vector{ComplexF64}}: kernel for convolution
  • norm::Bool=true: normalize kernel to keep the post-convolution results in the same scale as the original data
  • pad::Int64=0: number of zeros to add signal for FFT
NeuroAnalyzer.filter_createMethod
filter_create(signal; <keyword arguments>)

Create IIR or FIR filter.

Arguments

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

Returns

  • flt::Union{Vector{Float64}, ZeroPoleGain{:z, ComplexF64, ComplexF64, Float64}, Biquad{:z, Float64}}
NeuroAnalyzer.filter_applyMethod
filter_apply(s; <keyword arguments>)

Apply IIR or FIR filter.

Arguments

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

Returns

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filterMethod
filter(obj; <keyword arguments>)

Apply filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • fprototype::Symbol: filter prototype:
    • :butterworth
    • :chebyshev1
    • :chebyshev2
    • :elliptic
    • :fir
    • :iirnotch: second-order IIR notch filter
    • :remez: Remez FIR filter
  • ftype::Union{Nothing, Symbol}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}=0: filter cutoff in Hz (tuple for :bp and :bs)
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • dir:Symbol=:twopass: filter direction (for causal filter use :onepass):
    • :twopass
    • :onepass
    • :reverse: one pass, reverse direction
  • order::Int64=8: filter order (6 dB/octave) for IIR filters, number of taps for :remez filter, attenuation (× 4 dB) for :fir filter
  • window::Union{Nothing, AbstractVector, Int64}=nothing: window length for :remez and :fir filters
  • preview::Bool=false: plot filter response

Returns

  • obj::NeuroAnalyzer.NEURO

Notes

For :poly filter order and window have to be set experimentally, recommended initial values are: order=4 and window=32.

NeuroAnalyzer.filter!Method
filter!(obj; <keyword arguments>)

Apply filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • fprototype::Symbol: filter prototype:
    • :butterworth
    • :chebyshev1
    • :chebyshev2
    • :elliptic
    • :fir
    • :iirnotch: second-order IIR notch filter
    • :remez: Remez FIR filter
  • ftype::Union{Nothing, Symbol}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}=0: filter cutoff in Hz (tuple for :bp and :bs)
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • dir:Symbol=:twopass: filter direction (for causal filter use :onepass):
    • :twopass
    • :onepass
    • :reverse: one pass, reverse direction
  • order::Int64=8: filter order (6 dB/octave) for IIR filters, number of taps for :remez filter, attenuation (× 4 dB) for :fir filter
  • window::Union{Nothing, AbstractVector, Int64}=nothing: window length for :remez and :fir filters
  • preview::Bool=false: plot filter response

Notes

For :poly filter order and window have to be set experimentally, recommended initial values are: order=4 and window=32.

NeuroAnalyzer.filter_gMethod
filter_g(s, fs, pad, f, gw)

Filter using Gaussian in the frequency domain.

Arguments

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

Returns

Named tuple containing:

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filter_gMethod
filter_g(s; pad, f, gw)

Filter using Gaussian in the frequency domain.

Arguments

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

Returns

  • s_filtered::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_gMethod
filter_g(obj; ch, pad, f, gw)

Filter using Gaussian in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.filter_g!Method
filter_g!(obj; ch, pad, f, gw)

Filter using Gaussian in the frequency domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64=0: number of zeros to add
  • f::Real: filter frequency
  • gw::Real=5: Gaussian width in Hz
NeuroAnalyzer.filter_mavgMethod
filter_mavg(s; <keyword arguments>)

Filter using moving average (FIR) filter (with threshold).

Arguments

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

Returns

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filter_mavgMethod
filter_mavg(s; k, t, window)

Filter using moving average filter (with threshold).

Arguments

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

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.filter_mavgMethod
filter_mavg(obj; ch, k, t, window)

Filter using moving average filter (with threshold).

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal

Source

  1. https://dsp.stackexchange.com/questions/9966/what-is-the-cut-off-frequency-of-a-moving-average-filter
NeuroAnalyzer.filter_mavg!Method
filter_mavg!(obj; ch, k, t, window)

Filter using moving average filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • k::Int64=8: window length is 2 × k + 1; for cut-off frequency f, k is sqrt(0.196202 + f^2) / f
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s))
  • window::Union{Nothing, AbstractVector}=nothing: weighting window
NeuroAnalyzer.filter_mmedMethod
filter_mmed(s; <keyword arguments>)

Filter using moving median filter (with threshold).

Arguments

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

Returns

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filter_mmedMethod
filter_mmed(s; k, t, window)

Filter using moving median filter (with threshold).

Arguments

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

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.filter_mmedMethod
filter_mmed(obj; ch, k, t, window)

Filter using moving median filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal
NeuroAnalyzer.filter_mmed!Method
filter_mmed!(obj; ch, k, t, window)

Filter using moving median filter (with threshold).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • k::Int64=8: window length is 2 × k + 1
  • t::Real=0: threshold (t = mean(s) - t * std(s):mean(s) + t * std(s)); only samples above the threshold are being filtered
  • window::Union{Nothing, AbstractVector}=nothing: weighting window
NeuroAnalyzer.filter_polyMethod
filter_poly(s; order, window)

Filter using polynomial filter.

Arguments

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

Returns

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filter_polyMethod
filter_poly(s; order, window)

Filter using polynomial filter.

Arguments

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

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.filter_polyMethod
filter_poly(obj; ch, order, window)

Filter using polynomial filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • order::Int64=8: polynomial order
  • window::Int64=10: window length

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal
NeuroAnalyzer.filter_poly!Method
filter_poly!(obj; ch, order, window)

Filter using polynomial filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • order::Int64=8: polynomial order
  • window::Int64=10: window length
NeuroAnalyzer.filter_sgMethod
filter_sg(s; order, window)

Filter using Savitzky-Golay filter.

Arguments

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

Returns

  • s_filtered::Vector{Float64}
NeuroAnalyzer.filter_sgMethod
filter_sg(s; order, window)

Filter using Savitzky-Golay filter.

Arguments

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

Returns

  • s_filtered::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.filter_sgMethod
filter_sg(obj; ch, order, window)

Filter using Savitzky-Golay filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number

Returns

  • obj_new::NeuroAnalyzer.NEURO: convoluted signal
NeuroAnalyzer.filter_sg!Method
filter_sg!(obj; ch, order, window)

Filter using Savitzky-Golay filter.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • order::Int64=6: order of the polynomial used to fit the samples; must be less than window
  • window::Int64=11: length of the filter window (i.e., the number of coefficients); must be an odd number
NeuroAnalyzer.ica_decomposeMethod
ica_decompose(s; <keyword arguments>)

Calculate n first Independent Components using FastICA algorithm.

Arguments

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

Returns

Named tuple containing:

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

Perform independent component analysis (ICA) using FastICA algorithm.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • n::Int64=length(ch): number of ICs, default is the number of channels
  • iter::Int64=100: maximum number of iterations
  • f::Symbol=:tanh: neg-entropy functor:
    • :tanh
    • :gaus

Returns

Named tuple containing:

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

Reconstruct signal using ICA components.

Arguments

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

Returns

  • s_new::Matrix{Float64}: reconstructed signal
NeuroAnalyzer.ica_reconstructMethod
ica_reconstruct(obj; ch, ic_idx, keep)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}: list of ICs to remove or keep or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_reconstruct!Method
ica_reconstruct!(obj; ch, ic_idx, keep)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
  • keep::Bool=false: if true, then the ICs are kept instead of removed
NeuroAnalyzer.ica_reconstructMethod
ica_reconstruct(obj, ic, ic_mw; ch, ic_idx, keep)

Reconstruct signals using external ICA components.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_reconstruct!Method
ica_reconstruct!(obj, ic, ic_mw; ch, ic_idx, keep)

Reconstruct signals using external ICA components.

Arguments

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

Remove external ICA components from the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_remove!Method
ica_remove!(obj, ic, ic_mw; ch, ic_idx)

Remove external ICA components from the signal.

Arguments

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

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.ica_remove!Method
ica_remove!(obj; ch, ic_idx)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all channels
  • `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove or keep
NeuroAnalyzer.intensity2odMethod
intensity2od(s)

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

Arguments

  • s::AbstractArray

Returns

  • od::AbstractArray
NeuroAnalyzer.intensity2odMethod
intensity2od(obj; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=get_channel_bytype(obj, type=:nirs_int)): index of channels, default is NIRS intensity channels

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.intensity2od!Method
intensity2od!(obj; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=get_channel_bytype(obj, type=:nirs_int)): index of channels, default is NIRS intensity channels
NeuroAnalyzer.invert_polarityMethod
invert_polarity(obj; ch)

Invert polarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.invert_polarity!Method
invert_polarity!(obj; ch)

Invert polarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to invert
NeuroAnalyzer.lrinterpolate_channelMethod
lrinterpolate_channel(obj; ch, ep)

Interpolate channel using linear regression.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.lrinterpolate_channel!Method
lrinterpolate_channel!(obj; ch, ep)

Interpolate channel using linear regression.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.normalizeFunction
normalize(s, n; method)

Normalize.

Arguments

  • s::AbstractArray
  • m::Real=0.0
  • n::Real=1.0
  • method::Symbol:
    • :zscore: by z-score
    • :minmax: in [-1, +1]
    • :log: using log-transformation
    • :log10: using log10-transformation
    • :neglog: using -log-transformation
    • :neglog10: using -log10-transformation
    • :neg: in [0, -∞]
    • :pos: in [0, +∞]
    • :perc: in percentages
    • :gauss: to Gaussian
    • :invroot: in inverse root (1/sqrt(x))
    • :n: in [0, n1], default is [0, 1]; to normalize to [n1, n2], use normalize_n(s) .* (n2 - n1) .+ n1
    • :none

Returns

  • normalized::Vector{Float64}
NeuroAnalyzer.normalize_nFunction
normalize_n(s, n)

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

Arguments

  • s::AbstractArray
  • n::Real=1.0

Returns

  • normalize_n::AbstractArray
NeuroAnalyzer.normalize_logMethod
normalize_log(s)

Normalize using log-transformation.

Arguments

  • s::AbstractArray

Returns

  • normalize_log::AbstractArray
NeuroAnalyzer.normalize_gaussFunction
normalize_gauss(s, dims)

Normalize to Gaussian.

Arguments

  • s::AbstractArray
  • dims::Int64=1: dimension for cumsum()

Returns

  • normalize_gauss::Vector{Float64}
NeuroAnalyzer.normalize_log10Method
normalize_log10(s)

Normalize using log10-transformation.

Arguments

  • s::AbstractArray

Returns

  • normalize_log10::Vector{Float64}
NeuroAnalyzer.normalize_neglogMethod
normalize_neglog(s)

Normalize to using -log-transformation.

Arguments

  • s::AbstractArray

Returns

  • normalize_neglog::Vector{Float64}
NeuroAnalyzer.normalize_neglog10Method
normalize_neglog10(s)

Normalize using -log10-transformation.

Arguments

  • s::AbstractArray

Returns

  • normalize_neglog::Vector{Float64}
NeuroAnalyzer.normalize_negMethod
normalize_neg(s)

Normalize in [0, -∞].

Arguments

  • s::AbstractArray

Returns

  • normalize_neg::Vector{Float64}
NeuroAnalyzer.normalize_posMethod
normalize_pos(s)

Normalize in [0, +∞].

Arguments

  • s::AbstractArray

Returns

  • normalize_pos::Vector{Float64}
NeuroAnalyzer.normalize_percMethod
normalize_perc(s)

Normalize in percentages.

Arguments

  • s::AbstractArray

Returns

  • normalize_perc::Vector{Float64}
NeuroAnalyzer.normalize_invrootMethod
normalize_invroot(s)

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

Arguments

  • s::AbstractArray

Returns

  • normalize_invroot::Vector{Float64}
NeuroAnalyzer.normalizeMethod
normalize(obj; ch, method)

Normalize channel(s)

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • method::Symbol: method for normalization, see normalize() for details

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.normalize!Method
normalize!(obj; ch, method)

Normalize channel(s)

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • method::Symbol: method for normalization, see normalize() for details
NeuroAnalyzer.nplMethod
npl(obj)

Calculate non-phase-locked signal.

Arguments

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

Returns

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

Calculate non-phase-locked signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: must be ERP object
NeuroAnalyzer.od2concMethod
od2conc(obj; ch, ppf)

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

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.od2conc!Method
od2conc(obj; ch, ppf)

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

Arguments

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

Calculate n first Primary Components (PCs).

Arguments

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

Returns

Named tuple containing:

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

Calculate n first Primary Components (PCs).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • n::Int64: number of PCs to calculate

Returns

Named tuple containing:

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

Reconstructs signal using PCA components.

Arguments

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

Returns

  • s_new::Array{Float64, 3}
NeuroAnalyzer.pca_reconstructMethod
pca_reconstruct(obj; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.pca_reconstruct!Method
pca_reconstruct!(obj; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
NeuroAnalyzer.pca_reconstructMethod
pca_reconstruct(obj, pc, pc_model; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • pc::Array{Float64, 3}:: PC(1)..PC(n) × epoch
  • pc_model::MultivariateStats.PCA{Float64}: PC model
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.pca_reconstruct!Method
pca_reconstruct!(obj, pc, pc_model; ch)

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

Arguments

  • obj::NeuroAnalyzer.NEURO
  • pc::Array{Float64, 3}:: PC(1)..PC(n) × epoch
  • pc_model::MultivariateStats.PCA{Float64}: PC model
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
NeuroAnalyzer.plinterpolate_channelMethod
plinterpolate_channel(obj; ch, ep, m, q)

Interpolate channel(s) using planar interpolation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number(s) to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • interpolation_factor::Int64=100: interpolation quality

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.plinterpolate_channel!Method
plinterpolate_channel!(obj; ch, ep, imethod, interpolation_factor)

Interpolate channel(s) using planar interpolation.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel number(s) to interpolate
  • ep::Union{Int64, Vector{Int64}, <:AbstractRange}: epoch number(s) within to interpolate
  • imethod::Symbol=:sh: interpolation method Shepard (:sh), Multiquadratic (:mq), InverseMultiquadratic (:imq), ThinPlate (:tp), NearestNeighbour (:nn), Gaussian (:ga)
  • interpolation_factor::Int64=100: interpolation quality
NeuroAnalyzer.reference_chMethod
reference_ch(obj; ch, med)

Reference to selected channel(s). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: index of channels used as reference; if multiple channels are specified, their average is used as the reference
  • med::Bool=false: use median instead of mean

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_ch!Method
reference_ch!(obj; ch, med)

Reference to selected channel(s). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: index of channels used as reference; if multiple channels are specified, their average is used as the reference
  • med::Bool=false: use median instead of mean
NeuroAnalyzer.reference_carMethod
reference_car(obj; exclude_fpo, exclude_current, med)

Reference to common average reference. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • exclude_fpo::Bool=false: exclude Fp1, Fp2, O1, O2 from CAR calculation
  • exclude_current::Bool=true: exclude current channel from CAR calculation
  • med::Bool=false: use median instead of mean

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_car!Method
reference_car!(obj; exclude_fpo, exclude_current, med)

Reference to common average reference. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • exclude_fpo::Bool=false: exclude Fp1, Fp2, O1, O2 from CAR mean calculation
  • exclude_current::Bool=true: exclude current channel from CAR mean calculation
  • med::Bool=false: use median instead of mean
NeuroAnalyzer.reference_aMethod
reference_a(obj; type, med)

Reference to auricular (A1, A2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of A1 and A2
    • :i: ipsilateral - A1 for left channels, A2 for right channels
    • :c: contraletral - A1 for right channels, A2 for left channels
  • med::Bool=false: use median instead of mean

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_a!Method
reference_a!(obj; type, med)

Reference to auricular (A1, A2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of A1 and A2
    • :i: ipsilateral - A1 for left channels, A2 for right channels
    • :c: contraletral - A1 for right channels, A2 for left channels
  • med::Bool=false: use median instead of mean
NeuroAnalyzer.reference_mMethod
reference_m(obj; type, med)

Reference to mastoid (M1, M2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of M1 and M2
    • :i: ipsilateral - M1 for left channels, M2 for right channels
    • :c: contraletral - M1 for right channels, M2 for left channels
  • med::Bool=false: use median instead of mean

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_m!Method
reference_m!(obj; type, med)

Reference to mastoid (M1, M2) channels. Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • type::Symbol=:l:
    • :l: linked - average of M1 and M2
    • :i: ipsilateral - M1 for left channels, M2 for right channels
    • :c: contraletral - M1 for right channels, M2 for left channels
  • med::Bool=false: use median instead of mean
NeuroAnalyzer.reference_plapMethod
reference_plap(obj; nn, weights)

Reference using planar Laplacian (using nn adjacent electrodes). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • nn::Int64=4: use nn adjacent electrodes
  • weights::Bool=false: use mean of nn nearest channels if false; if true, mean of nn nearest channels is weighted by distance to the referenced channel
  • med::Bool=false: use median instead of mean

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.reference_plap!Method
reference_plap!(obj; nn, weights)

Reference using planar Laplacian (using nn adjacent electrodes). Only signal channels are processed.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • nn::Int64=4: use nn adjacent electrodes
  • weights::Bool=false: use distance weights; use mean of nearest channels if false
  • med::Bool=false: use median instead of mean
NeuroAnalyzer.reference_customMethod
reference_custom(obj; ref_list, ref_name)

Reference using custom montage. Only signal channels are processed. Custom montage may be imported using import_montage().

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ref_list::Vector{String}=["Fz-Cz", "Cz-Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"]: list of channel pairs
  • ref_name::String="BIP ||": name of the montage

Returns

  • obj::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"], "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 ||"
NeuroAnalyzer.reference_custom!Method
reference_custom!(obj; ref_list, ref_name)

Reference using custom montage. Only signal channels are processed. Custom montage may be imported using import_montage().

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ref_list::Vector{String}=["Fz-Cz", "Cz-Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"]: list of channel pairs
  • ref_name::String="BIP ||": name of the montage

Notes

If the reference contains a single channel (e.g. "Fz"), than the channel is copied to the referenced data. For each reference pair (e.g. "Fz-Cz"), the referenced channel is equal to the amplitude of channel 2 ("Cz") - amplitude of channel 1 ("Fz").

Examples of montages:

  • bipolar transverse: ["Fp2-Fp1", "F8-Fp2", "F8-F4", "F4-Fz", "Fz-F3", "F3-F7", "Fp1-F7", "T4-C4", "C4-Cz", "Cz-C3", "C3-T3", "T6-P4", "P4-Pz", "Pz-P3", "P3-T5", "O2-O1"], "BIP ="
  • bipolar longitudinal: ["Fz", "Cz", "Pz", "Fp1-F7", "Fp1-F3", "F7-T3", "T3-T5", "T5-O1", "F3-C3", "C3-P3", "P3-O1", "Fp2-F8", "Fp2-F4", "F8-T4", "T4-T6", "T6-O2", "F4-C4", "C4-P4", "P4-O2"], "BIP ||"
  • bipolar longitudinal: ["Fp-Fz", "Fz-Cz", "Cz-Pz", "Pz-O", "Fp1-F7", "Fp1-F3", "F7-T7", "T7-P7", "P7-O1", "F3-C3", "C3-P3", "P3-O1", "Fp1-F7", "Fp2-F4", "F8-T8", "T8-P8", "P8-O2", "F4-C4", "C4-P4", "P4-O2"], "BIP ||"
NeuroAnalyzer.remove_dcFunction
remove_dc(s, n)

Remove mean value (DC offset). If n is greater than 0, mean value is calculated for the first n samples.

Arguments

  • s::AbstractVector
  • n::Int64=0: baseline is the first n samples

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.remove_dcFunction
remove_dc(s; n)

Remove mean value (DC offset). If n is greater than 0, mean value is calculated for the first n samples.

Arguments

  • s::AbstractArray
  • n::Int64=0: baseline is the first n samples

Returns

  • s::Array{Float64, 3}
NeuroAnalyzer.remove_dcMethod
remove_dc(obj; ch, n)

Remove mean value (DC offset). If n is greater than 0, mean value is calculated for the first n samples.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • n::Int64=0: baseline is the first n samples

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.remove_dc!Method
remove_dc!(obj; ch, n)

Remove mean value (DC offset). If n is greater than 0, mean value is calculated for the first n samples.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • n::Int64=0: baseline is the first n samples
NeuroAnalyzer.remove_popsMethod
remove_pops(s; r, repair)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected, signal length should be ≥2 seconds.

Arguments

  • s::AbstractVector
  • r::Int64=20: detection segment length; pops are checked within pop_location - r:pop_location + r samples
  • repair::Bool=true: recover the segment if true

Returns

Named tuple containing:

  • s::Vector{Float64}
  • pop_location::Int64: sample number in the signal
  • left_segment::Int64: length of segment before the pop that starts when signal crosses 0
  • right_segment::Int64: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_popsMethod
remove_pops(obj; <keyword arguments>)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected per segment, signal length should be ≈2 seconds.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • repair::Bool=true: recover the segment if true
  • window::Real=10.0: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)
  • r::Int64=sr(obj)÷2: detection segment length; pops are checked within (pop_location - r):(pop_location + r) samples

Returns

  • obj_new::NeuroAnalyzer.NEURO: returned if repair=true
  • pop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signal
  • l_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0
  • r_seg::Vector{Int64}: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_pops!Method
remove_pops!(obj; <keyword arguments>)

Detect and repair electrode pops (rapid amplitude change). Signal is recovered within the segments starting and ending at zero-crossing. Only one pop is detected, signal length should be ≈2 seconds.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • repair::Bool=true: recover the segment if true
  • window::Real=20.0: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)
  • r::Int64=sr(obj)÷2: detection segment length; pops are checked within pop_location - r:pop_location + r samples

Returns

  • pop_loc::Vector{Vector{Int64}}: location of pops: channel, epoch and sample number in the signal
  • l_seg::Vector{Int64}: length of segment before the pop that starts when signal crosses 0
  • r_seg::Vector{Int64}: length of segment after the pop that ends when signal crosses 0
NeuroAnalyzer.remove_powerlineMethod
remove_powerline(obj; <keyword arguments>)

Remove power line noise and its peaks above power line frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pl_frq::Real=50: power line frequency
  • method::Symbol=:iir: use IIR filter
  • pr::Real=2.0: prominence of noise peaks in dB
  • d::Real=5.0: minimum distance between peaks in Hz
  • q::Real=0.1: optimization step size

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.remove_powerline!Method
remove_powerline!(obj; <keyword arguments>)

Remove power line noise and harmonics.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pl_frq::Real=50: power line frequency
  • method::Symbol=:iir: use IIR filter
  • pr::Real=2.0: prominence of noise peaks in dB
  • d::Real=5.0: minimum distance between peaks in Hz
  • q::Real=0.1: optimization step size
NeuroAnalyzer.resampleMethod
resample(s; t, new_sr)

Resample to new_sr sampling frequency.

Arguments

  • s::AbstractVector
  • old_sr::Int64: old sampling rate
  • new_sr::Int64: new sampling rate

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.resampleMethod
resample(s; old_sr::Int64, new_sr::Int64)

Resamples all channels and time vector t to new_sr sampling frequency.

Arguments

  • s::AbstractArray
  • old_sr::Int64: old sampling rate
  • new_sr::Int64: new sampling rate

Returns

  • s_new::Array{Float64, 3}
NeuroAnalyzer.resampleMethod
resample(obj; new_sr)

Resample (up- or down-sample).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • old_sr::Int64: old sampling rate - new_sr::Int64: new sampling rate

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.resample!Method
resample!(obj; new_sr)

Resample (up- or down-sample).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate
NeuroAnalyzer.upsampleMethod
upsample(obj; new_sr)

Upsample.

Arguments

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

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.upsample!Method
upsample!(obj; new_sr)

Upsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate
NeuroAnalyzer.downsampleMethod
downsample(obj; new_sr)

Downsample.

Arguments

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

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.downsample!Method
downsample!(obj; new_sr)

Downsample.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • new_sr::Int64: new sampling rate
NeuroAnalyzer.scaleMethod
scale(obj; ch, factor)

Multiply channel(s) by factor.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • factor::Real: signal is multiplied by factor

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.scale!Method
scale!(obj; ch, factor)

Multiply channel(s) by factor.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • factor::Real: signal is multiplied by factor
NeuroAnalyzer.standardizeMethod
standardize(s)

Standardize channels.

Arguments

  • s::AbstractArray

Returns

  • s_new::NeuroAnalyzer.NEURO:
  • scaler::Vector{Any}: standardizing matrix
NeuroAnalyzer.standardizeMethod
standardize(obj; ch)

Standardize channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • obj_new::NeuroAnalyzer.NEURO
  • scaler::Vector{Any}: standardizing matrix
NeuroAnalyzer.standardize!Method
standardize!(obj; ch)

Standardize channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • scaler::Matrix{Float64}: standardizing matrix
NeuroAnalyzer.taperMethod
taper(signal; taper)

Taper the signal.

Arguments

  • signal::AbstractVector
  • t::Union{AbstractVector, Vector{ComplexF64}}

Returns

  • t::Vector{Union{Float64, ComplexF64}}
NeuroAnalyzer.taperMethod
taper(s; t)

Taper the signal.

Arguments

  • s::AbstractArray
  • t::Union{Vector{Real, Vector{ComplexF64}}

Returns

  • s::Array{Float64, 3
NeuroAnalyzer.taperMethod
taper(obj; channel, t)

Taper the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • t::Union{Vector{Real, Vector{ComplexF64}}

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.taper!Method
taper!(obj; ch, t)

Taper the signal.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • t::Union{Vector{<:Real}, Vector{ComplexF64}}
NeuroAnalyzer.tconvMethod
tconv(signal; kernel)

Performs convolution in the time domain.

Arguments

  • s::AbstractVector
  • kernel::AbstractVector

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.tconvMethod
tconv(s; kernel)

Perform convolution in the time domain.

Arguments

  • s::AbstractArray
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • kernel::Union{Vector{<:Real}, Vector{ComplexF64}}: kernel used for convolution

Returns

  • s_new::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.tconvMethod
tconv(obj; ch, kernel)

Perform convolution in the time domain.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • kernel::Union{Vector{<:Real}, Vector{ComplexF64}}: kernel used for convolution

Returns

  • s_new::Array{Float64, 3}: convoluted signal
NeuroAnalyzer.wbpMethod
wbp(s; pad, frq, fs, ncyc)

Perform wavelet band-pass filtering.

Arguments

  • s::AbstractVector
  • pad::Int64: pad with pad zeros
  • frq::Real: filter frequency
  • fs::Int64: sampling rate
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • s_new::Vector{Float64}
NeuroAnalyzer.wbpMethod
wbp(s; ch, pad, frq, ncyc)

Perform wavelet band-pass filtering.

Arguments

  • s::AbstractArray
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • fs::Int64: sampling rate
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • s_new::Array{Float64, 3
NeuroAnalyzer.wbpMethod
wbp(obj; ch, pad, frq, ncyc)

Perform wavelet band-pass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.wbp!Method
wbp!(obj; ch, pad, frq, ncyc)

Perform wavelet band-pass filtering.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): index of channels, default is all channels
  • pad::Int64: pad the signal with pad zeros
  • frq::Real: filter frequency
  • ncyc::Int64=6: number of cycles for Morlet wavelet

Locs

NeuroAnalyzer.add_locsMethod
add_locs(obj; locs)

Add electrode positions from locs.

Electrode locations:

  • channel channel number
  • labels channel label
  • loc_theta planar polar angle
  • loc_radius planar polar radius
  • loc_x spherical Cartesian x
  • loc_y spherical Cartesian y
  • loc_z spherical Cartesian z
  • loc_radius_sph spherical radius
  • loc_theta_sph spherical horizontal angle
  • loc_phi_sph spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • locs::DataFrame

Returns

  • obj_new::NeuroAnalyzer.NEURO
NeuroAnalyzer.add_locs!Method
add_locs!(obj; locs)

Load electrode positions from locs and return NeuroAnalyzer.NEURO object with metadata: :channel_locations, :loc_theta, :loc_radius, :loc_x, :loc_x, :loc_y, :loc_radius_sph, :loc_theta_sph, :loc_phi_sph.

Electrode locations:

  • channel channel number
  • labels channel label
  • loc_theta planar polar angle
  • loc_radius planar polar radius
  • loc_x spherical Cartesian x
  • loc_y spherical Cartesian y
  • loc_z spherical Cartesian z
  • loc_radius_sph spherical radius
  • loc_theta_sph spherical horizontal angle
  • loc_phi_sph spherical azimuth angle

Arguments

  • obj::NeuroAnalyzer.NEURO
  • locs::DataFrame
NeuroAnalyzer.cart2polMethod
cart2pol(x, y)

Convert Cartesian coordinates to polar.

Arguments

  • x::Real
  • y::Real

Returns

  • radius::Float64
  • theta::Float64
NeuroAnalyzer.pol2cartMethod
pol2cart(radius, theta)

Convert polar coordinates to Cartesian.

Arguments

  • radius::Real: polar radius, the distance from the origin to the point, in degrees
  • theta::Real: polar angle

Returns

  • x::Float64
  • y::Float64
NeuroAnalyzer.sph2cartMethod
sph2cart(radius, theta, phi)

Convert spherical coordinates to Cartesian.

Arguments

  • radius::Real: spherical radius, the distance from the origin to the point
  • theta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Real: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees

Returns

  • x::Float64
  • y::Float64
  • z::Float64
NeuroAnalyzer.cart2sphMethod
cart2sph(x, y, z)

Convert spherical coordinates to Cartesian.

Arguments

  • x::Real
  • y::Real
  • z::Real

Returns

  • radius::Float64: spherical radius, the distance from the origin to the point
  • theta::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Float64: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees
NeuroAnalyzer.sph2polMethod
sph2pol(radius, theta, phi)

Convert spherical coordinates to polar.

Arguments

  • radius::Real: spherical radius, the distance from the origin to the point
  • theta::Real: spherical horizontal angle, the angle in the xy plane with respect to the x axis, in degrees
  • phi::Real: spherical azimuth angle, the angle with respect to the z axis (elevation), in degrees

Returns

  • radius::Float64
  • theta::Float64
NeuroAnalyzer.locs_pol2cartMethod
locs_pol2cart(locs)

Convert polar locations to Cartesian.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_sph2cartMethod
locs_sph2cart(locs)

Convert spherical locations to Cartesian.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_cart2sphMethod
locs_cart2sph(locs)

Convert Cartesian locations to spherical.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_cart2polMethod
locs_cart2pol(locs)

Convert Cartesian locations to polar.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_sph2polMethod
locs_sph2pol(locs)

Convert spherical locations to polar.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_detailsMethod
locs_details(obj; ch, output)

Return locations of OBJ ch electrode.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, String}: channel number or name
  • out::Bool=true: print output if true

Returns

Named tuple containing:

  • ch::Int64: channel number
  • label::String: location label
  • theta::Float64: polar planar theta coordinate
  • radius::Float64: polar planar radius coordinate
  • x::Float64: Cartesian X spherical coordinate
  • y::Float64: Cartesian Y spherical coordinate
  • z::Float64: Cartesian Z spherical coordinate
  • theta_sph::Float64: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Float64: spherical radius, the distance from the origin to the point
  • phi_sph::Float64: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
NeuroAnalyzer.edit_locsMethod
edit_locs(obj; <keyword arguments>)

Edit electrode.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Int64}: channel number or name
  • x::Union{Real, Nothing}=nothing: Cartesian X spherical coordinate
  • y::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinate
  • z::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinate
  • theta::Union{Real, Nothing}=nothing: polar planar theta coordinate
  • radius::Union{Real, Nothing}=nothing: polar planar radius coordinate
  • theta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the point
  • phi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
  • name::String="": channel name
  • type::String="": channel type

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.edit_locs!Method
edit_locs!(obj; <keyword arguments>)

Edit electrode.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{String, Int64}: channel number or name
  • x::Union{Real, Nothing}=nothing: Cartesian X spherical coordinate
  • y::Union{Real, Nothing}=nothing: Cartesian Y spherical coordinate
  • z::Union{Real, Nothing}=nothing: Cartesian Z spherical coordinate
  • theta::Union{Real, Nothing}=nothing: polar planar theta coordinate
  • radius::Union{Real, Nothing}=nothing: polar planar radius coordinate
  • theta_sph::Union{Real, Nothing}=nothing: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degrees
  • radius_sph::Union{Real, Nothing}=nothing: spherical radius, the distance from the origin to the point
  • phi_sph::Union{Real, Nothing}=nothing: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
  • name::String="": channel name
  • type::String="": channel type
NeuroAnalyzer.locs_flipyMethod
locs_flipy(locs; planar, spherical)

Flip channel locations along y axis.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_flipy!Method
locs_flipy!(locs; planar, spherical)

Flip channel locations along y axis.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_flipxMethod
locs_flipx(locs; planar, spherical)

Flip channel locations along x axis.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_flipx!Method
locs_flipx!(locs; planar, spherical)

Flip channel locations along x axis.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_flipzMethod
locs_flipz(locs)

Flip channel locations along z axis.

Arguments

  • locs::DataFrame

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_rotzMethod
locs_rotz(locs; a, planar, spherical)

Rotate channel locations around the z axis.

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees)
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_rotz!Method
locs_rotz!(locs)

Rotate channel locations in the xy-plane.

Arguments

  • locs::DataFrame
  • a::Int64: scaling factor
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_rotyMethod
locs_roty(locs; a, planar, spherical)

Rotate channel locations in the xz-plane.

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees)
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_roty!Method
locs_roty!(locs)

Rotate channel locations in the xz-plane.

Arguments

  • locs::DataFrame
  • a::Int64: scaling factor
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_rotxMethod
locs_rotx(locs; a, planar, spherical)

Rotate channel locations in the yz-plane.

Arguments

  • locs::DataFrame
  • a::Real: angle of rotation (in degrees)
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_rotx!Method
locs_rotx!(locs)

Rotate channel locations in the yz-plane.

Arguments

  • locs::DataFrame
  • a::Int64: scaling factor
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_scaleMethod
locs_scale(locs; r, planar, spherical)

Scale channel locations.

Arguments

  • locs::DataFrame
  • r::Real: scaling factor
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_scale!Method
locs_scale!(locs)

Scale channel locations.

Arguments

  • locs::DataFrame
  • r::Real: scaling factor
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates
NeuroAnalyzer.locs_maximizeMethod
locs_maximize(locs; planar, spherical)

Maximize channel locations to the unit sphere.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=false: modify spherical coordinates

Returns

  • locs_new::DataFrame
NeuroAnalyzer.locs_maximize!Method
locs_maximize!(locs; planar, spherical)

Maximize channel locations to the unit sphere.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=false: modify spherical coordinates
NeuroAnalyzer.locs_swapxyMethod
locs_swapxy(locs; planar, spherical)

Swap channel locations x and y axes.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Returns

  • obj::NeuroAnalyzer.NEURO
NeuroAnalyzer.locs_swapxy!Method
locs_swapxy!(locs; planar, spherical)

Swap channel locations x and y axes.

Arguments

  • locs::DataFrame
  • planar::Bool=true: modify planar coordinates
  • spherical::Bool=true: modify spherical coordinates

Analyze

NeuroAnalyzer.acorMethod

acor(s; l, demean)

Calculate auto-correlation

Arguments

  • s::AbstractVector
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-correlation

Returns

Named tuple containing:

  • ac::Matrix{Float64}
NeuroAnalyzer.acorMethod

acor(s; l, demean)

Calculate auto-correlation

Arguments

  • s::AbstractMatrix
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-correlation

Returns

  • ac::Matrix{Float64}
NeuroAnalyzer.acorMethod

acor(s; l, demean)

Calculate auto-correlation

Arguments

  • s::AbstractArray
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-correlation

Returns

  • ac::Matrix{Float64}
NeuroAnalyzer.acorMethod

acor(obj; ch, lag, demean)

Calculate auto-correlation

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • lag::Real=1: lags range is 0:lag [s]
  • demean::Bool=true: demean signal before computing auto-correlation

Returns

Named tuple containing:

  • ac::Array{Float64, 3}
  • lag::Vector{Float64}: lags [s]
NeuroAnalyzer.acovMethod

acov(s; l, demean)

Calculate auto-covariance.

Arguments

  • s::AbstractVector
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-covariance

Returns

  • ac::Matrix{Float64}
NeuroAnalyzer.acovMethod

acov(s; l, demean)

Calculate auto-covariance.

Arguments

  • s::AbstractMatrix
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-covariance

Returns

  • ac::Matrix{Float64}
NeuroAnalyzer.acovMethod

acov(s; l, demean)

Calculate auto-covariance.

Arguments

  • s::AbstractArray
  • l::Int64=round(Int64, min(size(s[1, :, 1], 1) - 1, 10 * log10(size(s[1, :, 1], 1)))): lags range is 0:l
  • demean::Bool=true: demean signal before computing auto-covariance

Returns

  • ac::Matrix{Float64}
NeuroAnalyzer.acovMethod

acov(obj; ch, lag, demean)

Calculate auto-covariance.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • lag::Real=1: lags range is 0:lag [s]
  • demean::Bool=true: demean signal before computing auto-covariance

Returns

Named tuple containing:

  • ac::Array{Float64, 3}
  • lag::Vector{Float64}: lags [s]
NeuroAnalyzer.ampdiffMethod
ampdiff(s; ch)

Calculate amplitude difference between each channel and mean amplitude of reference channels ch.

Arguments

  • s::AbstractArray
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=size(s, 1): index of reference channels, default is all channels except the analyzed one

Returns

  • ad::Array{Float64, 3}
NeuroAnalyzer.ampdiffMethod
ampdiff(obj; ch)

Calculate amplitude difference between each channel and mean amplitude of reference channels ch.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of reference channels, default is all signal channels except the analyzed one

Returns

  • ad::Array{Float64, 3}
NeuroAnalyzer.band_mpowerMethod
band_mpower(s; fs, f)

Calculate mean and maximum band power and its frequency.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds

Returns

Named tuple containing:

  • mbp::Float64: mean band power
  • maxfrq::Float64: frequency of maximum band power
  • maxbp::Float64: power at maximum band frequency
NeuroAnalyzer.band_mpowerMethod
band_mpower(s; fs, f, mt)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • mt::Bool=false: if true use multi-tapered periodogram

Returns

Named tuple containing:

  • mbp::Matrix{Float64}: mean band power per channel per epoch
  • maxfrq::Matrix{Float64}: frequency of maximum band power per channel per epoch
  • maxbp::Matrix{Float64}: power at maximum band frequency per channel per epoch
NeuroAnalyzer.band_mpowerMethod
band_mpower(obj; ch, f, mt)

Calculate mean and maximum band power and its frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • mt::Bool=false: if true use multi-tapered periodogram

Returns

Named tuple containing:

  • mbp::Matrix{Float64}: mean band power per channel per epoch
  • maxfrq::Matrix{Float64}: frequency of maximum band power per channel per epoch
  • maxbp::Matrix{Float64}: power at maximum band frequency per channel per epoch
NeuroAnalyzer.band_powerMethod
band_power(s; fs, f, mt)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • bp::Float64: band power
NeuroAnalyzer.band_powerMethod
band_power(s; fs, f, mt)

Calculate absolute band power between two frequencies.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • bp::Matrix{Float64}: band power
NeuroAnalyzer.band_powerMethod
band_power(obj; ch, f, mt)

Calculate absolute band power between two frequencies.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • f::Tuple{Real, Real}: lower and upper frequency bounds
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • bp::Matrix{Float64}: band power
NeuroAnalyzer.cormMethod

corm(s; norm=true)

Calculate correlation matrix of s * s'.

Arguments

  • s::AbstractVector
  • norm::Bool: normalize correlation matrix

Returns

  • cm::Matrix{Float64}
NeuroAnalyzer.cormMethod

corm(s1, s2; norm=true)

Calculate correlation matrix of s1 * s2'.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • norm::Bool: normalize correlation matrix

Returns

  • cm::Matrix{Float64}
NeuroAnalyzer.cormMethod

corm(s; norm=true)

Calculate correlation matrix.

Arguments

  • s::AbstractArray
  • norm::Bool=false: normalize covariance

Returns

  • cm::Array{Float64, 4}
NeuroAnalyzer.cormMethod
corm(obj; ch, norm)

Calculate correlation matrix.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • norm::Bool=true: normalize matrix

Returns

  • cm::Array{Float64, 3}: correlation matrix for each epoch
NeuroAnalyzer.covmMethod

covm(s; norm=true)

Calculate covariance matrix of s * s'.

Arguments

  • s::AbstractVector
  • norm::Bool=false: normalize covariance

Returns

  • cm::Matrix{Float64}
NeuroAnalyzer.covmMethod

covm(s1, s2; norm=true)

Calculate covariance matrix of s1 * s2'.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • norm::Bool=false: normalize covariance

Returns

  • cm::Matrix{Float64}
NeuroAnalyzer.covmMethod

covm(s; norm=true)

Calculate covariance matrix.

Arguments

  • s::AbstractArray
  • norm::Bool=false: normalize covariance

Returns

  • cm::Matrix{Float64}
NeuroAnalyzer.covmMethod
covm(obj; ch, norm)

Calculate covariance matrix of signal * signal'.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • norm::Bool=false: normalize matrix

Returns

  • cm::Array{Float64, 3}: covariance matrix for each epoch
NeuroAnalyzer.cpsMethod
cps(s1, s2; fs)

Calculate cross power spectrum.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • pw::Vector{Float64}: cross power spectrum power
  • ph::Vector{Float64}: cross power spectrum phase (in radians)
  • f::Vector{Float64}: cross power spectrum frequencies
NeuroAnalyzer.cpsMethod
cps(s; fs)

Calculate cross power spectrum (channels vs channels).

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • pw::Array{Float64, 4}: cross power spectrum power
  • ph::Array{Float64, 4}: cross power spectrum phase (in radians)
  • f::Vector{Float64}: cross power spectrum frequencies
NeuroAnalyzer.cpsMethod
cps(s1, s2; fs)

Calculate cross power spectrum (channels of s1 vs channels of s2).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • fs::Int64: sampling rate

Returns

Named tuple containing:

  • pw::Array{Float64, 4}: cross power spectrum power
  • ph::Array{Float64, 4}: cross power spectrum phase (in radians)
  • f::Vector{Float64}: cross power spectrum frequencies
NeuroAnalyzer.cpsMethod
cps(obj; ch)

Calculate cross power spectrum.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

Named tuple containing:

  • pw::Array{Float64, 4}: cross power spectrum power
  • ph::Array{Float64, 4}: cross power spectrum phase (in radians)
  • f::Vector{Float64, 4}: cross power spectrum frequencies
NeuroAnalyzer.cpsMethod
cps(obj1, obj2; ch1, ch2, ep1, ep2, norm)

Calculate cross power spectrum.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: cross power spectrum power
  • ph::Array{Float64, 3}: cross power spectrum phase (in radians)
  • f::Vector{Float64, 3}: cross power spectrum frequencies
NeuroAnalyzer.gfpMethod
gfp(s)

Calculate GFP (Global Field Power).

Arguments

  • s::AbstractVector

Returns

  • gfp::Float64
NeuroAnalyzer.gfp_normMethod
gfp_norm(s)

Calculate signal normalized for GFP (Global Field Power).

Arguments

  • s::AbstractVector

Returns

  • gfp_norm::Float64
NeuroAnalyzer.dissMethod
diss(s1, s2)

Calculate DISS (global dissimilarity) and spatial correlation between s1 and s2.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • gd::Float64: global dissimilarity
  • sc::Float64: spatial correlation
NeuroAnalyzer.dissMethod
diss(s)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
NeuroAnalyzer.dissMethod
diss(s1, s2)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
NeuroAnalyzer.dissMethod
diss(obj; ch)

Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
NeuroAnalyzer.dissMethod
diss(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate DISS (global dissimilarity) and spatial correlation (ch1 of obj1 vs ch2 of obj2)..

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • gd::Array{Float64, 3}: global dissimilarity
  • sc::Array{Float64, 3}: spatial correlation
NeuroAnalyzer.entropyMethod
entropy(s)

Calculate entropy.

Arguments

  • s::AbstractVector

Returns

  • ent::Float64
  • sent::Float64: Shanon entropy
  • leent::Float64: log energy entropy
NeuroAnalyzer.entropyMethod
entropy(s)

Calculate entropy.

Arguments

  • s::AbstractArray

Returns

Named tuple containing:

  • ent::Array{Float64, 2}
  • sent::Array{Float64, 2}: Shanon entropy
  • leent::Array{Float64, 2}: log energy entropy
NeuroAnalyzer.entropyMethod
entropy(obj; ch)

Calculate entropy.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

Named tuple containing:

  • ent::Array{Float64, 2}
  • sent::Array{Float64, 2}: Shanon entropy
  • leent::Array{Float64, 2}: log energy entropy
NeuroAnalyzer.negentropyMethod
negentropy(signal)

Calculate negentropy.

Arguments

  • signal::AbstractVector

Returns

  • negent::Float64
NeuroAnalyzer.negentropyMethod
negentropy(s)

Calculate negentropy.

Arguments

  • s::AbstractArray

Returns

  • ne::Array{Float64, 2}
NeuroAnalyzer.negentropyMethod
negentropy(obj; ch)

Calculate negentropy.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • ne::Array{Float64, 2}
NeuroAnalyzer.tenvMethod
tenv(obj; ch, d)

Calculate temporal envelope (amplitude).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env::Array{Float64, 3}: temporal envelope
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_meanMethod
tenv_mean(obj; ch, dims, d)

Calculate temporal envelope (amplitude): mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env_m::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: mean
  • t_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper bound
  • t_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.tenv_medianMethod
tenv_median(obj; ch, dims, d)

Calculate temporal envelope (amplitude): median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • t_env_m::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: median
  • t_env_u::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI upper bound
  • t_env_l::Union{Vector{Float64}, Matrix{Float64}}: temporal envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.penvMethod
penv(obj; ch, d)

Calculate power (in dB) envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • p_env::Array{Float64, 3}: power spectrum envelope
  • p_env_frq::Vector{Float64}: frequencies for each envelope
NeuroAnalyzer.penv_meanMethod
penv_mean(obj; ch, dims, d)

Calculate power (in dB) envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered periodogram

Returns

Named tuple containing:

  • p_env_m::Array{Float64, 3}: power spectrum envelope: mean
  • p_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper bound
  • p_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower bound
  • p_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.penv_medianMethod
penv_median(obj; ch, dims, d)

Calculate power (in dB) envelope: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: median over channels (dims = 1) or epochs (dims = 2)
  • d::Int64=8: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered periodogram

Returns

Named tuple containing:

  • p_env_m::Array{Float64, 3}: power spectrum envelope: median
  • p_env_u::Array{Float64, 3}: power spectrum envelope: 95% CI upper bound
  • p_env_l::Array{Float64, 3}: power spectrum envelope: 95% CI lower bound
  • p_env_frq::Vector{Float64}: power spectrum envelope (useful for plotting over PSD)
NeuroAnalyzer.senvMethod
senv(obj; ch, d, mt, t)

Calculate spectral envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered spectrogram
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)

Returns

Named tuple containing:

  • s_env::Array{Float64, 3}: spectral envelope
  • s_env_t::Vector{Float64}: spectrogram time
NeuroAnalyzer.senv_meanMethod
senv_mean(obj; ch, dims, d, mt, t)

Calculate spectral envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered spectrogram
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)

Returns

Named tuple containing:

  • s_env_m::Array{Float64, 3}: spectral envelope: mean
  • s_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bound
  • s_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bound
  • s_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.senv_medianMethod
senv_median(obj; ch, dims, d, mt)

Calculate spectral envelope: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=2: distance between peeks in samples, lower values get better envelope fit
  • mt::Bool=false: if true use multi-tapered spectrogram
  • t::Union{Real, Nothing}=nothing: spectrogram threshold (maximize all powers > t)

Returns

Named tuple containing:

  • s_env_m::Array{Float64, 3}: spectral envelope: median
  • s_env_u::Array{Float64, 3}: spectral envelope: 95% CI upper bound
  • s_env_l::Array{Float64, 3}: spectral envelope: 95% CI lower bound
  • s_env_t::Vector{Float64}: spectral envelope (useful for plotting over spectrogram)
NeuroAnalyzer.henvMethod
henv(obj; ch, d)

Calculate Hilbert spectrum amplitude envelope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env::Array{Float64, 3}: Hilbert spectrum amplitude envelope
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_meanMethod
henv_mean(obj; ch, dims, d)

Calculate Hilbert spectrum amplitude envelope: mean and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env_m::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: mean
  • h_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper bound
  • h_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.henv_medianMethod
henv_median(obj; ch, dims, d)

Calculate Hilbert spectrum amplitude envelope of obj: median and 95% CI.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • dims::Int64: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)
  • d::Int64=32: distance between peeks in samples, lower values get better envelope fit

Returns

Named tuple containing:

  • h_env_m::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: median
  • h_env_u::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI upper bound
  • h_env_l::Union{Vector{Float64}, Matrix{Float64}}: Hilbert spectrum amplitude envelope: 95% CI lower bound
  • s_t::Vector{Float64}: signal time
NeuroAnalyzer.env_corMethod
env_cor(obj1, obj2; type, ch1, ch2, ep1, ep2)

Calculate envelope correlation.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • type::Symbol=:amp: envelope type:
    • :amp: amplitude
    • :pow: power
    • :spec: spectrogram
    • :hamp: Hilbert spectrum amplitude
  • ch1::Int64
  • ch2::Int64
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • ec::Vector{Float64}: power correlation value
  • p::Vector{Float64}: p-value
NeuroAnalyzer.eropMethod
erop(obj; <keyword arguments>)

Calculate ERO (Event-Related Oscillations) power-spectrum. If obj is ERP, ero() returns two epochs: ERP power-spectrum (ero_s[:, :, 1]) and averaged power-spectra of all ERP epochs (ero_s[:, :, 2]). Otherwise, ero() returns averaged power-spectra of all obj epochs (ero_s[:, :, 1])

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64: channel to analyze
  • method::Symbol=:standard: method of calculating power-spectrum:
    • :standard: standard
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
  • nt::Int64=8: number of Slepian tapers
  • pad::Int64=0: number of zeros to add
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency limits
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • norm::Bool=true: normalize powers to dB
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number o cycles is used per frequency: ncyc = logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc = linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • ero_p::Array{Float64, 3}: powers
  • ero_f::Vector{Float64}: frequencies
NeuroAnalyzer.erosMethod
eros(obj; <keyword arguments>)

Calculate ERO (Event-Related Oscillations) spectrogram. If obj is ERP, ero() returns two epochs: ERP spectrogram (ero_s[:, :, 1]) and averaged spectrograms of all ERP epochs (ero_s[:, :, 2]). Otherwise, ero() returns averaged spectrograms of all obj epochs (ero_s[:, :, 1])

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64: channel to analyze
  • method::Symbol=:standard: method of calculating spectrogram:
    • :standard: standard
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • pad::Int64=0: number of zeros to add
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency limits
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • norm::Bool=true: normalize powers to dB
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number o cycles is used per frequency: ncyc = logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc = linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin
  • wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • ero_s::Array{Float64, 3}: spectrogram(s)
  • ero_f::Vector{Float64}: frequencies
  • ero_t::Vector{Float64}: time
NeuroAnalyzer.erp_peaksMethod
erp_peaks(obj)

Detect a pair of positive and negative peaks of ERP.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

  • p::Array{Int64, 2}: peaks: channels × positive peak position, negative peak position
NeuroAnalyzer.amp_atMethod
amp_at(obj; t)

Calculate amplitude at given time.

Arguments

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

Returns

  • p::Matrix{Float64, 2}: amplitude for each channel per epoch
NeuroAnalyzer.avgamp_atMethod
avgamp_at(obj; t)

Calculate average amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64, 2}: mean amplitude for each channel per epoch
NeuroAnalyzer.maxamp_atMethod
maxamp_at(obj; t)

Calculate maximum amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64, 2}: maximum amplitude for each channel per epoch
NeuroAnalyzer.minamp_atMethod
minamp_at(obj; t)

Calculate minimum amplitude at given time segment.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • t::Tuple{Real, Real}: time segment in seconds

Returns

  • p::Matrix{Float64, 2}: minimum amplitude for each channel per epoch
NeuroAnalyzer.fcoherenceMethod
fcoherence(s; fs, frq_lim)

Calculate coherence (mean over all frequencies) and MSC (magnitude-squared coherence) between channels.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: return coherence only for the given frequency range

Returns

Named tuple containing:

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.fcoherenceMethod
fcoherence(s1, s2; fs, frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing)

Calculate coherence (mean over all frequencies) and MSC (magnitude-squared coherence) between channels of s1 and s2.

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • fs::Int64
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: return coherence only for the given frequency range

Returns

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.fcoherenceMethod
fcoherence(s1, s2; fs, frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing)

Calculate coherence (mean over all frequencies) and MSC (magnitude-squared coherence) between channels of s1 and s2.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • fs::Int64
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: return coherence only for the given frequency range

Returns

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.fcoherenceMethod
fcoherence(obj1, obj2; ch1, ch2, ep1, ep2, frq_lim)

Calculate coherence (mean over frequencies) and MSC (magnitude-squared coherence).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs
  • frq_lim::Union{Tuple{Real, Real}, Nothing}=nothing: return coherence only for the given frequency range

Returns

Named tuple containing:

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • f::Vector{Float64}: frequencies
NeuroAnalyzer.frqinstMethod
frqinst(s; fs)

Calculate instantaneous frequency.

Arguments

  • s::AbstractVector
  • fs::Int64

Returns

  • f::Vector{Float64}
NeuroAnalyzer.frqinstMethod
frqinst(s; fs)

Calculate instantaneous frequency.

Arguments

  • s::AbstractVector
  • fs::Int64

Returns

  • f::Array{Float64, 2}
NeuroAnalyzer.frqinstMethod
frqinst(obj; channel)

Calculate instantaneous frequency.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • channel::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • f::Array{Float64, 3}
NeuroAnalyzer.gedMethod
ged(s1, s2)

Perform generalized eigendecomposition.

Arguments

  • s1::AbstractArray: signal to be analyzed
  • s2::AbstractArray: original signal

Returns

Named tuple containing:

  • sged::Matrix{Float64}
  • ress::Vector{Float64}
  • ress_norm::Vector{Float64}: RESS normalized to -1..1
NeuroAnalyzer.gedMethod
ged(obj1, obj2; ch1, ch2, ep1, ep2)

Perform generalized eigendecomposition.

Arguments

  • obj1::NeuroAnalyzer.NEURO: signal data to be analyzed
  • obj2::NeuroAnalyzer.NEURO: original signal data
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

  • sged::Array{Float64, 3}
  • ress::Matrix{Float64}
  • ress_norm::Matrix{Float64}
NeuroAnalyzer.hrv_detectMethod
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

  • nn_seg::Vector{Float64}: list of NN segments [msec]
  • r_idx::Vector{Float64}: index of R peaks
NeuroAnalyzer.hrv_analyzeMethod
hrv_analyze(nn_seg)

Analyze heart rate variability (HRV).

Arguments

  • nn_seg::Vector{Float64}: list of NN segments [msec]

Returns

Named tuple containing:

  • menn::Float64: the mean of NN segments
  • mdnn::Float64: the median of NN segments
  • vnn::Float64: the variance of NN segments
  • sdnn::Float64: the standard deviation of NN segments
  • rmssd::Float64: ("root mean square of successive differences"), the square root of the mean of the squares of the successive differences between adjacent NNs
  • sdsd::Float64: ("standard deviation of successive differences"), the standard deviation of the successive differences between adjacent NNs
  • nn50::Float64: the number of pairs of successive NNs that differ by more than 50 ms
  • pnn50::Float64, the proportion of NN50 divided by total number of NNs
  • nn20::Float64, the number of pairs of successive NNs that differ by more than 20 ms
  • pnn20::Float64, the proportion of NN20 divided by total number of NNs
NeuroAnalyzer.ispcMethod
ispc(s1, s2)

Calculate ISPC (Inter-Site-Phase Clustering) between s1 and s2.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • ispc_value::Float64: ISPC value
  • ispc_angle::Float64: ISPC angle
  • s_diff::Vector{Float64}: signal difference (s2 - s1)
  • ph_diff::Vector{Float64}: phase difference (s2 - s1)
  • s1_phase::Vector{Float64}: signal 1 phase
  • s2_phase::Vector{Float64}: signal 2 phase
NeuroAnalyzer.ispcMethod
ispc(obj; ch)

Calculate ISPCs (Inter-Site-Phase Clustering).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • ispc_value::Array{Float64, 3}: ISPC value matrices over epochs
  • ispc_angle::Array{Float64, 3}: ISPC angle matrices over epochs
NeuroAnalyzer.ispcMethod
ispc(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate ISPC (Inter-Site-Phase Clustering).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • ispc_value::Array{Float64, 2}: ISPC value
  • ispc_angle::Array{Float64, 2}: ISPC angle
  • s_diff::Array{Float64, 3}: signal difference (s2 - s1)
  • ph_diff::Array{Float64, 3}: phase difference (s2 - s1)
  • s1_phase::Array{Float64, 3}: signal 1 phase
  • s2_phase::Array{Float64, 3}: signal 2 phase
NeuroAnalyzer.itpcMethod
itpc(s; t)

Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.

Arguments

  • s::AbstractArray: one channel over epochs
  • t::Int64: time point (sample number) at which ITPC is calculated
  • w::Union{AbstractVector, Nothing}: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_value::Float64: ITPC value
  • itpcz_value::Float64: Rayleigh's ITPC Z value
  • itpc_angle::Float64: ITPC angle
  • itpc_phases::Vector{Float64}: phases at time t averaged across trials/epochs
NeuroAnalyzer.itpcMethod
itpc(obj; <keyword arguments>)

Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t over epochs.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • t::Int64: time point (sample number) at which ITPC is calculated
  • w::Union{Vector{<:Real}, Nothing}=nothing: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_value::Vector{Float64}: ITPC or wITPC value
  • itpcz_value::Vector{Float64}: Rayleigh's ITPC Z value
  • itpc_angle::Vector{Float64}: ITPC angle
  • itpc_phases::Array{Float64, 2}: phase difference (channel2 - channel1)
NeuroAnalyzer.itpc_specMethod
itpc_spec(obj; <keyword arguments>)

Calculate spectrogram of ITPC (Inter-Trial-Phase Clustering).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Int64
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds for the spectrogram
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • w::Union{Vector{<:Real}, Nothing}=nothing: optional vector of epochs/trials weights for wITPC calculation

Returns

Named tuple containing:

  • itpc_s::Array{Float64, 3}: spectrogram of ITPC values
  • itpcz_s::Array{Float64, 3}: spectrogram itpcz_value values
  • itpc_f::Vector{Float64}: frequencies list
NeuroAnalyzer.mdiffMethod
mdiff(s1, s2; n, method)

Calculate mean difference and 95% confidence interval for 2 signals.

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • n::Int64=3: number of bootstraps
  • method::Symbol=:absdiff:
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Vector{Float64}
  • sts::Float64
  • p::Float64
NeuroAnalyzer.mdiffMethod
mdiff(s1, s2; n, method)

Calculate mean difference and its 95% CI between channels.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • n::Int64=3: number of bootstraps
  • method::Symbol=:absdiff
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Matrix{Float64}
  • sts::Vector{Float64}
  • p::Vector{Float64}
NeuroAnalyzer.mdiffMethod
mdiff(obj; ch, n, method)

Calculate mean difference and its 95% CI between channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • n::Int64=3: number of bootstraps
  • method::Symbol=:absdiff
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Matrix{Float64}
  • sts::Vector{Float64}
  • p::Vector{Float64}
NeuroAnalyzer.mdiffMethod
mdiff(obj1, obj2; channel1, channel2, epoch1, epoch2, n, method)

Calculates mean difference and 95% confidence interval for two channels.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2:NeuroAnalyzer.NEURO
  • channel1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • channel2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • epoch1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • epoch2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs
  • n::Int64: number of bootstraps
  • method::Symbol[:absdiff, :diff2int]
    • :absdiff: maximum difference
    • :diff2int: integrated area of the squared difference

Returns

Named tuple containing:

  • st::Matrix{Float64}
  • sts::Vector{Float64}
  • p::Vector{Float64}
NeuroAnalyzer.mutual_informationMethod
mutual_information(s1, s2)

Calculate mutual information.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

  • mutual_information::Float64
NeuroAnalyzer.mutual_informationMethod
mutual_information(s1, s2)

Calculate mutual information (channels of s1 vs channels of s2).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • mutual_information::Array{Float64}
NeuroAnalyzer.mutual_informationMethod
mutual_information(obj; channel)

Calculate mutual information between channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • channel::Union{Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • mutual_information::Array{Float64, 3}
NeuroAnalyzer.mutual_informationMethod
mutual_information(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate mutual information between two channels.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

  • m::Array{Float64, 3}
NeuroAnalyzer.msci95Method
msci95(s; n, method)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractVector
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Float64: mean
  • ss::Float64: standard deviation
  • su::Float64: upper 95% CI
  • sl::Float64: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(s; n, method)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractMatrix
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Vector{Float64}: mean
  • ss::Vector{Float64}: standard deviation
  • su::Vector{Float64}: upper 95% CI
  • sl::Vector{Float64}: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(s; n, method)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • s::AbstractArray
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal method (:normal) or n-times boostrapping (:boot)

Returns

Named tuple containing:

  • sm::Array{Float64}: mean
  • ss::Array{Float64}: standard deviation
  • su::Array{Float64}: upper 95% CI
  • sl::Array{Float64}: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(obj; ch, n, method)

Calculate mean, standard deviation and 95% confidence interval.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • n::Int64=3: number of bootstraps
  • method::Symbol=:normal: use normal (:normal) method or n-times bootstrapping (:boot)

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI
  • sl::Matrix{Float64}: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(s1, s2)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • sm::Float64: mean
  • ss::Float64: standard deviation
  • su::Float64: upper 95% CI
  • sl::Float64: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(s1, s2)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

Named tuple containing:

  • sm::Array{Float64}: mean
  • ss::Array{Float64}: standard deviation
  • su::Array{Float64}: upper 95% CI
  • sl::Array{Float64}: lower 95% CI
NeuroAnalyzer.msci95Method
msci95(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate mean difference, standard deviation and 95% confidence interval.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2:NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • sm::Matrix{Float64}: mean
  • ss::Matrix{Float64}: standard deviation
  • su::Matrix{Float64}: upper 95% CI bound
  • sl::Matrix{Float64}: lower 95% CI bound
NeuroAnalyzer.phdiffMethod
phdiff(s1, s2; pad, h)

Calculate phase difference between signals.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • pad::Int64=0: number of zeros to add
  • h::Bool=false: use FFT or Hilbert transformation (if h=true)

Returns

Named tuple containing:

  • phd::Vector{Float64}: phase differences in radians
NeuroAnalyzer.phdiffMethod
phdiff(s; ch, pad, h)

Calculate phase difference between channels and mean phase of reference ch.

Arguments

  • s::AbstractArray
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=size(s, 1): index of reference channels, default is all channels except the analyzed one
  • avg::Symbol=:phase: method of averaging:
    • :phase: phase is calculated for each reference channel separately and then averaged
    • :signal: signals are averaged prior to phase calculation
  • pad::Int64=0: pad signals with 0s
  • h::Bool=false: use FFT or Hilbert transformation

Returns

  • phd::Array{Float64, 3}
NeuroAnalyzer.phdiffMethod
phdiff(obj; ch, pad, h)

Calculate phase difference between channels and mean phase of reference ch.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of reference channels, default is all signal channels except the analyzed one
  • avg::Symbol=:phase: method of averaging:
    • :phase: phase is calculated for each reference channel separately and then averaged
    • :signal: signals are averaged prior to phase calculation
  • pad::Int64=0: pad signals with 0s
  • h::Bool=false: use FFT or Hilbert transformation

Returns

  • phd::Array{Float64, 3}
NeuroAnalyzer.pliMethod
pli(s1, s2)

Calculate PLI (Phase-Lag Index).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • pv::Float64: PLI value
  • sd::Vector{Float64}: signal difference (s2 - s1)
  • phd::Vector{Float64}: phase difference (s2 - s1)
  • s1ph::Vector{Float64}: signal 1 phase
  • s2ph::Vector{Float64}: signal 2 phase
NeuroAnalyzer.pliMethod
pli(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate PLI (Phase Lag Index).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • pv::Array{Float64, 2}: PLI value
  • sd::Array{Float64, 3}: signal difference (s2 - s1)
  • phd::Array{Float64, 3}: phase difference (s2 - s1)
  • s1ph::Array{Float64, 3}: signal 1 phase
  • s2ph::Array{Float64, 3}: signal 2 phase
NeuroAnalyzer.pliMethod
pli(obj; channel)

Calculate PLIs (Phase Lag Index).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • channel::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • pv::Array{Float64, 3}: PLI value matrices over epochs
NeuroAnalyzer.psdMethod
psd(s; fs, norm, mt, nt)

Calculate power spectrum density.

Arguments

  • s::Vector{Float64}
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • pw::Vector{Float64}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psdMethod
psd(s; fs, norm, mt, nt)

Calculate power spectrum density.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • pw::Array{Float64, 2}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psdMethod
psd(s; fs, norm, mt, nt)

Calculate power spectrum density.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psdMethod
psd(obj; ch, norm, mt)

Calculate power spectrum density.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_mwMethod
psd_mw(s; pad, norm, frq_lim, frq_n, frq, fs, ncyc)

Calculate power spectrum using Morlet wavelet convolution.

Arguments

  • s::AbstractVector
  • pad::Int64=0: pad with pad zeros
  • norm::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram
  • frq_n::Int64=length(frq_lim[1]:frq_lim[2]): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc=linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • pw::Matrix{Float64}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_mwMethod
psd_mw(s; pad, norm, frq_lim, frq_n, frq, fs, ncyc)

Calculate power spectrum using Morlet wavelet convolution.

Arguments

  • s::AbstractMatrix
  • pad::Int64=0: pad with pad zeros
  • norm::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram
  • frq_n::Int64=10: number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc = logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc = linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • pw::Array{Float64, 2}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_mwMethod
psd_mw(s; pad, norm, frq_lim, frq_n, frq, fs, ncyc)

Calculate power spectrum using Morlet wavelet convolution.

Arguments

  • s::AbstractArray
  • pad::Int64=0: pad with pad zeros
  • norm::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram
  • frq_n::Int64=10: number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc = logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc = linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_mwMethod
psd_mw(obj; ch, pad, norm, frq_lim, frq_n, frq, ncyc)

Calculate power spectrum using Morlet wavelet convolution.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all s channels
  • pad::Int64=0: pad with pad zeros
  • norm::Bool=true: normalize powers to dB
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency bounds for the spectrogram
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number of cycles is used per frequency: ncyc=logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc=linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_relMethod
psd_rel(s; fs, norm, mt, nt, f)

Calculate relative power spectrum density.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers
  • f::Union(Tuple{Real, Real}, Nothing)=nothing: calculate power relative to frequency range or total power

Returns

Named tuple containing:

  • pw::Vector{Float64}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_relMethod
psd_rel(s; fs, norm, mt, nt, f)

Calculate relative power spectrum density.

Arguments

  • s::AbstractMatrix
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers
  • f::Union(Tuple{Real, Real}, Nothing)=nothing: calculate power relative to frequency range or total power

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_relMethod
psd_rel(s; fs, norm, mt, nt, f)

Calculate relative power spectrum density.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers
  • f::Union(Tuple{Real, Real}, Nothing)=nothing: calculate power relative to frequency range or total power

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Vector{Float64}: frequencies
NeuroAnalyzer.psd_relMethod
psd_rel(obj; ch, norm, mt, nt, f)

Calculate relative power spectrum density.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers
  • f::Union(Tuple{Real, Real}, Nothing)=nothing: calculate power relative to frequency range or total power

Returns

Named tuple containing:

  • pw::Array{Float64, 3}: powers
  • pf::Array{Float64, 3}: frequencies
NeuroAnalyzer.psd_slopeMethod
psd_slope(s; fs, f, norm, mt, nt)

Calculate PSD linear fit and slope.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency range f[1] to f[2]
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • lf::Vector{Float64}: linear fit
  • ls::Float64: slopes of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
NeuroAnalyzer.psd_slopeMethod
psd_slope(s; fs, f, norm, mt, nt)

Calculate PSD linear fit and slope.

Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • f::Tuple{Real, Real}=(0, fs / 2): calculate slope of the total power (default) or frequency range f[1] to f[2]
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • lf::Matrix{Float64}: linear fit
  • s::Vector{Float64}: slope of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
NeuroAnalyzer.psd_slopeMethod
psd_slope(obj; ch, f, norm, mt)

Calculate PSD linear fit and slope.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • f::Tuple{Real, Real}=(0, sr(obj) / 2): calculate slope of the total power (default) or frequency range f[1] to f[2]
  • norm::Bool=false: normalize do dB
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

Named tuple containing:

  • lf::Array{Float64, 3}: linear fit
  • ls::Array{Float64, 2}: slope of linear fit
  • pf::Vector{Float64}: range of frequencies for the linear fit
NeuroAnalyzer.rmsMethod
rms(s)

Calculate Root Mean Square.

Arguments

  • s::AbstractVector

Returns

  • rms::Float64
NeuroAnalyzer.rmsMethod
rms(s)

Calculate Root Mean Square.

Arguments

  • s::AbstractArray

Returns

  • r::Array{Float64, 2}
NeuroAnalyzer.rmsMethod
rms(obj; channel)

Calculate Root Mean Square.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • r::Array{Float64, 2}
NeuroAnalyzer.rmseMethod
rmse(s1, s2)

Calculate Root Mean Square Error (RMSE).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

  • rmse::Float64: RMSE
NeuroAnalyzer.rmseMethod
rmse(s1, s2)

Calculate Root Mean Square Error (RMSE).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray

Returns

  • r::Array{Float64, 2}: RMSE
NeuroAnalyzer.rmseMethod
rmse(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate Root Mean Square Error (RMSE).

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • r::Array{Float64, 3}: RMSE
  • cps_ph::Array{Float64, 3}: cross power spectrum phase (in radians)
  • cps_fq::Vector{Float64, 3}: cross power spectrum frequencies
NeuroAnalyzer.snrMethod
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

NeuroAnalyzer.snr2Method
snr2(s)

Calculate RMS-based SNR.

Arguments

  • s::AbstractVector

Returns

  • snr2::Float64: SNR
NeuroAnalyzer.snrMethod
snr(s; t, type)

Calculate SNR.

Arguments

  • s::AbstractArray
  • t::Vector{Float64}: epoch time
  • type::Symbol=:rms: SNR type:
    • :mean: mean-based
    • :rms: RMS-based

Returns

Named tuple containing:

  • s::Matrix(Float64): SNR for each channel over frequencies 1:Nyquist
  • f::Vector(Float64): frequencies
NeuroAnalyzer.snrMethod
snr(obj; ch, type)

Calculate SNR.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • type::Symbol=:rms: SNR type:
    • :mean: mean-based
    • :rms: RMS-based

Returns

Named tuple containing:

  • sn::Matrix(Float64): SNR for each channel over frequencies 1:Nyquist
  • f::Vector(Float64): frequencies
NeuroAnalyzer.spec_segMethod
spec_seg(sp, st, sf; t, f)

Return spectrogram segment.

Arguments

  • sp::Matrix{Float64}: spectrogram powers
  • st::Vector{Float64}: spectrogram time
  • sf::Vector{Float64}: spectrogram frequencies
  • t::Tuple{Real, Real}: time bounds
  • f::Tuple{Real, Real}: frequency bounds

Returns

Named tuple containing:

  • segp::Matrix{Float64}: powers
  • segs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted by Plots.Shape(segs)
  • tidx::Tuple{Real, Real}: time indices
  • fidx::Tuple{Real, Real}: frequency indices
NeuroAnalyzer.spec_segMethod
spec_seg(sp, sf, st; ch, t, f)

Return spectrogram segment.

Arguments

  • sp::AbstractArray: spectrogram powers
  • st::AbstractVector: spectrogram time
  • sf::AbstractVector: spectrogram frequencies
  • ch::Int64: channel
  • t::Tuple{Real, Real}: time bounds
  • f::Tuple{Real, Real}: frequency bounds

Returns

Named tuple containing:

  • segp::Array{Float64, 3}: segment of powers
  • segs::Vector{Tuple{Float64, Float64}}: segment coordinates, for plotting should be converted by Plots.Shape(segs)
  • tidx::Tuple{Real, Real}: time indices
  • fidx::Tuple{Real, Real}: frequency indices
NeuroAnalyzer.spectrogramMethod
spectrogram(s; fs, norm, mt, st)

Calculate spectrogram.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling frequency
  • norm::Bool=true: normalize powers to dB
  • mt::Bool=false: if true use multi-tapered spectrogram
  • st::Bool=false: if true use short time Fourier transform

Returns

Named tuple containing:

  • sp::Matrix{Float64}: powers
  • sf::Vector{Float64}: frequencies
  • st::Vector{Float64}: time
NeuroAnalyzer.wspectrogramMethod
wspectrogram(s; pad, norm, fs, frq_lim, frq_n, frq, ncyc)

Calculate spectrogram using wavelet convolution.

Arguments

  • s::AbstractVector
  • pad::Int64: pad with pad zeros
  • norm::Bool=true: normalize powers to dB
  • fs::Int64: sampling rate
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number o cycles is used per frequency: ncyc=logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc=linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin

Returns

Named tuple containing:

  • cs::Matrix(ComplexF64}: convoluted signal
  • sp::Matrix{Float64}: powers
  • sph::Matrix{Float64}: phases
  • sf::Vector{Float64}: frequencies
NeuroAnalyzer.ghspectrogramMethod
ghspectrogram(s; fs, norm, frq_lim, frq_n, frq, fs)

Calculate spectrogram using Gaussian and Hilbert transform.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • norm::Bool=true: normalize powers to dB
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram
  • frq_n::Int64_tlength(frq_lim): number of frequencies
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • gw::Real=5: Gaussian width in Hz

Returns

Named tuple containing:

  • sp::Matrix{Float64}: powers
  • sph::Matrix{Float64}: phases
  • sf::Vector{Float64}: frequencies
NeuroAnalyzer.cwtspectrogramMethod
cwtspectrogram(s; wt, pad, norm, frq_lim, fs)

Calculate spectrogram using continuous wavelet transformation (CWT).

Arguments

  • s::AbstractVector
  • wt<:CWT: continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets
  • fs::Int64: sampling rate
  • norm::Bool=true: normalize powers to dB
  • frq_lim::Tuple{Real, Real}=(0, fs / 2): frequency bounds for the spectrogram

Returns

Named tuple containing:

  • sp::Matrix{Float64}: powers
  • sf::Vector{Float64}: frequencies
NeuroAnalyzer.spectrogramMethod
spectrogram(obj; ch, pad, frq_lim, frq_n, method, norm, frq, gw, ncyc, wt)

Calculate spectrogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • method::Symbol=:standard: method of calculating spectrogram:
    • :standard: standard
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
    • :gh: Gaussian and Hilbert transform
    • :cwt: continuous wavelet transformation
  • pad::Int64=0: number of zeros to add
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): frequency limits
  • frq_n::Int64=_tlength(frq_lim): number of frequencies
  • norm::Bool=true: normalize powers to dB
  • frq::Symbol=:log: linear (:lin) or logarithmic (:log) frequencies
  • gw::Real=5: Gaussian width in Hz
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet, for tuple a variable number o cycles is used per frequency: ncyc = logspace(log10(ncyc[1]), log10(ncyc[2]), frq_n) for frq = :log or ncyc = linspace(ncyc[1], ncyc[2], frq_n) for frq = :lin
  • wt<:CWT=wavelet(Morlet(2π), β=2): continuous wavelet, e.g. wt = wavelet(Morlet(2π), β=2), see ContinuousWavelets.jl documentation for the list of available wavelets

Returns

Named tuple containing:

  • sp::Array{Float64, 3}
  • sf::Vector{Float64}
  • st::Vector{Float64}
NeuroAnalyzer.spectrumMethod
spectrum(s; pad)

Calculate FFT, amplitudes, powers and phases.

Arguments

  • s::AbstractVector
  • pad::Int64=0: number of zeros to add at the end of the signal
  • norm::Bool=false: normalize do dB

Returns

Named tuple containing:

  • ft::Vector{ComplexF64}: Fourier transforms
  • sa::Vector{Float64}: amplitudes
  • sp::Vector{Float64}: powers
  • sph::Vector{Float64}: phases
NeuroAnalyzer.hspectrumMethod
hspectrum(s; pad=0)

Calculate amplitudes, powers and phases using Hilbert transform.

Arguments

  • s::AbstractVector
  • pad::Int64: number of zeros to add at the end of the signal
  • norm::Bool=true: normalize do dB

Returns

Named tuple containing:

  • hc::Vector(ComplexF64}: Hilbert components
  • sa::Vector{Float64}: amplitudes
  • sp::Vector{Float64}: powers
  • sph::Vector{Float64}: phases
NeuroAnalyzer.hspectrumMethod
hspectrum(s; pad=0)

Calculate amplitudes, powers and phases using Hilbert transform.

Arguments

  • s::AbstractArray
  • pad::Int64: number of zeros to add at the end of the signal
  • norm::Bool=true: normalize do dB

Returns

Named tuple containing:

  • hc::Array(ComplexF64, 3}: Hilbert components
  • sa::Array{Float64, 3}: amplitudes
  • sp::Array{Float64, 3}: powers
  • sph::Array{Float64, 3}: phases
NeuroAnalyzer.spectrumMethod
spectrum(s; pad, h)

Calculate FFT/Hilbert transformation components, amplitudes, powers and phases.

Arguments

  • s::AbstractArray
  • pad::Int64=0: number of zeros to add signal for FFT
  • h::Bool=false: use Hilbert transform for calculations instead of FFT
  • norm::Bool=false: normalize do dB

Returns

Named tuple containing:

  • c::Array{ComplexF64, 3}: Fourier or Hilbert components
  • sa::Array{Float64, 3}: amplitudes
  • sp::Array{Float64, 3}: powers
  • `sph::Array{Float64, 3}: phase angles
NeuroAnalyzer.spectrumMethod
spectrum(obj; ch, pad, h)

Calculate FFT/Hilbert transformation components, amplitudes, powers and phases.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • pad::Int64=0: number of zeros to add signal for FFT
  • h::Bool=false: use Hilbert transform for calculations instead of FFT
  • norm::Bool=false: normalize do dB

Returns

Named tuple containing:

  • c::Array{ComplexF64, 3}: Fourier or Hilbert components
  • sa::Array{Float64, 3}: amplitudes
  • sp::Array{Float64, 3}: powers
  • `sph::Array{Float64, 3}: phase angles
NeuroAnalyzer.stationarity_hilbertMethod
stationarity_hilbert(s)

Calculate phase stationarity using Hilbert transformation.

Arguments

  • s::AbstractVector

Returns

  • stph::Vector{Float64}
NeuroAnalyzer.stationarity_meanMethod
stationarity_mean(s; window)

Calculate mean stationarity. Signal is split into window-long windows and averaged across windows.

Arguments

  • s::AbstractVector
  • window::Int64: time window in samples

Returns

  • stm::Vector{Float64}
NeuroAnalyzer.stationarity_varMethod
stationarity_var(s; window)

Calculate variance stationarity. Signal is split into window-long windows and variance is calculated across windows.

Arguments

  • s::AbstractVector
  • window::Int64: time window in samples

Returns

  • stv::Vector{Float64}
NeuroAnalyzer.stationarityMethod
stationarity(obj; ch, window, method)

Calculate stationarity.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • window::Int64=10: time window in samples
  • method::Symbol=:euclid: stationarity method:
    • :mean: mean across window-long windows
    • :var: variance across window-long windows
    • :cov: covariance stationarity based on Euclidean distance between covariance matrix of adjacent time windows
    • :hilbert: phase stationarity using Hilbert transformation
    • :adf: Augmented Dickey–Fuller test; returns ADF-test value and p-value (H0: signal is non-stationary; p-value < alpha means that signal is stationary)

Returns

  • stationarity::Array{Float64, 3}
NeuroAnalyzer.epoch_statsMethod
epoch_stats(obj)

Calculate epochs statistics.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • e_mean::Vector(Float64): mean
  • e_median::Vector(Float64): median
  • e_std::Vector(Float64): standard deviation
  • e_var::Vector(Float64): variance
  • e_kurt::Vector(Float64): kurtosis
  • e_skew::Vector(Float64): skewness
  • e_mean_diff::Vector(Float64): mean diff value
  • e_median_diff::Vector(Float64): median diff value
  • e_max_dif::Vector(Float64): max difference
  • e_dev_mean::Vector(Float64): deviation from channel mean
NeuroAnalyzer.channel_statsMethod
channel_stats(obj)

Calculate channels statistics per epoch.

Arguments

  • obj::NeuroAnalyzer.NEURO

Returns

Named tuple containing:

  • c_mean::Matrix(Float64): mean
  • c_median::Matrix(Float64): median
  • c_std::Matrix(Float64): standard deviation
  • c_var::Matrix(Float64): variance
  • c_kurt::Matrix(Float64): kurtosis
  • c_skew::Matrix(Float64): skewness
  • c_mean_diff::Matrix(Float64): mean diff value
  • c_median_diff::Matrix(Float64): median diff value
  • c_max_dif::Matrix(Float64): max difference
  • c_dev_mean::Matrix(Float64): deviation from channel mean
NeuroAnalyzer.tcoherenceMethod
tcoherence(s1, s2; pad)

Calculate coherence (mean over time), IC (imaginary coherence) and MSC (magnitude-squared coherence).

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • pad::Int64=0: number of zeros to add

Returns

Named tuple containing:

  • c::Vector{Float64}: coherence
  • msc::Vector{Float64}: magnitude-squares coherence
  • ic::Vector{Float64}: imaginary part of coherence
NeuroAnalyzer.tcoherenceMethod
tcoherence(s1, s2; ch1, ch2, ep1, ep2)

Calculate coherence (mean over time), IC (imaginary coherence) and MSC (magnitude-squared coherence).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • pad::Int64=0: number of zeros to add signal for FFT

Returns

Named tuple containing:

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • ic::Array{Float64, 3}: imaginary part of coherence
NeuroAnalyzer.tcoherenceMethod
tcoherence(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate coherence (mean over time), IC (imaginary coherence) and MSC (magnitude-squared coherence).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2)): default use all epochs
  • pad::Int64=0: number of zeros to add signal for FFT

Returns

Named tuple containing:

  • c::Array{Float64, 3}: coherence
  • msc::Array{Float64, 3}: MSC
  • ic::Array{Float64, 3}: imaginary part of coherence
NeuroAnalyzer.tkeoMethod
tkeo(s)

Calculate Teager-Kaiser energy-tracking operator: y(t) = x(t)^2 - x(t-1) × x(t+1)

Arguments

  • s::AbstractVector

Returns

  • t::Vector{Float64}
NeuroAnalyzer.tkeoMethod
tkeo(s; channel)

Calculate Teager-Kaiser energy-tracking operator: y(t) = x(t)^2 - x(t-1) × x(t+1)

Arguments

  • s::AbstractArray
  • channel::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • t::Array{Float64, 3}
NeuroAnalyzer.tkeoMethod
tkeo(obj; channel)

Calculate Teager-Kaiser energy-tracking operator: y(t) = x(t)^2 - x(t-1) × x(t+1)

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

  • t::Array{Float64, 3}
NeuroAnalyzer.total_powerMethod
total_power(s; fs, mt)

Calculate total power.

Arguments

  • s::AbstractVector
  • fs::Int64: sampling rate
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • tp::Float64: total power
NeuroAnalyzer.total_powerMethod
total_power(s; fs, mt)

Calculate total power.

`# Arguments

  • s::AbstractArray
  • fs::Int64: sampling rate
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • tp::Matrix{Float64}: total power
NeuroAnalyzer.total_powerMethod
total_power(obj, ch, mt)

Calculate total power.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(record): index of channels, default is all signal channels
  • mt::Bool=false: if true use multi-tapered periodogram
  • nt::Int64=8: number of Slepian tapers

Returns

  • tp::Matrix{Float64}: total power
NeuroAnalyzer.vartestMethod
vartest(obj; ch)

Calculate variance F-test.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj): index of channels, default is all signal channels

Returns

Named tuple containing:

  • f::Array{Float64, 3}
  • p::Array{Float64, 3}
NeuroAnalyzer.vartestMethod
vartest(obj1, obj2; ch1, ch2, ep1, ep2)

Calculate variance F-test.

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2)): default use all epochs

Returns

Named tuple containing:

  • f::Array{Float64, 3}
  • p::Array{Float64, 3}
NeuroAnalyzer.xcorMethod

xcor(s1, s2; l, demean)

Calculate cross-correlation (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2))))
  • demean::Bool=true: demean signal before computing cross-correlation

Returns

  • xc::Array{Float64, 3}
NeuroAnalyzer.xcorMethod

xcor(s1, s2; l, demean)

Calculate cross-correlation (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2))))
  • demean::Bool=true: demean signal before computing cross-correlation

Returns

  • xc::Array{Float64, 3}
NeuroAnalyzer.xcorMethod
xcor(obj1, obj2; ch1, ch2, ep1, ep2, lag, norm)

Calculate cross-correlation (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2)): default use all epochs
  • lag::Real=1: lags range is -lag:lag [s]
  • demean::Bool=true: demean signal before computing cross-correlation

Returns

Named tuple containing:

  • xc::Array{Float64, 3}: cross-correlation
  • lag::Vector{Float64}: lags [s]
NeuroAnalyzer.xcovMethod

xcov(s1, s2; l, demean)

Calculate cross-covariance (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • s1::AbstractMatrix
  • s2::AbstractMatrix
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2))))
  • demean::Bool=true: demean signal before computing cross-covariance

Returns

  • xc::Array{Float64, 3}
NeuroAnalyzer.xcovMethod

xcov(s1, s2; l, demean)

Calculate cross-covariance (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • s1::AbstractArray
  • s2::AbstractArray
  • l::Int64=round(Int64, min(size(s1, 2), 10 * log10(size(s1, 2))))
  • demean::Bool=true: demean signal before computing cross-covariance

Returns

  • xc::Array{Float64, 3}
NeuroAnalyzer.xcovMethod
xcov(obj1, obj2; ch1, ch2, ep1, ep2, lag, norm)

Calculate cross-covariance (a measure of similarity of two signals as a function of the displacement of one relative to the other).

Arguments

  • obj1::NeuroAnalyzer.NEURO
  • obj2::NeuroAnalyzer.NEURO
  • ch1::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj1): index of channels, default is all signal channels
  • ch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2): index of channels, default is all signal channels
  • ep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1)): default use all epochs
  • ep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2)): default use all epochs
  • lag::Real=1: lags range is -lag:lag [s]
  • demean::Bool=true: demean signal before computing cross-covariance

Returns

Named tuple containing:

  • xc::Array{Float64, 3}: cross-covariance
  • lag::Vector{Float64}: lags [s]

Plot

NeuroAnalyzer.ieditMethod
iedit(obj; <keyword arguments>)

Interactive edit of continuous or epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • mono::Bool=true: use color or grey palette
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ieditMethod
iedit(obj1, obj2; <keyword arguments>)

Interactive edit of two continuous or epoched signals.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (before) - drawn in black
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (after) - drawn in red
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj1)): channel(s) to plot, default is all channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iedit_epMethod
iedit_ep(obj; <keyword arguments>)

Interactive edit of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • mono::Bool=true: use color or grey palette

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iedit_epMethod
iedit_ep(obj1, obj2; <keyword arguments>)

Interactive edit of epoched signal.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (before) - drawn in black
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (after) - drawn in red
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj1)): channel(s) to plot, default is all channels

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iedit_contMethod
iedit_cont(obj; <keyword arguments>)

Interactive edit of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • mono::Bool=true: use color or grey palette
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iedit_contMethod
iedit_cont(obj1, obj2; <keyword arguments>)

Interactive preview of two continuous signal.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (before) - drawn in black
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (after) - drawn in red
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj1)): channel(s) to plot, default is all channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iplotMethod
iplot(obj; <keyword arguments>)

Interactive plot of continuous or epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iplot_contMethod
iplot_cont(obj; <keyword arguments>)

Interactive plot of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iplot_epMethod
iplot_ep(obj; <keyword arguments>)

Interactive plot of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iplot_icatopoMethod
iplot_icatopo(obj; <keyword arguments>)

Interactive topographical plot of embedded ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.iplot_icatopoMethod
iplot_icatopo(obj, ic, ic_mw; <keyword arguments>)

Interactive topographical plot of external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ipsdMethod
ipsd(obj; <keyword arguments>)

Interactive PSD of continuous or epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ipsd_contMethod
ipsd_cont(obj; <keyword arguments>)

Interactive PSD of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ipsd_epMethod
ipsd_ep(obj; <keyword arguments>)

Interactive PSD of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ispectrogramMethod
ispectrogram(obj; <keyword arguments>)

Interactive spectrogram of continuous or epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=1: index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ispectrogram_contMethod
ispectrogram_cont(obj; <keyword arguments>)

Interactive spectrogram of continuous signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=1: index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.ispectrogram_epMethod
ispectrogram_ep(obj; <keyword arguments>)

Interactive spectrogram of epoched signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=1: index of channels, default is all signal channels
  • zoom::Int64=5: how many seconds are displayed in one segment

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_composeMethod
plot_compose(p; <keyword arguments>)

Compose a complex plot of various plots contained in vector p using layout layout. Layout scheme is:

  • (2, 2): 2 × 2 plots, regular layout
  • grid(4, 1, heights=[0.6, 0.1, 0.1, 0.1]: 4 × 1 plots, irregular layout
  • @layout [a{0.2w} b{0.8w};_ c{0.6}]: complex layout using Plots.jl @layout macro

Arguments

  • p::Vector{Plots.Plot{Plots.GRBackend}}: vector of plots
  • layout::Union(Matrix{Any}, Tuple{Int64, Int64}, Plots.GridLayout}: layout
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for p vector plots

Returns

  • pc::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_emptyMethod
plot_empty()

Return an empty plot, useful for filling matrices of plots.

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_connectionsMethod
plot_connections(obj; <keyword arguments>)

Plot weights at electrode positions.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • connections::Matrix{<:Real}: matrix of connections weights
  • threshold::Real: plot all connection above threshold
  • threshold_type::Symbol=:g: rule for thresholding: = (:eq), ≥ (:geq), ≤ (:leq), > (:g), < (:l)
  • weights::Bool=true: weight line widths and alpha based on connection value
  • channel_labels::Bool=false: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • title::String="": plot title
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_connectionsMethod
plot_connections(obj; <keyword arguments>)

Plot connections between channels.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Vector{Int64}, AbstractRange}: channel(s) to plot
  • connections::Matrix{<:Real}: matrix of connections weights
  • threshold::Real: plot all connection above threshold
  • threshold_type::Symbol=:g: rule for thresholding: = (:eq), ≥ (:geq), ≤ (:leq), > (:g), < (:l)
  • weights::Bool=true: weight line widths and alpha based on connection value
  • channel_labels::Bool=false: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_dipole2dMethod
plot_dipole2d(d; <keyword arguments>)

Plot dipole in 2D.

Arguments

  • d::NeuroAnalyzer.DIPOLE

Returns

  • p::GLMakie.Figure

Notes

Brain volume is within -1.0 to +1.0 (X-, Y- and Z-axis)

NeuroAnalyzer.plot_dipole3dMethod
plot_dipole3d(d; <keyword arguments>)

Plot dipole in 3D.

Arguments

  • d::NeuroAnalyzer.DIPOLE
  • project::Bool=true: plot lines projected onto X, Y and Z axes

Returns

  • p::GLMakie.Figure

Notes

Brain volume is within -1.0 to +1.0 (X-, Y- and Z-axis)

NeuroAnalyzer.plot_erpMethod
plot_erp(t, s, bad; <keyword arguments>)

Plot ERP.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractVector: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_butterflyMethod
plot_erp_butterfly(t, s; <keyword arguments>)

Butterfly plot of ERP.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • avg::Bool=false: plot average ERP
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_avgMethod
plot_erp_avg(t, s; <keyword arguments>)

Plot ERP amplitude mean and ±95% CI.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • yrev::Bool=false: reverse Y axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erp_topoMethod
plot_erp_topo(locs, t, s; <keyword arguments>)

Plot topographical map ERPs.

Arguments

  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph

  • t::Vector{Float64}: time vector

  • s::Array{Float64, 2}: ERPs

  • ch::Union{Vector{Int64}, AbstractRange}: which channels to plot

  • clabels::Vector{String}=[""]: signal channel labels vector

  • xlabel::String="": x-axis label

  • ylabel::String="": y-axis label

  • title::String="": plot title

  • yrev::Bool=false: reverse Y axis

  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates

  • mono::Bool=false: use color or grey palette

  • kwargs: optional arguments for plot() function

Returns

  • fig::GLMakie.Figure
NeuroAnalyzer.plot_erp_stackMethod
plot_erp_stack(s; <keyword arguments>)

Plot EPRs stacked by channels or by epochs.

Arguments

  • t::AbstractVector: x-axis values
  • s::AbstractArray
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • cb::Bool=true: plot color bar
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erpMethod
plot_erp(obj; <keyword arguments>)

Plot ERP.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • tm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time points
  • xlabel::String="default": x-axis label, default is Time [ms]
  • ylabel::String="default": y-axis label, default is Amplitude [units]
  • title::String="default": plot title, default is ERP amplitude [channel: 1, epochs: 1:2, time window: -0.5 s:1.5 s]
  • cb::Bool=true: plot color bar
  • cb_title::String="default": color bar title, default is Amplitude [units]
  • mono::Bool=false: use color or grey palette
  • peaks::Bool=true: draw peaks
  • channel_labels::Bool=true: draw labels legend (using channel labels) for multi-channel :butterfly plot
  • type::Symbol=:normal: plot type: :normal, butterfly plot (:butterfly), topographical plot of ERPs (:topo) or stacked epochs/channels (:stack)
  • yrev::Bool=false: reverse Y axis
  • avg::Bool=false: plot average ERP for :butterfly plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_filter_responseMethod
plot_filter_response(<keyword arguments>)

Plot filter response.

Arguments

  • fs::Int64: sampling rate
  • fprototype::Symbol: filter prototype:
    • :butterworth
    • :chebyshev1
    • :chebyshev2
    • :elliptic
    • :fir
    • :iirnotch: second-order IIR notch filter
    • :remez: Remez FIR filter
  • ftype::Union{Symbol, Nothing}=nothing: filter type:
    • :lp: low pass
    • :hp: high pass
    • :bp: band pass
    • :bs: band stop
  • cutoff::Union{Real, Tuple{Real, Real}}: filter cutoff in Hz (tuple for :bp and :bs)
  • n::Int64=2560: signal length in samples
  • fs::Int64: sampling rate
  • order::Int64=8: filter order (6 dB/octave), number of taps for :remez, attenuation (× 4 dB) for :fir filters
  • rp::Real=-1: ripple amplitude in dB in the pass band; default: 0.0025 dB for :elliptic, 2 dB for others
  • rs::Real=-1: ripple amplitude in dB in the stop band; default: 40 dB for :elliptic, 20 dB for others
  • bw::Real=-1: bandwidth for :iirnotch and :remez filters
  • window::Union{Nothing, AbstractVector, Int64}=nothing: window for :fir filter; default is Hamming window, number of taps is calculated using fred harris' rule-of-thumb
  • mono::Bool=false: use color or grey palette
  • `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the Y-axis
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locsMethod
plot_locs(locs; <keyword arguments>)

Preview channel locations.

Arguments

  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=1:nrow(locs): channel(s) to plot, default is all channels
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • ch_labels::Bool=true: plot channel labels
  • head::Bool=true: draw head
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • grid::Bool=false: draw grid, useful for locating positions
  • plot_size::Int64=400: plot dimensions in pixels (size × size)
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs3dMethod
plot_locs3d(locs; <keyword arguments>)

3D interactive preview of channel locations. It uses Cartesian :locx, :locy and :loc_z locations.

Arguments

  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=1:nrow(locs): channel(s) to plot, default is all channels
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • ch_labels::Bool=true: plot channel labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • plot_size::Int64=800: plot dimensions in pixels (plotsize×plotsize)
  • cart::Bool=false: if true, use Cartesian x, y and z coordinates, otherwise use spherical radius, theta and phi coordinates

Returns

  • fig::GLMakie.Figure
NeuroAnalyzer.plot_locsMethod
plot_locs(obj; <keyword arguments>)

Preview of channel locations.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: which channel should be highlighted
  • ch_labels::Bool=true: plot channel labels
  • src_labels::Bool=false: plot source labels
  • det_labels::Bool=false: plot detector labels
  • opt_labels::Bool=false: plot optode type (S for source, D for detector) and number
  • head::Bool=true: draw head
  • head_labels::Bool=false: plot head labels
  • plot_size::Int64=400: plot dimensions in pixels (plotsize×plotsize)
  • head_details::Bool=true: draw nose and ears
  • mono::Bool=false: use color or grey palette
  • threed::Bool=false: 3-dimensional plot
  • grid::Bool=false: draw grid, useful for locating positions
  • cart::Bool=false: if true, use polar coordinates, otherwise use Cartesian spherical x and y coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_locs_nirsMethod
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: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch_pairs::Matrix{Int64}: pairs of source and detector
  • src_n::Int64: number of sources
  • det_n::Int64: number of detectors
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • src_labels::Bool=false: plot source labels
  • det_labels::Bool=false: plot detector labels
  • opt_labels::Bool=false: plot optode type (S for source, D for detector) and number
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • grid::Bool=false: draw grid, useful for locating positions
  • plot_size::Int64=400: plot dimensions in pixels (size × size)

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psdMethod
plot_psd(sf, sp; <keyword arguments>)

Plot PSD (power spectrum density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Vector{Float64}: powers
  • norm::Bool=true: whether powers are normalized to dB
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psdMethod
plot_psd(sf, sp; <keyword arguments>)

Plot multi-channel PSD (power spectrum density).

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Matrix{Float64}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • norm::Bool=true: whether powers are normalized to dB
  • frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_avgMethod
plot_psd_avg(sf, sp; <keyword arguments>)

Plot PSD mean and ±95% CI of averaged channels.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_butterflyMethod
plot_psd_butterfly(sf, sp; <keyword arguments>)

Butterfly PSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • norm::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_psd_3dMethod
plot_psd_w3d(sf, sp; <keyword arguments>)

Plot 3-d waterfall PSD plot.

Arguments

  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • clabels::Vector{String}=[""]: signal channel labels vector
  • norm::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • zlabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • variant::Symbol: waterfall (:w) or surface (:s)
  • kwargs: optional arguments for plot() function

Returns

  • p::Union{Plots.Plot{Plots.GRBackend}, GLMakie.Figure}
NeuroAnalyzer.plot_psd_topoMethod
plot_psd_topo(locs, sf, sp; <keyword arguments>)

Plot topographical map PSDs.

Arguments

  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 3}: powers
  • ch::Union{Vector{Int64}, AbstractRange}: which channels to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • norm::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • fig::GLMakie.Figure
NeuroAnalyzer.plot_psdMethod
plot_psd(obj; <keyword arguments>)

Plot power spectrum density.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • norm::Bool=true: normalize powers to dB
  • method::Symbol=:welch: method of calculating PSD:
    • :welch: Welch's periodogram
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
  • nt::Int64=8: number of Slepian tapers
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): x-axis limit
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet
  • ref::Symbol=:abs: type of PSD reference: absolute power (no reference) (:abs) or relative to: total power (:total), :delta, :theta, :alpha, :beta, :beta_high, :gamma, :gamma_1, :gamma_2, :gamma_lower or :gamma_higher
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Power [dB] or Power [units^2/Hz]
  • zlabel::String="default": z-axis label for 3-d plots, default is Power [dB] 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 grey palette
  • type::Symbol=:normal: plot type: :normal, :butterfly, :mean, 3-d waterfall (:w3d), 3-d surface (:s3d), topographical (:topo)
  • kwargs: optional arguments for plot() function

Returns

  • p::Union{Plots.Plot{Plots.GRBackend}, GLMakie.Figure}
NeuroAnalyzer.plot_psdMethod
plot_psd(obj; <keyword arguments>)

Plot power spectrum density of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • norm::Bool=true: normalize powers to dB
  • method::Symbol=:welch: method of calculating PSD:
    • :welch: Welch's periodogram
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
  • nt::Int64=8: number of Slepian tapers
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): x-axis limit
  • ref::Symbol=:abs: type of PSD reference: absolute power (no reference) (:abs) or relative to: total power (:total), :delta, :theta, :alpha, :beta, :beta_high, :gamma, :gamma_1, :gamma_2, :gamma_lower or :gamma_higher
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet
  • ax::Symbol=:linlin: type of axes scaling: linear-linear (:linlin), log10-linear (:loglin), linear-log10 (:linlog), log10-log10 (:loglog)
  • xlabel::String="default": x-axis label, default is Frequency [Hz]
  • ylabel::String="default": y-axis label, default is Power [dB] or Power [units^2/Hz]
  • zlabel::String="default": z-axis label for 3-d plots, default is Power [dB] 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 grey palette
  • type::Symbol=:normal: plot type: :normal, :butterfly, :mean, 3-d waterfall (:w3d), 3-d surface (:s3d), topographical (:topo)
  • units::String=""
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_saveMethod
plot_save(p; file_name::String)

Saves plot as file (PNG/PDF). File format is determined using file_name extension.

Arguments

  • p::Union{Plots.Plot{Plots.GRBackend}, GLMakie.Figure}
  • file_name::String
NeuroAnalyzer.plot_signalMethod
plot_signal(t, s; <keyword arguments>)

Plot amplitude of single- or multi-channel s.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::Union{AbstractVector, AbstractArray}: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signalMethod
plot_signal(t, s, bad; <keyword arguments>)

Plot amplitude of single- or multi-channel s.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::Union{AbstractVector, AbstractArray}: data to plot
  • norm::Bool=false: normalize signal for butterfly and averaged plots
  • bad::Vector{Bool}}: list of bad channels
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_avgMethod
plot_signal_avg(t, signal; <keyword arguments>)

Plot amplitude mean and ±95% CI of averaged signal channels.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • norm::Bool=false: normalize to -1 .. +1
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_signal_butterflyMethod
plot_signal_butterfly(t, s; <keyword arguments>)

Butterfly plot of s channels.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s::AbstractArray: data to plot
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • mono::Bool=false: use color or grey palette
  • norm::Bool=false: normalize to -1 .. +1
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_2signalsMethod
plot_2signals(t, s1, s2; <keyword arguments>)

Plot amplitude of single- or multi-channel s1 and s2.

Arguments

  • t::Union{AbstractVector, AbstractRange}: x-axis values (usually time)
  • s1::Union{AbstractVector, AbstractArray}: data to plot (before) - drawn in black
  • s2::Union{AbstractVector, AbstractArray}: data to plot (after) - drawn in red
  • clabels::Vector{String}=[""]: signal channel labels vector
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plotMethod
plot(obj; <keyword arguments>)

Plot signal.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj)): channel(s) to plot, default is all channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title, default is Amplitude [channels: 1:2, epochs: 1:2, time window: 0 ms:20 s]
  • mono::Bool=false: use color or grey palette
  • emarkers::Bool: draw epoch markers if available
  • markers::Bool: draw markers if available
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • type::Symbol=:normal: plot type:
    • :normal
    • :mean: mean ± 95%CI
    • :butterfly: butterfly plot
  • norm::Bool=false: normalize signal for butterfly and averaged plots
  • bad::Union{Bool, Matrix{Bool}}=false: list of bad channels; if not empty - plot bad channels using this list
  • s_pos::Tuple{Real, Real}=(0, 0): draw segment borders if different than (0, 0), used by iedit()
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plotMethod
plot(obj, c; <keyword arguments>)

Plot embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title, default is Amplitude [channels: 1:2, epochs: 1:2, time window: 0 ms:20 s]
  • mono::Bool=false: use color or grey palette
  • emarkers::Bool: draw epoch markers if available
  • markers::Bool: draw markers if available
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • type::Symbol=:normal: plot type:
    • :normal
    • :mean: mean ± 95%CI
    • :butterfly: butterfly plot
  • norm::Bool=false: normalize signal for butterfly and averaged plots
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plotMethod
plot(obj1, obj2; <keyword arguments>)

Plot two signals. This function is used to compare two signals, e.g. before and after ica_recovery(). Both signals must have the same data type, dimensions and sampling rate.

Arguments

  • obj1::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (before) - drawn in black
  • obj2::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object (after) - drawn in red
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj1)): channel(s) to plot, default is all channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is no label
  • title::String="default": plot title, default is Amplitude [channels: 1:2, epochs: 1:2, time window: 0 ms:20 s]
  • emarkers::Bool: draw epoch markers if available
  • scale::Bool=true: draw scale
  • units::String="": units of the scale
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogramMethod
plot_spectrogram(st, sf, sp; <keyword arguments>)

Plot single-channel spectrogram.

Arguments

  • st::Vector{Float64}: time
  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 2}: powers
  • norm::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • units::String=""
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogramMethod
plot_spectrogram(sch, sf, sp; <keyword arguments>)

Plot multiple-channel spectrogram.

Arguments

  • sch::Vector{String}: channel labels
  • sf::Vector{Float64}: frequencies
  • sp::Array{Float64, 2}: powers
  • norm::Bool=true: whether powers are normalized to dB
  • `frq_lim::Tuple{Real, Real}=(0, 0): frequency limit for the Y-axis
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • units::String=""
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogramMethod
plot_spectrogram(obj; <keyword arguments>)

Plots spectrogram.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • norm::Bool=true: normalize powers to dB
  • method::Symbol=:standard: method of calculating spectrogram:
    • :standard: standard
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
  • nt::Int64=8: number of Slepian tapers
  • frq_lim::Tuple{Real, Real}=(0, 0): y-axis limits
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is Frequency [Hz]
  • title::String="default": plot title, default is Spectrogram [frequency limit: 0-128 Hz]

[channel: 1, epoch: 1, time window: 0 ms:10 s]

  • mono::Bool=false: use color or grey palette
  • markers::Bool: draw markers if available
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_spectrogramMethod
plot_spectrogram(obj, c; <keyword arguments>)

Plots spectrogram of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • c::Union{Symbol, AbstractArray}: component to plot
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • ep::Int64=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • norm::Bool=true: normalize powers to dB
  • method::Symbol=:standard: method of calculating spectrogram:
    • :standard: standard
    • :stft: short-time Fourier transform
    • :mt: multi-tapered periodogram
    • :mw: Morlet wavelet convolution
  • nt::Int64=8: number of Slepian tapers
  • frq_lim::Tuple{Real, Real}=(0, sr(obj) / 2): y-axis limits
  • ncyc::Union{Int64, Tuple{Int64, Int64}}=6: number of cycles for Morlet wavelet
  • xlabel::String="default": x-axis label, default is Time [s]
  • ylabel::String="default": y-axis label, default is Frequency [Hz]
  • title::String="default": plot title, default is Spectrogram [frequency limit: 0-128 Hz]

[component: 1, epoch: 1, time window: 0 ms:10 s]

  • mono::Bool=false: use color or grey palette
  • markers::Bool: draw markers if available
  • units::String=""
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_topoMethod
plot_topo(c; <keyword arguments>)

Plot topographical view.

Arguments

  • s::Vector{<:Real}: values to plot (one value per channel)
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • head_labels::Bool=false: plot head labels
  • head_details::Bool=true: draw nose and ears
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_topoMethod
plot_topo(obj; <keyword arguments>)

Topographical plot.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • title::String="default": plot title, default is Amplitude topographical plot [channels: 1:19, epoch: 1, time window: 0 ms:20 s]
  • mono::Bool=false: use color or grey palette
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • head_labels::Bool=false: plot head labels
  • head_details::Bool=true: draw nose and ears
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_topoMethod
plot_topo(obj; <keyword arguments>)

Topographical plot of embedded or external component.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • c::Union{Symbol, AbstractArray}: component to plot
  • ep::Union{Int64, AbstractRange}=0: epoch to display
  • c_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component channel to display, default is all component channels
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • title::String="default": plot title, default is Amplitude topographical plot [channels: 1:19, epoch: 1, time window: 0 ms:20 s]
  • mono::Bool=false: use color or grey palette
  • cb::Bool=true: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • head_labels::Bool=false: plot head labels
  • head_details::Bool=true: draw nose and ears
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_matrixMethod
plot_matrix(m; <keyword arguments>)

Plot matrix.

Arguments

  • m::Array{<:Real, 2}
  • xlabels::Vector{String}
  • ylabels::Vector{String}
  • xlabel::String=""
  • ylabel::String=""
  • title::String=""
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_xacMethod
plot_xac(m, lags; <keyword arguments>)

Plot cross/auto-covariance/correlation.

Arguments

  • m::Abstractvector: covariance matrix
  • lags::AbstractVector: covariance lags, lags will be displayed in s
  • xlabel::String="lag"
  • ylabel::String=""
  • title::String=""
  • cb_title::String="": color bar title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_histogramMethod
plot_histogram(s; <keyword arguments>)

Plot histogram.

Arguments

  • s::AbstractVector
  • type::Symbol: type of histogram: regular (:hist) or kernel density (:kd)
  • bins::Union{Int64, Symbol, AbstractVector}=(length(s) ÷ 10): histogram bins: number of bins, range or :sturges, :sqrt, :rice, :scott or :fd)
  • label::String="": channel label
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_barMethod
plot_bar(s; <keyword arguments>)

Bar plot.

Arguments

  • s::AbstractVector
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_lineMethod
plot_line(s; <keyword arguments>)

Line plot.

Arguments

  • s::AbstractVector
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_lineMethod
plot_line(s; <keyword arguments>)

Line plot.

Arguments

  • s::AbstractArray
  • rlabels::Vector{String}: signal rows labels
  • xlabels::Vector{String}: x-ticks labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_boxMethod
plot_box(s; <keyword arguments>)

Box plot.

Arguments

  • s::AbstractArray
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_violinMethod
plot_violin(s; <keyword arguments>)

Violin plot.

Arguments

  • s::AbstractArray
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_dotsMethod
plot_dots(s; <keyword arguments>)

Dots plot.

Arguments

  • s::Vector{Vector{Float64}}
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_pairedMethod
plot_paired(signal; <keyword arguments>)

Plot paired data.

Arguments

  • signal::Vector{Vector{Float64}}
  • glabels::Vector{String}: group labels
  • xlabel::String="": x-axis label
  • ylabel::String="": y-axis label
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_polarMethod
plot_polar(s; <keyword arguments>)

Polar plot.

Arguments

  • s::Union{AbstractVector, AbstractArray}
  • m::Tuple{Real, Real}=(0, 0): major value to plot
  • title::String="": plot title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_erosMethod
plot_eros(s, f, t; <keyword arguments>)

Plot ERO (Event-Related Oscillations) spectrogram.

Arguments

  • s::AbstractArray: ERO spectrogram
  • f::AbstractVector: ERO frequencies
  • t::AbstractVector: ERO time
  • tm::Union{Int64, Vector{Int64}}=0: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time points
  • xlabel::String="default"
  • ylabel::String="default"
  • title::String="default"
  • cb::Bool=true: draw color bar
  • cb_title::String="Power [dB]": color bar title
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_eropMethod
plot_erop(p, f; <keyword arguments>)

Plot ERO (Event-Related Oscillations) power-spectrum.

Arguments

  • p::AbstractArray: ERO powers
  • f::AbstractVector: ERO frequencies
  • xlabel::String="default"
  • ylabel::String="default"
  • title::String="default"
  • mono::Bool=false: use color or grey palette
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_icatopoMethod
plot_icatopo(obj; <keyword arguments>)

Topographical plot of embedded ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_icatopoMethod
plot_icatopo(obj, ic, ic_mw; <keyword arguments>)

Topographical plot of external ICA components.

Arguments

  • obj::NeuroAnalyzer.NEURO: NeuroAnalyzer NEURO object
  • ic::Matrix{Float64}: components IC(1)..IC(n)
  • ic_mw::Matrix{Float64}: weighting matrix IC(1)..IC(n)
  • ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0: component(s) to plot, default is all components
  • seg::Tuple{Real, Real}=(0, 10): segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorter
  • cb::Bool=false: plot color bar
  • cb_label::String="[A.U.]": color bar label
  • amethod::Symbol=:mean: averaging method:
    • :mean
    • :median
  • imethod::Symbol=:sh: interpolation method:
    • :sh: Shepard
    • :mq: Multiquadratic
    • :imq: InverseMultiquadratic
    • :tp: ThinPlate
    • :nn: NearestNeighbour
    • :ga: Gaussian
  • nmethod::Symbol=:minmax: method for normalization, see normalize()
  • plot_contours::Bools=true: plot contours over topo plot
  • plot_electrodes::Bools=true: plot electrodes over topo plot
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_weightsMethod
plot_weights(locs; <keyword arguments>)

Plot weights at electrode positions.

Arguments

  • locs::DataFrame: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sph
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}: channel(s) to plot
  • selected::Union{Int64, Vector{Int64}, <:AbstractRange}=0: selected channel(s) to plot
  • weights::Vector{<:Real}=[]: weights vector
  • channel_labels::Bool=true: plot channel_labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • plot_size::Int64=400: plot dimensions in pixels (size × size)
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates

Returns

  • p::Plots.Plot{Plots.GRBackend}
NeuroAnalyzer.plot_weightsMethod
plot_weights(obj; <keyword arguments>)

Plot weights at electrode positions.

Arguments

  • obj::NeuroAnalyzer.NEURO
  • ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj): index of channels, default is all signal channels
  • weights::Matrix{<:Real}: matrix of weights
  • channel_labels::Bool=false: plot channel_labels
  • head_labels::Bool=true: plot head labels
  • mono::Bool=false: use color or grey palette
  • head_details::Bool=true: draw nose and ears
  • plot_size::Int64=800: plot dimensions in pixels (size × size)
  • title::String="": plot title
  • cart::Bool=false: if true, use Cartesian x and y coordinates, otherwise use polar radius and theta coordinates
  • kwargs: optional arguments for plot() function

Returns

  • p::Plots.Plot{Plots.GRBackend}

Statistics

NeuroAnalyzer.cmp_testMethod
cmp_test(seg1, seg2, paired, alpha, type, exact)

Compare two vectors; Kruskall-Wallis test is used first, next t-test (paired on non-paired) or non-parametric test (paired: Wilcoxon signed rank, non-paired: Mann-Whitney U test) is applied.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector
  • paired::Bool
  • alpha::Float64=0.05: confidence level
  • type::Symbol=:auto: choose test automatically (:auto), permutation-based (:perm) parametric (:p) or non-parametric (:np)
  • exact::Bool=false: if true, use exact Wilcoxon test
  • nperm::Int64=1000: number of permutation for :perm method

Returns

Named tuple containing for type !== :perm:

  • t: test results
  • ts::Tuple{Float64, String}: test statistics
  • tc::Tuple{Float64, Float64}: test statistics confidence interval
  • df::Int64: degrees of freedom
  • p::Float64: p-value

Named tuple containing for type === :perm:

  • t::Tuple{perm_diff::Vector{Float64}, obs_diff::Float64}: test results: (permutation difference, observed difference)
  • p1::Float64: one-sided p-value
  • p2::Float64: two-sided p-value
NeuroAnalyzer.cor_testMethod
cor_test(seg1, seg2)

Calculate correlation between two vectors.

Arguments

  • s1::AbstractVector
  • s2::AbstractVector

Returns

Named tuple containing:

  • t::CorrelationTest{Float64}
  • r::Float64: correlation coefficient
  • rc::Tuple{Float64, Float64}: correlation coefficient confidence interval
  • tt::Tuple{Float64, String}: t-statistics
  • df::Int64: degrees of freedom
  • p::Float64: p-value
NeuroAnalyzer.dprimeMethod
dprime(p1::Real, p2::Real)

Calculate d' and response bias for two proportions.

Arguments

  • p1::Real
  • p2::Real

Returns

Named tuple containing:

  • dprime::Float64
  • rb::Float64: response bias
NeuroAnalyzer.effsizeMethod
effsize(x1, x2)

Calculate Cohen's d and Hedges g effect sizes.

Arguments

  • x1::AbstractVector
  • x2::AbstractVector

Returns

Named tuple containing:

  • d::Float64: Cohen's d
  • g::Float64: Hedges g
NeuroAnalyzer.hildebrand_ruleMethod
hildebrand_rule(x)

Calculate Hildebrand rule for vector x. If H < 0.2 then the vector x is symmetrical.

Arguments

  • x::AbstractVector

Returns

  • h::Float64
NeuroAnalyzer.jaccard_similarityMethod
jaccard_similarity(x, y)

Calculate Jaccard similarity between two vectors x and y.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Returns

  • j::Float64
NeuroAnalyzer.linregMethod
linreg(x, y)

Linear regression between x and y.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Notes

To predict, use: `newx = DataFrame(x = [3.5, 7]); predict(lr, newx)

Returns

Named tuple containing:

  • lr::StatsModels.TableRegressionModel: model
  • radj::Flpoat64: R^2
  • c::Vector{Float64}: coefficients
  • se::Vector{Float64}: standard error for coefficients
  • aic::Float64:: Akaike’s Information Criterion (AIC)
  • bic::Float64:: Bayesian Information Criterion (BIC)
  • lf::Vector{Float64}: linear fit (plot(x, lf))
NeuroAnalyzer.infcritMethod
infcrit(m)

Calculate Akaike’s Information Criterion (AIC) and Bayesian Information Criterion (BIC) for a linear regression model m.

Arguments

  • m::StatsModels.TableRegressionModel: linear regression model

Returns

Named tuple containing:

  • aic::Float64
  • bic::Float64
NeuroAnalyzer.meangMethod
meang(x)

Calculate geometric mean.

Arguments

  • x::AbstractVector

Returns

  • m::Float64
NeuroAnalyzer.meanhMethod
meanh(x)

Calculate harmonic mean.

Arguments

  • x::AbstractVector

Returns

  • m::Float64
NeuroAnalyzer.meanwMethod
meanw(x, w)

Calculate weighted mean.

Arguments

  • x::AbstractVector
  • w::AbstractVector: weights

Returns

  • m::Float64
NeuroAnalyzer.meancMethod
meanc(x; rad)

Calculate circular mean.

Arguments

  • x::AbstractVector: angles
  • rad::Bool=false: angles in radians (rad=true) or degrees (rad=false)

Returns

  • m::Float64
NeuroAnalyzer.z_scoreMethod
z_score(x)

Calculate Z-scores for each value of the vector x.

Arguments

  • x::AbstractVector

Returns

  • z_score::Vector{Float64}
NeuroAnalyzer.k_categoriesMethod
k_categories(n)

Calculate number of categories for a given sample size n.

Arguments

  • n::Int64

Returns

Named tuple containing:

  • k1::Float64: sqrt(n)
  • k2::Float64: 1 + 3.222 * log10(n)
NeuroAnalyzer.seMethod
se(x)

Calculate standard error.

Arguments

  • x::AbstractVector

Returns

  • se::Float64
NeuroAnalyzer.rngMethod
rng(x)

Calculate range.

Arguments

  • x::AbstractVector

Returns

  • rng::Float64
NeuroAnalyzer.rngMethod
rng(x)

Calculate range.

Arguments

  • x::AbstractArray

Returns

  • rng::Float64
NeuroAnalyzer.moeMethod
moe(n)

Calculate margin of error for given sample size n.

Arguments

  • n::Int64

Returns

  • moe::Float64
NeuroAnalyzer.cvarMethod
cvar(se, s)

Calculate coefficient of variation for statistic s.

Arguments

  • se::Real: standard error
  • s::Real: statistics, e.g. mean value

Returns

  • cvar::Float64
NeuroAnalyzer.effsizeMethod
effsize(p1, p2)

Calculate effect size for two proportions p1 and p2.

Arguments

  • p1::Float64: 1st proportion, e.g. 0.7
  • p2::Float64: 2nd proportion, e.g. 0.3

Returns

  • e::Float64
NeuroAnalyzer.binom_probMethod
binom_prob(p, r, n)

Calculate probability of exactly r successes in n trials.

Arguments

  • p::Float64: proportion of successes
  • r::Int64: number of successes
  • n::Int64: number of trials

Returns

  • binom_prob::Float64: probability
NeuroAnalyzer.binom_statMethod
binom_stat(p, n)

Calculate mean and standard deviation for probability p.

Arguments

  • p::Float64: proportion of successes
  • n::Int64: number of trials

Returns

Named tuple containing:

  • m::Float64: mean
  • s::Float64: standard deviation
NeuroAnalyzer.cvar_meanMethod
cvar_mean(x)

Calculate coefficient of variation for a mean.

Arguments

  • x::AbstractVector

Returns

  • cvar_mean::Float64
NeuroAnalyzer.cvar_medianMethod
cvar_median(x)

Calculate coefficient of variation for a median.

Arguments

  • x::AbstractVector

Returns

  • cvar_median::Float64
NeuroAnalyzer.mccMethod
mcc(tp, tn, fp, fn)

Assess performance of the classification model using Matthews correlation coefficient (MCC).

MCC’s value ranges from -1 to 1, depending on:

  • a score of -1 denotes a complete discrepancy between expected and actual classes
  • 0 is equivalent to making an entirely arbitrary guess
  • total agreement between expected and actual classes is indicated by a score of 1

Arguments

  • tp::Int64: number of true positives
  • tn::Int64: number of true negatives
  • fp::Int64: number of false positives
  • fn::Int64: number of false negatives

Returns

  • mcc::Float64

Source

https://finnstats.com/index.php/2022/09/06/assess-performance-of-the-classification-model/

NeuroAnalyzer.norminvMethod
norminv(x::Real)

Convert probability to a normal distribution with a peak at 0.5.

Arguments

  • x::Real

Returns

  • norminv::Float64
NeuroAnalyzer.outlier_detectMethod
outlier_detect(x; method)

Detect outliers.

Arguments

  • x::AbstractVector
  • method::Symbol=iqr: detecting methods:
    • :iqr: interquartile range
    • :z: z-score
    • :g: Grubbs test

Returns

  • o::Vector{Bool}: index of outliers
NeuroAnalyzer.grubbsMethod
grubbs(x; alpha, t)

Perform Grubbs test for outlier.

Arguments

  • x::AbstractVector
  • alpha::Float64=0.95
  • t::Int64=0: test type:
    • -1: test whether the minimum value is an outlier
    • 0: two-sided test
    • 1: test whether the maximum value is an outlier

Returns

  • g::Bool: true: outlier exists, false: there is no outlier
NeuroAnalyzer.pred_intMethod
pred_int(n)

Calculates the prediction interval (95% CI adjusted for sample size)

Arguments

  • n::Int64: sample size

Returns

  • pred_int::Float64
NeuroAnalyzer.prankMethod
prank(x)

Calculate percentile rank.

Arguments

  • x::AbstractVector: the vector to analyze

Returns

  • p::Vector{Float64}: percentile ranks
NeuroAnalyzer.dranksFunction
dranks(x, nbins)

Calculate ranks scaled in 0..nbins.

Arguments

  • x::AbstractArray: some continuous variable such as reaction time (the time it takes to indicate the response)
  • nbins::Int64: number of bins, default is Sturges' formula

Returns

  • caf::Array{Float64}
NeuroAnalyzer.res_normFunction
res_norm(x, g)

Test normal distribution of residuals.

Arguments

  • x::AbstractVector: data values
  • g::Vector{Int64}: group(s) to which each data value belongs

Returns

Named tuple containing:

  • adt_p::Vector{Float64}: p-values for k-sample Anderson–Darling test vs normal distribution
  • ks_p::Vector{Float64}: p-values for one-sample exact Kolmogorov–Smirnov test vs normal distribution

Notes

p-values are reported for each group and for the whole sample. If there is only one group, p-values are returned only for the whole sample p-values are reported.

NeuroAnalyzer.seg_meanMethod
seg_mean(seg)

Calculate mean of a segment (e.g. spectrogram).

Arguments

  • seg::AbstractArray

Returns

  • seg_mean::Vector{Float64}: averaged segment
NeuroAnalyzer.seg_meanMethod
seg2_mean(seg1, seg2)

Calculate mean of two segments (e.g. spectrograms).

Arguments

  • seg1::AbstractArray
  • seg2::AbstractArray

Returns

Named tuple containing:

  • seg1::Vector{Float64}: averaged segment 1
  • seg2::Vector{Float64}: averaged segment 2
NeuroAnalyzer.sem_diffMethod
sem_diff(x::AbstractVector, y::AbstractVector)

Calculate SEM (standard error of the mean) for the difference of two means.

Arguments

  • x::AbstractVector
  • y::AbstractVector

Returns

  • sem_diff::Float64

Study

NeuroAnalyzer.create_studyMethod
study(obj, group)

Create NeuroAnalyzer STUDY object.

Arguments

  • obj::Vector{NeuroAnalyzer.NEURO}
  • group::Vector{Symbol}

Returns

  • study::NeuroAnalyzer.STUDY
NeuroAnalyzer.obj_nMethod
obj_n(study)

Return number of NeuroAnalyzer NEURO objects in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
NeuroAnalyzer.channel_nMethod
channel_n(study)

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

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
NeuroAnalyzer.epoch_nMethod
epoch_n(study)

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

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • n::Int64
NeuroAnalyzer.epoch_lenMethod
epoch_len(study)

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

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • len::Int64
NeuroAnalyzer.srMethod
sr(study)

Return sampling rate of NeuroAnalyzer NEURO objects in the study.

Arguments

  • study::NeuroAnalyzer.STUDY

Returns

  • sr::Int64

NIBS

NeuroAnalyzer.ect_chargeMethod
ect_charge(; pw, pint, pf, duration)

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.tes_doseMethod
tes_dose(current, pad_area, duration)

Convert current, pad_area and stimulation duration into charge, current_density and charge_ density.

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_protocolMethod
tes_protocol(; <keyword arguments>)

Create TES (tDCS/tACS/tRNS/tPCS) protocol.

Arguments

  • type::Symbol: stimulation type (:tDCS, :tACS, :tRNS, :tPCS)
  • hd::Bool: protocol includes HD electrodes
  • current::Real: stimulation current [mA]
  • frequency::Real=0: stimulation frequency [mA]
  • anode_size::Tuple{Int64, Int64}: anode dimensions [mm]
  • cathode_size::Tuple{Int64, Int64}: cathode dimensions [mm]
  • anode_loc::Symbol: anode location (according to 10-20 Positioning System)
  • cathode_loc::Symbol: cathode location (according to 10-20 Positioning System)
  • duration::Real: stimulation duration [s]
  • ramp_in::Real: stimulation duration [s]
  • ramp_out::Real: stimulation duration [s]
  • sham::Bool: protocol includes sham stimulations

Returns

  • protocol::Dict
NeuroAnalyzer.tes_modelMethod
tes_model(; anode, cathode, anode_curr, cathode_curr)

Create model of TES stimulation.

Arguments

  • anode::String: anode location
  • cathode::String: cathode location
  • anode_curr::Real=2.0: anode current [mA]
  • cathode_curr::Real=-2.0: cathode current [mA]

Returns

  • p::Plots.Plot{Plots.GRBackend}

Notes

This is a very initial version, simplified model – just superficial spread of the electric field

To do

Model spread of electric field at the cortical surface – reduce charge for skull resistance