364 KiB
NeuroAnalyzer.jl documentation
This documentation has been generated using Documenter.jl.
NeuroAnalyzer
#
NeuroAnalyzer.na_info
— Method.
na_info()
Show NeuroAnalyzer and imported packages versions.
#
NeuroAnalyzer.na_plugins_reload
— Method.
na_plugins_reload()
Reload NeuroAnalyzer plugins.
#
NeuroAnalyzer.na_plugins_list
— Method.
na_plugins_list()
List NeuroAnalyzer plugins.
#
NeuroAnalyzer.na_plugins_remove
— Method.
na_plugins_remove(plugin)
Remove NeuroAnalyzer plugin
.
Arguments
plugin::String
: plugin name
#
NeuroAnalyzer.na_plugins_install
— Method.
na_plugins_install(plugin)
Install NeuroAnalyzer plugin
.
Arguments
plugin::String
: plugin Git repository URL
#
NeuroAnalyzer.na_plugins_update
— Function.
na_plugins_update(plugin)
Install NeuroAnalyzer plugin
.
Arguments
plugin::String
: plugin to update; if empty, update all
#
NeuroAnalyzer.na_set_use_cuda
— Method.
na_set_use_cuda(use_cuda)
Change use_cuda
preference.
Arguments
use_cuda::Bool
: value
#
NeuroAnalyzer.na_set_progress_bar
— Method.
na_set_progress_bar(progress_bar)
Change progress_bar
preference.
Arguments
progress_bar::Bool
: value
#
NeuroAnalyzer.na_set_prefs
— Method.
na_set_prefs(use_cuda, plugins_path, progress_bar, verbose)
Save NeuroAnalyzer preferences.
Arguments
use_cuda::Bool
progress_bar::Bool
verbose::Bool
#
NeuroAnalyzer.na_set_verbose
— Method.
na_set_verbose(verbose)
Change verbose
preference.
Arguments
verbose::Bool
: value
#
NeuroAnalyzer.na_version
— Method.
na_version()
Convert NeuroAnalyzer version to string.
Returns
na_ver::String
Utils
#
NeuroAnalyzer.apply
— Method.
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 channelsf::String
: function to be applied, e.g.f="mean(obj, dims=3)"; OBJ signal is given using variable
obj` here.
Returns
out::Array{Float64, 3}
#
NeuroAnalyzer.l1
— Method.
l1(a1, a2)
Compare two arrays (e.g. two spectrograms), using L1 (Manhattan) distance.
Arguments
a1::AbstractArray
: first arraya2::AbstractArray
: second array
Returns
l1::Float64
#
NeuroAnalyzer.l2
— Method.
l2(a1, a2)
Compare two arrays (e.g. two spectrograms), using L2 (Euclidean) distance.
Arguments
a1::AbstractArray
: first arraya2::AbstractArray
: second array
Returns
l2::Float64
#
NeuroAnalyzer.perm_cmp
— Method.
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 arraya2::Array{<:Real, 3}
: second arrayp::Float64=0.05
: p-valueperm_n::Int64=1000
: number of permutations
Returns
Named tuple containing:
zmap::Array{Float64, 3}
: array of Z-valuesbm::Array{Float64, 3}
: binarized mask of statistically significant positions
#
NeuroAnalyzer.component_type
— Method.
component_type(obj, c)
Return component data type.
Arguments
obj::NeuroAnalyzer.NEURO
c::Symbol
: component name
Return
c_type::DataType
#
NeuroAnalyzer.rename_component
— Method.
rename_component(obj, c_old, c_new)
Rename component.
Arguments
obj::NeuroAnalyzer.NEURO
c_old::Symbol
: old component namec_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 namec_new::Symbol
: new component name
#
NeuroAnalyzer.add_component
— Method.
add_component(obj; c, v)
Add component.
Arguments
obj::NeuroAnalyzer.NEURO
c::Symbol
: component namev::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 namev::Any
: component value
#
NeuroAnalyzer.list_component
— Method.
list_component(obj)
List component names.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
components::Vector{Symbol}
#
NeuroAnalyzer.extract_component
— Method.
extract_component(obj, c)
Extract component values.
Arguments
obj::NeuroAnalyzer.NEURO
c::Symbol
: component name
Returns
c::Any
#
NeuroAnalyzer.delete_component
— Method.
delete_component(obj; c)
Delete component.
Arguments
obj::NeuroAnalyzer.NEURO
c::Symbol
: component name
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.delete_component!
— Method.
delete_component!(obj; c)
Delete component.
Arguments
obj::NeuroAnalyzer.NEURO
c::Symbol
: component name
#
NeuroAnalyzer.reset_components
— Method.
reset_components(obj)
Remove all components.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
obj_new::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.reset_components!
— Method.
reset_components!(obj)
Remove all components.
Arguments
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.fft0
— Function.
fft0(x, n)
Zeros-padded FFT.
Arguments
x::AbstractVector
n::Int64
: number of zeros to add
Returns
fft0::Vector{ComplexF64}
#
NeuroAnalyzer.ifft0
— Function.
ifft0(x, n)
IFFT of zero-padded vector.
Arguments
x::AbstractVector
n::Int64
: number of zeros added tox
Returns
ifft0::Vector{Float64}
: real part of the signal trimmed to original length
#
NeuroAnalyzer.fft2
— Method.
fft2(x)
Zeros-padded FFT, so the length of padded vector is a power of 2.
Arguments
x::AbstractVector
Returns
fft2::Vector{ComplexF64}
#
NeuroAnalyzer.nextpow2
— Method.
nextpow2(x)
Return the next power of 2 for given number x
.
Argument
x::Int64
Returns
nextpow2::Int64
#
NeuroAnalyzer.dft
— Method.
dft(signal; fs, pad)
Return FFT and DFT sample frequencies for a DFT.
Arguments
signal::AbstractVector
fs::Int64
: sampling ratepad::Int64=0
: number of zeros to add
Returns
Named tuple containing:
ft::Vector{ComplexF64}
: FFTf::Vector{Float64}
: sample frequencies
#
NeuroAnalyzer.dft
— Method.
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 channelspad::Int64=0
: number of zeros to add signal for FFT
Returns
Named tuple containing:
ft::Array{ComplexF64, 3}
: FFTf::Vector{Float64}
: sample frequencies
#
NeuroAnalyzer.findpeaks
— Method.
findpeaks(signal; d)
Find peaks.
Arguments
signal::AbstractVector
d::Int64=32
: distance between peeks in samples
Returns
p_idx::Vector{Int64}
#
NeuroAnalyzer.hz2rads
— Method.
hz2rads(f)
Convert frequency f
in Hz to rad/s.
Arguments
f::Real
Returns
f_rads::Float64
#
NeuroAnalyzer.rads2hz
— Method.
rads2hz(f)
Convert frequency f
in rad/s to Hz.
Arguments
f::Real
Returns
f_rads::Float64
#
NeuroAnalyzer.t2f
— Method.
t2f(t)
Convert cycle length in ms to frequency.
Arguments
t::Real
: cycle length in ms
Returns
f::Float64
: frequency in Hz
#
NeuroAnalyzer.f2t
— Method.
f2t(f)
Convert frequency to cycle length in ms.
Arguments
f::Real
: frequency in Hz
Returns
f::Float64
: cycle length in ms
#
NeuroAnalyzer.freqs
— Method.
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.freqs
— Method.
freqs(s, fs)
Return vector of frequencies and Nyquist frequency for signal.
Arguments
s::Vector{Float64}
fs::Int64
Returns
hz::Vector{Float64
: signal vectornf::Float64
#
NeuroAnalyzer.freqs
— Method.
freqs(obj)
Return vector of frequencies and Nyquist frequency.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
hz::Vector{Float64}
nf::Float64
#
NeuroAnalyzer.generate_window
— Method.
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_sine
— Function.
generate_sine(f, t, a, p)
Generates sine wave.
Arguments
f::Real
: frequency [Hz]t::Union{AbstractVector, AbstractRange}
: time vectora::Real
: amplitudep::Real
: initial phase
Returns
- s::Vector{Float64}`
#
NeuroAnalyzer.generate_csine
— Function.
generate_csine(f, t, a)
Generates complex sine wave.
Arguments
f::Real
: frequency [Hz]t::Union{AbstractVector, AbstractRange}
: time vectora::Real
: amplitude
Returns
- cs::Vector{ComplexF64}`
#
NeuroAnalyzer.generate_sinc
— Function.
generate_sinc(t, f, peak, norm)
Generate sinc function.
Arguments
t::AbstractRange=-2:0.01:2
: timef::Real=10.0
: frequencypeak::Real=0
: sinc peak timenorm::Bool=true
: generate normalized function
Returns
s::Vector{Float64}
#
NeuroAnalyzer.generate_morlet
— Function.
generate_morlet(fs, f, t; ncyc, complex)
Generate Morlet wavelet.
Arguments
fs::Int64
: sampling ratef::Real
: frequencyt::Real=1
: length = -t:1/fs:tncyc::Int64=5
: number of cyclescomplex::Bool=false
: generate complex Morlet
Returns
morlet::Union{Vector{Float64}, Vector{ComplexF64}}
#
NeuroAnalyzer.generate_gaussian
— Function.
generate_gaussian(fs, f, t; ncyc, a)
Generate Gaussian wave.
Arguments
fs::Int64
: sampling ratef::Real
: frequencyt::Real=1
: length = -t:1/fs:tncyc::Int64
: : number of cycles, width, SD of the Gaussiana::Real=1
: peak amp
Returns
g::Vector{Float64}
#
NeuroAnalyzer.generate_noise
— Function.
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_fwhm
— Function.
generate_morlet_fwhm(fs, f, t; h)
Generate Morlet wavelet using Mike X Cohen formula.
Arguments
fs::Int64
: sampling ratef::Real
: frequencyt::Real=1
: length = -t:1/fs:th::Float64=0.25
: full width at half-maximum in seconds (FWHM)
Returns
mw::Vector{ComplexF64}
Source
Cohen MX. A better way to define and describe Morlet wavelets for time-frequency analysis. NeuroImage. 2019 Oct;199:81–6.
#
NeuroAnalyzer.sr
— Method.
sr(obj)
Return sampling rate.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
sr::Int64
#
NeuroAnalyzer.channel_n
— Method.
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
channel_n::Int64
#
NeuroAnalyzer.epoch_n
— Method.
epoch_n(obj)
Return number of epochs.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
epoch_n::Int64
#
NeuroAnalyzer.signal_len
— Method.
signal_len(obj)
Return signal length.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
s_len::Int64
#
NeuroAnalyzer.epoch_len
— Method.
epoch_len(obj)
Return epoch length.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
ep_len::Int64
#
NeuroAnalyzer.history
— Method.
history(obj)
Show processing history.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
history::Vector{String}
#
NeuroAnalyzer.labels
— Method.
labels(obj)
Return channel labels.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
labels::Vector{String}
#
NeuroAnalyzer.info
— Method.
info(obj)
Show info.
Arguments
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.channel_cluster
— Method.
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_frq
— Method.
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_frq
— Method.
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.describe
— Method.
describe(obj)
Return basic descriptive statistics of obj.data
.
Arguments
obj::NeuroAnalyzer.NEURO
#
Base.size
— Method.
size(obj)
Return size of the obj
data.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
size::Tuple{Int64, Int64, Int64}
#
NeuroAnalyzer.m_pad0
— Method.
m_pad0(m)
Pad matrix with zeros to make it square.
Arguments
m::Matrix{<:Number}
Returns
m::Matrix{<:Number}
#
NeuroAnalyzer.m_sortperm
— Method.
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_sort
— Method.
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_norm
— Method.
m_norm(m)
Normalize matrix.
Arguments
m::AbstractArray
Returns
m_norm::AbstractArray
#
NeuroAnalyzer.linspace
— Method.
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.logspace
— Method.
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.cmax
— Method.
cmax(x)
Return maximum value of the complex vector.
Arguments
x::Vector{ComplexF64}
Returns
cmax::ComplexF64
#
NeuroAnalyzer.cmin
— Method.
cmin(x)
Return minimum value of the complex vector.
Arguments
x::Vector{ComplexF64}
Returns
cmin::ComplexF64
#
NeuroAnalyzer.tuple_order
— Function.
tuple_order(t, rev)
Order tuple elements in ascending or descending (rev=true
) order.
Arguments
t::Tuple{Real, Real}
rev::Bool=false
Returns
t::Tuple{Real, Real}
#
NeuroAnalyzer.cums
— Method.
cums(signal)
Calculate cumulative sum.
Arguments
signal::Array{<:Real, 3}
Returns
signal_cs::Array{Float64, 3}
#
NeuroAnalyzer.f_nearest
— Method.
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.view_note
— Method.
view_note(obj)
Return recording note.
Arguments
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.add_note
— Method.
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_note
— Method.
delete_note(obj)
Delete recording note.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.delete_note!
— Method.
delete_note!(obj)
Delete recording note.
Arguments
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.pad0
— Method.
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.pad2
— Method.
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.phases
— Function.
phases(s; pad)
Calculate phases.
Arguments
s::AbstractVector
pad::Int64=0
: number of zeros to add
Returns
phases::Vector{Float64}
#
NeuroAnalyzer.pick
— Method.
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.t2s
— Method.
t2s(t, fs)
Convert time to sample number.
Arguments
t::T
: time in sfs::Int64
: sampling rate
Returns
t2s::Int64
: sample number
#
NeuroAnalyzer.s2t
— Method.
s2t(s, fs)
Convert sample number to time.
Arguments
t::Int64
: sample numberfs::Int64
: sampling rate
Returns
s2t::Float64
: time in s
#
NeuroAnalyzer.t2s
— Method.
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.s2t
— Method.
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_df
— Method.
to_df(obj)
Export OBJ data to DataFrame.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
df::DataFrame
: DataFrame containing time points and channels
#
NeuroAnalyzer.vsearch
— Method.
vsearch(y, x; acc)
Return the positions of the y
value in the vector x
.
Arguments
y::T
: value of interestx::AbstractVector
: vector to search withinacc::Bool=false
: if true, return the difference betweeny
andx[idx]
Returns
idx::Int64
d::Real
: the difference betweeny
andx[idx]
#
NeuroAnalyzer.vsearch
— Method.
vsearch(y, x; acc)
Return the positions of the y
vector in the vector x
.
Arguments
y::AbstractVector
: vector of interestx::AbstractVector
: vector to search withinacc::Bool=false
: if true, return the difference betweeny
andx[idx:idx + length(y)]
Returns
idx::Int64
d::Real
: the difference betweeny
andx[idx:idx + length(y)]
#
NeuroAnalyzer.vsplit
— Function.
vsplit(x, n)
Splits the vector x
into n
-long pieces.
Argument
x::AbstractVector
n::Int64
Returns
x::Vector{AbstractVector}
#
NeuroAnalyzer.view_header
— Method.
header(obj)
Show keys and values of OBJ header.
Arguments
obj::NeuroAnalyzer.NEURO
IO
#
NeuroAnalyzer.export_csv
— Method.
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 headerepoch_time::Bool=false
: export epoch time pointscomponents::Bool=false
: export componentsmarkers::Bool=false
: export event markerslocs::Bool=false
: export channel locationshistory::Bool=false
: export historyoverwrite::Bool=false
#
NeuroAnalyzer.export_locs
— Method.
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_locs
— Method.
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_markers
— Method.
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_recording
— Method.
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)
- 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|.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 loaddetect_type::Bool=true
: detect channel type based on channel labeln::Int64=0
: subject number to extract in case of multi-subject file
Returns
::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.import_alice4
— Method.
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 loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Notes
- EDF files exported from Alice 4 have incorrect value of
data_records
(-1) and multiple sampling rate; channels are upsampled to the highest rate.
#
NeuroAnalyzer.import_bdf
— Method.
import_bdf(file_name; default_type)
Load BDF/BDF+ file and return NeuroAnalyzer.NEURO
object.
Arguments
file_name::String
: name of the file to loaddetect_type::Bool=true
: detect channel type based on channel label
Returns
obj::NeuroAnalyzer.NEURO
Notes
- sampling_rate = n.samples ÷ data.record.duration
- gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
- value = (value - digital minimum ) × gain + physical minimum
Source
https://www.biosemi.com/faq/file_format.htm
#
NeuroAnalyzer.import_bv
— Method.
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_csv
— Method.
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 loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Notes
CSV first row or first column must contain channel names. Shape of data array will be detected automatically. Sampling rate will be detected. If file is gzip-ed, it will be uncompressed automatically while reading.
#
NeuroAnalyzer.import_digitrack
— Method.
import_digitrack(file_name; detect_type)
Load Digitrack ASCII file and return NeuroAnalyzer.NEURO
object.
Arguments
file_name::String
: name of the file to loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.import_edf
— Method.
import_edf(file_name; detect_type)
Load EDF/EDF+ file and return NeuroAnalyzer.NEURO
object.
Arguments
file_name::String
: name of the file to loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Notes
- sampling_rate = n.samples ÷ data.record.duration
- gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
- value = (value - digital minimum ) × gain + physical minimum
Source
- Kemp B, Varri A, Rosa AC, Nielsen KD, Gade J. A simple format for exchange of digitized polygraphic recordings. Electroencephalography and Clinical Neurophysiology. 1992 May;82(5):391–3.
- Kemp B, Olivan J. European data format ‘plus’(EDF+), an EDF alike standard format for the exchange of physiological data. Clinical Neurophysiology 2003;114:1755–61.
- https://www.edfplus.info/specs/
#
NeuroAnalyzer.import_edf_annotations
— Method.
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_fiff
— Method.
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 loaddetect_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_gdf
— Method.
import_gdf(file_name; detect_type)
Load GDF file and return NeuroAnalyzer.NEURO
object.
Arguments
file_name::String
: name of the file to loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
Notes
- sampling_rate = n.samples ÷ data.record.duration
- gain = (physical maximum - physical minimum) ÷ (digital maximum - digital minimum)
- value = (value - digital minimum ) × gain + physical minimum
Source
- Schlögl A, Filz O, Ramoser H, Pfurtscheller G. GDF - A General Dataformat for Biosignals Version 1.25. 1998
- Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.12. 2009
- Schlögl, A. GDF - A General Dataformat for Biosignals Version 2.51. 2013
#
NeuroAnalyzer.import_locs
— Method.
import_locs(file_name)
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
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_ced
— Method.
import_locs_ced(file_name)
Load channel locations from CED file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_locs
— Method.
import_locs_locs(file_name)
Load channel locations from LOCS file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_elc
— Method.
import_locs_elc(file_name)
Load channel locations from ELC file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_tsv
— Method.
import_locs_tsv(file_name)
Load channel locations from TSV file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_sfp
— Method.
import_locs_sfp(file_name)
Load channel locations from SFP file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_csd
— Method.
import_locs_csd(file_name)
Load channel locations from CSD file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_geo
— Method.
import_locs_geo(file_name)
Load channel locations from GEO file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_locs_mat
— Method.
import_locs_mat(file_name)
Load channel locations from MAT file.
Arguments
file_name::String
Returns
locs::DataFrame
#
NeuroAnalyzer.import_nirs
— Method.
import_nirs(file_name)
Load NIRS file and return NeuroAnalyzer.NEURO
object.
Arguments
file_name::String
: name of the file to load
Returns
obj::NeuroAnalyzer.NEURO
Source
https://github.com/BUNPC/Homer3/wiki/HOMER3-file-formats
#
NeuroAnalyzer.import_nirx
— Method.
import_nirx(file_name)
Load Shared Near Infrared Spectroscopy Format (SNIRF) 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
#
NeuroAnalyzer.import_set
— Method.
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 loaddetect_type::Bool=true
: detect channel type based on its label
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.import_snirf
— Method.
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 loadn::Int64=0
: subject number to extract in case of multi-subject file
Returns
obj::NeuroAnalyzer.NEURO
Source
https://github.com/fNIRS/snirf/blob/v1.1/snirf_specification.md
#
NeuroAnalyzer.load_locs
— Method.
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 angleloc_radius
: planar polar radiusloc_x
: spherical Cartesian xloc_y
: spherical Cartesian yloc_z
: spherical Cartesian zloc_radius_sph
: spherical radiusloc_theta_sph
: spherical horizontal angleloc_phi_sph
: spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEURO
file_name::String
: name of the file to loadmaximize::Bool=true
: maximize locations after importing
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.load_locs!
— Method.
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 angleloc_radius
planar polar radiusloc_x
spherical Cartesian xloc_y
spherical Cartesian yloc_z
spherical Cartesian zloc_radius_sph
spherical radiusloc_theta_sph
spherical horizontal angleloc_phi_sph
spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEURO
file_name::String
maximize::Bool=true
: maximize locations after importing
#
NeuroAnalyzer.save
— Method.
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 tooverwrite::Bool=false
#
NeuroAnalyzer.load
— Method.
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_channels
— Method.
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_bytype
— Method.
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_bywl
— Method.
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_type
— Method.
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_channel
— Method.
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_channel
— Method.
rename_channel(obj; ch, name)
Rename channel.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, String}
: channel number or namename::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 namename::String
: new name
#
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
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_channel
— Method.
replace_channel(obj; ch, s)
Replace channel.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, String}
: channel number or names::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 names::Array{Float64, 3}
: signal to replace with
#
NeuroAnalyzer.add_labels
— Method.
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_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) datalabel::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) datalabel::Union{String, Vector{String}}=string.(_c(size(data, 1)))
: channel(s) label(s)type::Union{Symbol, Vector{Symbol}}
: channel(s) type(s)
#
NeuroAnalyzer.create
— Method.
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_time
— Method.
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_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
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_channel
— Method.
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_type
— Method.
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_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
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_epoch
— Method.
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_bad
— Method.
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 withinw
-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: abovemean + p * std
and belowmean - p * std
, here p (as percentile) will be converted to z-score (0.9 (90th percentile): 1.282, 0.95 (95th percentile): 1.645, 0.975 (97.5th percentile): 1.960, 0.99 (99th percentile): 2.326) -
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 × epochsbe::Vector{Int64}
: list of bad epochs
#
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 atoffset::Real=0
: time offset (in seconds) for marker-based epoching (each epoch time will start atmarker time - offset
)ep_n::Union{Int64, Nothing}=nothing
: number of epochsep_len::Union{Real, Nothing}=nothing
: epoch length in seconds
Returns
obj::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 atoffset::Real=0
: time offset (in seconds) for marker-based epoching (each epoch time will start atmarker time - offset
)ep_n::Union{Int64, Nothing}=nothing
: number of epochsep_len::Union{Real, Nothing}=nothing
: epoch length in seconds
#
NeuroAnalyzer.epoch_ts
— Method.
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_channel
— Method.
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_epoch
— Method.
extract_epoch(obj; ep)
Extract epoch.
Arguments
obj::NeuroAnalyzer.NEURO
ep::Int64
: epoch index
Returns
obj_new::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.extract_epoch!
— Method.
extract_epoch!(obj; ep)
Extract epoch.
Arguments
obj::NeuroAnalyzer.NEURO
ep::Int64
: epoch index
#
NeuroAnalyzer.extract_data
— Method.
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 channelsep::Union{Int64, Vector{Int64}, <:AbstractRange}=1:epoch_n(obj)
: index of epochs, default is all epochstime::Bool=false
: return time vectoretime::Bool=false
: return epoch time vector
Returns
signal::Array{Float64, 3}
time::Vector{Float64}
etime::Vector{Float64}
#
NeuroAnalyzer.extract_time
— Method.
extract_time(obj)
Extract time.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
tpts::Array{Float64, 3}
#
NeuroAnalyzer.extract_eptime
— Method.
extract_eptime(obj)
Extract epochs time.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
et::Array{Float64, 3}
#
NeuroAnalyzer.join
— Method.
join(obj1, obj2)
Join two NeuroAnalyzer objects. Both objects must have the same data type, number of channels, epochs and sampling rate.
Arguments
obj1::NeuroAnalyzer.NEURO
obj2::NeuroAnalyzer.NEURO
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.join!
— Method.
join!(obj1, obj2)
Join two NeuroAnalyzer objects. Both objects must have the same data type, number of channels, epochs and sampling rate.
Arguments
obj1::NeuroAnalyzer.NEURO
obj2::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.view_marker
— Method.
view_marker(obj)
Show markers.
Arguments
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.delete_marker
— Method.
delete_marker(obj; n)
Delete marker.
Arguments
obj::NeuroAnalyzer.NEURO
n::Int64
: marker number
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.delete_marker!
— Method.
delete_marker!(obj; n)
Delete marker.
Arguments
obj::NeuroAnalyzer.NEURO
n::Int64
: marker number
#
NeuroAnalyzer.add_marker
— Method.
add_marker(obj; id, start, len, desc, ch)
Add marker.
Arguments
obj::NeuroAnalyzer.NEURO
id::String
: marker IDstart::Real
: marker time in secondslen::Real=1.0
: marker length in secondsdesc::String
: marker descriptionch::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 IDstart::Real
: marker time in secondslen::Real=1.0
: marker length in secondsdesc::String
: marker descriptionch::Int64=0
: channel number, if 0 then marker is related to all channels
#
NeuroAnalyzer.edit_marker
— Method.
edit_marker(obj; n, id, start, len, desc)
Edit marker.
Arguments
obj::NeuroAnalyzer.NEURO
n::Int64
: marker numberid::String
: marker IDstart::Real
: marker time in secondslen::Real=1.0
: marker length in secondsdesc::String
: marker descriptionch::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 numberid::String
: marker IDstart::Real
: marker time in secondslen::Real=1
: marker length in secondsdesc::String
: marker descriptionch::Int64
: channel number, if 0 then marker is related to all channels
#
NeuroAnalyzer.channel2marker
— Method.
channel2marker(obj; ch, v, id, desc)
Convert event channel to markers.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Int64
: event channel numberv::Real=1.0
: event channel value interpreted as an eventid::String
: prefix for marker ID; default is based on event channel name (e.g. "stim1_")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 numberv::Real=1.0
: event channel value interpreted as an eventid::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.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
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.chop
— Method.
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.trim
— Method.
trim(s; seg, inverse)
Remove segment from the signal.
Arguments
v::AbstractVector
seg::Tuple{Int64, Int64}
: segment (from, to) in samplesinverse::Bool=false
: if true, keep the segment
Returns
trim::Vector{Float64}
#
NeuroAnalyzer.trim
— Method.
trim(m; seg, inverse)
Remove segment from the signal.
Arguments
m::AbstractMatrix
seg::Tuple{Int64, Int64}
: segment (from, to) in samplesinverse::Bool=false
: if true, keep the segment
Returns
trim::Array{Float64}
#
NeuroAnalyzer.trim
— Method.
trim(a; seg, inverse)
Remove segment from the signal.
Arguments
a::AbstractArray
seg::Tuple{Int64, Int64}
: segment (from, to) in samplesinverse::Bool=false
: if true, keep the segment
Returns
trim::Array{Float64}
#
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 secondsinverse::Bool=false
: if true, keep the segmentremove_epochs::Bool=true
: if true, remove epochs containing signal to trim or remove signal and re-epoch trimmed signal
Returns
obj::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 secondsinverse::Bool=false
: if true, keep the segmentremove_epochs::Bool=true
: if true, remove epochs containing signal to trim or remove signal and re-epoch trimmed signal
#
NeuroAnalyzer.vch
— Method.
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_signal
— Method.
add_signal(s1, s2)
Add signal.
Arguments
s1::AbstractVector
: target signals2::AbstractVector
: signal to be added
Returns
s_noisy::AbstractVector
#
NeuroAnalyzer.add_signal
— Method.
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 channelss::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 channelss::AbstractVector
: signal to be added to each channel
#
NeuroAnalyzer.average
— Method.
average(s)
Average all channels.
Arguments
s::AbstractArray
Returns
average::AbstractArray
#
NeuroAnalyzer.average
— Method.
average(s1, s2)
Averages two signals.
Arguments
s1::AbstractArray
s2::AbstractArray
Returns
average::Vector{Float64}
#
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
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.average
— Method.
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.bpsplit
— Method.
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 channelsorder::Int64=8
: number of taps for FIR band-pass filterwindow::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 signalbn::Vector{Symbol}
: band namesbf::Vector{Tuple{Real, Real}}
: band frequencies
#
NeuroAnalyzer.cbp
— Method.
cbp(s; pad, frq, fs)
Perform convolution band-pass filtering.
Arguments
s::AbstractVector
pad::Int64
: pad withpad
zerosfrq::Real
: filter frequencyfs::Int64
: sampling rate
Returns
cbp::Vector{Float64}
#
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 channelspad::Int64
: pad thesignal
withpad
zerosfrq::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 channelspad::Int64
: pad thesignal
withpad
zerosfrq::Tuple{Real, Real}
: filter frequency
#
NeuroAnalyzer.ch_zero
— Method.
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.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, higherm
values mean increased rigidityn::Int64=8
: Legendre polynomial orderlambda::Float64=10^-5
: smoothing factor
Returns
obj_new::NeuroAnalyzer.NEURO
: withcsd
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, higherm
values mean increased rigidityn::Int64=8
: Legendre polynomial orderlambda::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.gh
— Method.
gh(locs; m, n)
Generate G and H matrices.
Arguments
locs::DataFrame
m::Int64=4
: positive integer constant that affects spherical spline flexibility, higherm
values mean increased rigidityn::Int64=8
: Legendre polynomial order
Returns
Named tuple containing:
G::Matrix{Float64}
: transformation matrix (SP spline)H::Matrix{Float64}
: transformation matrix (CSD spline)
Source
Perrin F, Pernier J, Bertrand O, Echallier JF. Spherical splines for scalp potential and current density mapping. Electroencephalography and Clinical Neurophysiology. 1989;72(2):184-7
#
NeuroAnalyzer.cw_trans
— Method.
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_trans
— Method.
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_trans
— Method.
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_trans
— Method.
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 channelswt<: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_fft
— Method.
denoise_fft(s; pad, t)
Perform FFT denoising.
Arguments
s::AbstractVector
pad::Int64=0
: number of zeros to addt::Real=0
: PSD threshold for keeping frequency components; if 0, use mean signal power value
Returns
Named tuple containing:
s::Vector{Float64}
f_idx::BitVector
: index of components zeroed
#
NeuroAnalyzer.denoise_fft
— Method.
denoise_fft(s; pad, t)
Perform FFT denoising.
Arguments
s::AbstractArray
pad::Int64=0
: number of zeros to addt::Real=0
: PSD threshold for keeping frequency components; if 0, use mean signal power value
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 channelspad::Int64=0
: number of zeros to add signal for FFTt::Int64=100
: PSD threshold for keeping frequency components
Returns
obj_new::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.denoise_fft!
— 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 channelspad::Int64=0
: number of zeros to add signal for FFTt::Int64=100
: PSD threshold for keeping frequency components
#
NeuroAnalyzer.denoise_wavelet
— Method.
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_wavelet
— Method.
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_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 channelswt<: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 channelswt<:DiscreteWavelet
: discrete wavelet, e.g.wt = wavelet(WT.haar)
, see Wavelets.jl documentation for the list of available wavelets
#
NeuroAnalyzer.denoise_wien
— Method.
denoise_wien(s)
Perform Wiener deconvolution denoising.
Arguments
s::AbstractArray
Returns
s_new::Vector{Float64}
#
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
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.derivative
— Method.
derivative(s)
Return derivative of the same length.
Arguments
s::AbstractVector
Returns
s_new::AbstractVector
#
NeuroAnalyzer.derivative
— Method.
derivative(s)
Return derivative of the same length.
Arguments
s::AbstractArray
Returns
s_new::Array{Float64, 3}
#
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
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.detrend
— Method.
detrend(s; type, offset, order, span, fs)
Perform piecewise detrending.
Arguments
-
s::AbstractVector
-
type::Symbol=:ls
::loess
: fit and subtract loess approximation:poly
: polynomial oforder
is subtracted:constant
:offset
or the mean ofs
(ifoffset
= 0) is subtracted:linear
: linear trend is subtracted froms
:ls
: the result of a linear least-squares fit tos
is subtracted froms
-
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.detrend
— Method.
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 oforder
is subtracted:constant
:offset
or the mean ofs
(ifoffset
= 0) is subtracted:linear
: linear trend is subtracted froms
:ls
: the result of a linear least-squares fit tos
is subtracted froms
-
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.detrend
— Method.
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 oforder
is subtracted:constant
:offset
or the mean ofs
(ifoffset
= 0) is subtracted:linear
: linear trend is subtracted froms
:ls
: the result of a linear least-squares fit tos
is subtracted froms
-
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 oforder
is subtracted:constant
:offset
or the mean ofs
(ifoffset
= 0) is subtracted:linear
: linear trend is subtracted froms
:ls
: the result of a linear least-squares fit tos
is subtracted froms
-
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_trans
— Method.
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_trans
— Method.
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_trans
— Method.
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_trans
— Method.
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.dwtsplit
— Method.
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.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 firstbl
seconds; ifbl
is greater than 0, DC value is calculated as mean of the firstbl
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 firstbl
seconds; ifbl
is greater than 0, DC value is calculated as mean of the firstn
samples and subtracted from the signal
#
NeuroAnalyzer.fconv
— Method.
fconv(s; kernel, norm)
Perform convolution in the frequency domain.
Arguments
s::AbstractVector
kernel::AbstractVector
pad::Int64=0
: number of zeros to addnorm::Bool=true
: normalize kernel
Returns
s_new::Vector{Float64}
#
NeuroAnalyzer.fconv
— Method.
fconv(s; kernel, norm)
Perform convolution in the frequency domain.
Arguments
s::AbstractArray
kernel::Union{Vector{<:Real}, Vector{ComplexF64}}
: kernel for convolutionnorm::Bool=true
: normalize kernel to keep the post-convolution results in the same scale as the original datapad::Int64=0
: number of zeros to add signal for FFT
Returns
s_new::Array{Float64, 3}
: convoluted signal
#
NeuroAnalyzer.fconv
— Method.
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 channelskernel::Union{Vector{<:Real}, Vector{ComplexF64}}
: kernel for convolutionnorm::Bool=true
: normalize kernel to keep the post-convolution results in the same scale as the original datapad::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 channelskernel::Union{Vector{<:Real}, Vector{ComplexF64}}
: kernel for convolutionnorm::Bool=true
: normalize kernel to keep the post-convolution results in the same scale as the original datapad::Int64=0
: number of zeros to add signal for FFT
#
NeuroAnalyzer.filter_create
— Method.
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_apply
— Method.
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.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
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
-
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_g
— Method.
filter_g(s, fs, pad, f, gw)
Filter using Gaussian in the frequency domain.
Arguments
s::AbstractVector
fs::Int64
: sampling ratepad::Int64=0
: number of zeros to addf::Real
: filter frequencygw::Real=5
: Gaussian width in Hz
Returns
Named tuple containing:
s_filtered::Vector{Float64}
#
NeuroAnalyzer.filter_g
— Method.
filter_g(s; pad, f, gw)
Filter using Gaussian in the frequency domain.
Arguments
s::AbstractArray
fs::Int64
: sampling ratepad::Int64=0
: number of zeros to addf::Real
: filter frequencygw::Real=5
: Gaussian width in Hz
Returns
s_filtered::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.filter_g
— Method.
filter_g(obj; channel, 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 channelspad::Int64=0
: number of zeros to addf::Real
: filter frequencygw::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 channelspad::Int64=0
: number of zeros to addf::Real
: filter frequencygw::Real=5
: Gaussian width in Hz
#
NeuroAnalyzer.filter_mavg
— Method.
filter_mavg(s; <keyword arguments>)
Filter using moving average filter (with threshold).
Arguments
s::AbstractVector
k::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + mean(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
Returns
s_filtered::Vector{Float64}
#
NeuroAnalyzer.filter_mavg
— Method.
filter_mavg(s; k, t, window)
Filter using moving average filter (with threshold).
Arguments
s::AbstractArray
k::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + mean(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
Returns
s_filtered::Array{Float64, 3}
: convoluted signal
#
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 channelsk::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + mean(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
Returns
obj_new::NeuroAnalyzer.NEURO
: convoluted signal
#
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 channelsk::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + mean(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
#
NeuroAnalyzer.filter_mmed
— Method.
filter_mmed(s; <keyword arguments>)
Filter using moving median filter (with threshold).
Arguments
s::AbstractVector
k::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + median(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
Returns
s_filtered::Vector{Float64}
#
NeuroAnalyzer.filter_mmed
— Method.
filter_mmed(s; k, t, window)
Filter using moving median filter (with threshold).
Arguments
s::AbstractArray
k::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + mean(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
Returns
s_filtered::Array{Float64, 3}
: 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 channelsk::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + median(s)
)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 channelsk::Int64=8
: k-value for (window length = 2 × k + 1)t::Real=0
: threshold (t = t * std(s) + median(s)
)window::Union{Nothing, AbstractVector}=nothing
: weighting window
#
NeuroAnalyzer.filter_poly
— Method.
filter_poly(s; order, window)
Filter using polynomial filter.
Arguments
s::AbstractVector
order::Int64=8
: polynomial orderwindow::Int64=10
: window length
Returns
s_filtered::Vector{Float64}
#
NeuroAnalyzer.filter_poly
— Method.
filter_poly(s; order, window)
Filter using polynomial filter.
Arguments
s::AbstractArray
order::Int64=8
: polynomial orderwindow::Int64=10
: window length
Returns
s_filtered::Array{Float64, 3}
: 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 channelsorder::Int64=8
: polynomial orderwindow::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 channelsorder::Int64=8
: polynomial orderwindow::Int64=10
: window length
#
NeuroAnalyzer.filter_sg
— Method.
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 thanwindow
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_sg
— Method.
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 thanwindow
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_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 channelsorder::Int64=6
: order of the polynomial used to fit the samples; must be less thanwindow
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 channelsorder::Int64=6
: order of the polynomial used to fit the samples; must be less thanwindow
window::Int64=11
: length of the filter window (i.e., the number of coefficients); must be an odd number
#
NeuroAnalyzer.intensity2od
— Method.
intensity2od(s)
Convert NIRS intensity (RAW data) to optical density (OD).
Arguments
s::AbstractArray
Returns
od::AbstractArray
#
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
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_polarity
— Method.
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_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 interpolateep::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 interpolateep::Union{Int64, Vector{Int64}, <:AbstractRange}
: epoch number(s) within to interpolate
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.normalize
— Function.
normalize(s, n; method)
Normalize.
Arguments
-
s::AbstractArray
-
n::Real
-
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, n]:none
Returns
normalized::Vector{Float64}
#
NeuroAnalyzer.normalize_zscore
— Method.
normalize_zscore(s)
Normalize (by z-score).
Arguments
s::AbstractArray
Returns
normalize_zscore::Vector{Float64}
#
NeuroAnalyzer.normalize_minmax
— Method.
normalize_minmax(s)
Normalize in [-1, +1].
Arguments
s::AbstractArray
Returns
normalize_minmax::AbstractArray
#
NeuroAnalyzer.normalize_n
— Function.
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_log
— Method.
normalize_log(s)
Normalize using log-transformation.
Arguments
s::AbstractArray
Returns
normalize_log::AbstractArray
#
NeuroAnalyzer.normalize_gauss
— Function.
normalize_gauss(s, dims)
Normalize to Gaussian.
Arguments
s::AbstractArray
dims::Int64=1
: dimension for cumsum()
Returns
normalize_gauss::Vector{Float64}
#
NeuroAnalyzer.normalize_log10
— Method.
normalize_log10(s)
Normalize using log10-transformation.
Arguments
s::AbstractArray
Returns
normalize_log10::Vector{Float64}
#
NeuroAnalyzer.normalize_neglog
— Method.
normalize_neglog(s)
Normalize to using -log-transformation.
Arguments
s::AbstractArray
Returns
normalize_neglog::Vector{Float64}
#
NeuroAnalyzer.normalize_neglog10
— Method.
normalize_neglog10(s)
Normalize using -log10-transformation.
Arguments
s::AbstractArray
Returns
normalize_neglog::Vector{Float64}
#
NeuroAnalyzer.normalize_neg
— Method.
normalize_neg(s)
Normalize in [0, -∞].
Arguments
s::AbstractArray
Returns
normalize_neg::Vector{Float64}
#
NeuroAnalyzer.normalize_pos
— Method.
normalize_pos(s)
Normalize in [0, +∞].
Arguments
s::AbstractArray
Returns
normalize_pos::Vector{Float64}
#
NeuroAnalyzer.normalize_perc
— Method.
normalize_perc(s)
Normalize in percentages.
Arguments
s::AbstractArray
Returns
normalize_perc::Vector{Float64}
#
NeuroAnalyzer.normalize_invroot
— Method.
normalize_invroot(s)
Normalize in inverse root (1/sqrt(x)).
Arguments
s::AbstractArray
Returns
normalize_invroot::Vector{Float64}
#
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 channelsmethod::Symbol
: method for normalization, seenormalize()
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 channelsmethod::Symbol
: method for normalization, seenormalize()
for details
#
NeuroAnalyzer.npl
— Method.
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.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 channelsppf::Vector{Real}=ones(length(obj.header.recording[:wavelengths]))
: Partial path length factors for each wavelength. This is a vector of factors per wavelength. Typical value is ~6 for each wavelength if the absorption change is uniform over the volume of tissue measured. To approximate the partial volume effect of a small localized absorption change within an adult human head, this value could be as small as 0.1. Convention is becoming to setppf=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 channelsppf::Vector{Real}=ones(length(obj.header.recording[:wavelengths]))
: Partial path length factors for each wavelength. This is a vector of factors per wavelength. Typical value is ~6 for each wavelength if the absorption change is uniform over the volume of tissue measured. To approximate the partial volume effect of a small localized absorption change within an adult human head, this value could be as small as 0.1. Convention is becoming to setppf=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.plinterpolate_channel
— Method.
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 interpolateep::Union{Int64, Vector{Int64}, <:AbstractRange}
: epoch number(s) within to interpolateimethod::Symbol=:sh
: interpolation method Shepard (:sh
), Multiquadratic (:mq
), InverseMultiquadratic (:imq
), ThinPlate (:tp
), NearestNeighbour (:nn
), Gaussian (:ga
)interpolation_factor::Int64=100
: interpolation quality
#
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 referencemed::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 referencemed::Bool=false
: use median instead of mean
#
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 calculationexclude_current::Bool=true
: exclude current channel from CAR calculationmed::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 calculationexclude_current::Bool=true
: exclude current channel from CAR mean calculationmed::Bool=false
: use median instead of mean
#
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
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_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
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_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
: usenn
adjacent electrodesweights::Bool=false
: use mean ofnn
nearest channels if false; if true, mean ofnn
nearest channels is weighted by distance to the referenced channelmed::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
: usenn
adjacent electrodesweights::Bool=false
: use distance weights; use mean of nearest channels if falsemed::Bool=false
: use median instead of mean
#
NeuroAnalyzer.remove_dc
— Function.
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 firstn
samples
Returns
s_new::Vector{Float64}
#
NeuroAnalyzer.remove_dc
— Function.
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 firstn
samples
Returns
s::Array{Float64, 3}
#
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 channelsn::Int64=0
: baseline is the firstn
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 channelsn::Int64=0
: baseline is the firstn
samples
#
NeuroAnalyzer.remove_pops
— Method.
remove_pops(s; repair)
Detect and repair electrode pop (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 withinpop_location - r:pop_location + r
samplesrepair::Bool=true
: recover the segment iftrue
Returns
Named tuple containing:
s_new::Vector{Float64}
pop_location::Int64
: sample number in the signalleft_segment::Int64
: length of segment before the pop that starts when signal crosses 0right_segment::Int64
: length of segment after the pop that ends when signal crosses 0
#
NeuroAnalyzer.remove_pops
— Method.
remove_pops(s; repair)
Detect and repair electrode pop (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 channelsrepair::Bool=true
: recover the segment iftrue
window::Real=10.0
: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)r::Int64=20
: detection segment length; pops are checked withinpop_location - r:pop_location + r
samples
Returns
Named tuple containing:
obj_new::NeuroAnalyzer.NEURO
: returned ifrepair = true
pop_loc::Vector{Vector{Int64}}
: location of pops: channel, epoch and sample number in the signall_seg::Vector{Int64}
: length of segment before the pop that starts when signal crosses 0r_seg::Vector{Int64}
: length of segment after the pop that ends when signal crosses 0
#
NeuroAnalyzer.remove_pops!
— Method.
remove_pops!(s; repair)
Detect and repair electrode pop (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 channelsrepair::Bool=true
: recover the segment iftrue
window::Real=20.0
: window length (in seconds) in which the signal is scanned and repaired (windows are non-overlapping)r::Int64=20
: detection segment length; pops are checked withinpop_location - r:pop_location + r
samples
Returns
Named tuple containing:
pop_loc::Vector{Vector{Int64}}
: location of pops: channel, epoch and sample number in the signall_seg::Vector{Int64}
: length of segment before the pop that starts when signal crosses 0r_seg::Vector{Int64}
: length of segment after the pop that ends when signal crosses 0
#
NeuroAnalyzer.remove_powerline
— Method.
remove_powerline(obj; pl_frq, method)
Remove power line noise and harmonics.
Arguments
obj::NeuroAnalyzer.NEURO
pl_frq::Real=50
: power line frequencymethod::Symbol=:iir
: use IIR filter
Returns
obj_new::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.remove_powerline!
— Method.
remove_powerline!(obj; pl_frq, method)
Remove power line noise and harmonics.
Arguments
obj::NeuroAnalyzer.NEURO
pl_frq::Real=50
: power line frequencymethod::Symbol=:iir
: use IIR filter
#
NeuroAnalyzer.resample
— Method.
resample(s; t, new_sr)
Resample to new_sr
sampling frequency.
Arguments
s::AbstractVector
old_sr::Int64
: old sampling ratenew_sr::Int64
: new sampling rate
Returns
s_new::Vector{Float64}
#
NeuroAnalyzer.resample
— Method.
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 ratenew_sr::Int64
: new sampling rate
Returns
s_new::Array{Float64, 3}
#
NeuroAnalyzer.resample
— Method.
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.upsample
— Method.
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.downsample
— Method.
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.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 channelsfactor::Real
: signal is multiplied byfactor
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 channelsfactor::Real
: signal is multiplied byfactor
#
NeuroAnalyzer.standardize
— Method.
standardize(s)
Standardize channels.
Arguments
s::AbstractArray
Returns
s_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
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.taper
— Method.
taper(signal; taper)
Taper the signal.
Arguments
signal::AbstractVector
t::Union{AbstractVector, Vector{ComplexF64}}
Returns
t::Vector{Union{Float64, ComplexF64}}
#
NeuroAnalyzer.taper
— Method.
taper(s; t)
Taper the signal.
Arguments
s::AbstractArray
t::Union{Vector{Real, Vector{ComplexF64}}
Returns
s::Array{Float64, 3
#
NeuroAnalyzer.taper
— Method.
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 channelst::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 channelst::Union{Vector{<:Real}, Vector{ComplexF64}}
#
NeuroAnalyzer.tconv
— Method.
tconv(signal; kernel)
Performs convolution in the time domain.
Arguments
s::AbstractVector
kernel::AbstractVector
Returns
s_new::Vector{Float64}
#
NeuroAnalyzer.tconv
— Method.
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 channelskernel::Union{Vector{<:Real}, Vector{ComplexF64}}
: kernel used for convolution
Returns
s_new::Array{Float64, 3}
: convoluted signal
#
NeuroAnalyzer.tconv
— Method.
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 channelskernel::Union{Vector{<:Real}, Vector{ComplexF64}}
: kernel used for convolution
Returns
s_new::Array{Float64, 3}
: convoluted signal
#
NeuroAnalyzer.wbp
— Method.
wbp(s; pad, frq, fs, ncyc)
Perform wavelet band-pass filtering.
Arguments
s::AbstractVector
pad::Int64
: pad withpad
zerosfrq::Real
: filter frequencyfs::Int64
: sampling ratencyc::Int64=6
: number of cycles for Morlet wavelet
Returns
s_new::Vector{Float64}
#
NeuroAnalyzer.wbp
— Method.
wbp(s; ch, pad, frq, ncyc)
Perform wavelet band-pass filtering.
Arguments
s::AbstractArray
pad::Int64
: pad thesignal
withpad
zerosfrq::Real
: filter frequencyfs::Int64
: sampling ratencyc::Int64=6
: number of cycles for Morlet wavelet
Returns
s_new::Array{Float64, 3
#
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 channelspad::Int64
: pad thesignal
withpad
zerosfrq::Real
: filter frequencyncyc::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 channelspad::Int64
: pad thesignal
withpad
zerosfrq::Real
: filter frequencyncyc::Int64=6
: number of cycles for Morlet wavelet
Locs
#
NeuroAnalyzer.add_locs
— Method.
add_locs(obj; locs)
Add electrode positions from locs
.
Electrode locations:
channel
channel numberlabels
channel labelloc_theta
planar polar angleloc_radius
planar polar radiusloc_x
spherical Cartesian xloc_y
spherical Cartesian yloc_z
spherical Cartesian zloc_radius_sph
spherical radiusloc_theta_sph
spherical horizontal angleloc_phi_sph
spherical azimuth angle
Arguments
obj::NeuroAnalyzer.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 numberlabels
channel labelloc_theta
planar polar angleloc_radius
planar polar radiusloc_x
spherical Cartesian xloc_y
spherical Cartesian yloc_z
spherical Cartesian zloc_radius_sph
spherical radiusloc_theta_sph
spherical horizontal angleloc_phi_sph
spherical azimuth angle
Arguments
obj::NeuroAnalyzer.NEURO
locs::DataFrame
#
NeuroAnalyzer.cart2pol
— Method.
cart2pol(x, y)
Convert Cartesian coordinates to polar.
Arguments
x::Real
y::Real
Returns
radius::Float64
theta::Float64
#
NeuroAnalyzer.pol2cart
— Method.
pol2cart(radius, theta)
Convert polar coordinates to Cartesian.
Arguments
radius::Real
: polar radius, the distance from the origin to the point, in degreestheta::Real
: polar angle
Returns
x::Float64
y::Float64
#
NeuroAnalyzer.sph2cart
— Method.
sph2cart(radius, theta, phi)
Convert spherical coordinates to Cartesian.
Arguments
radius::Real
: spherical radius, the distance from the origin to the pointtheta::Real
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesphi::Real
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
Returns
x::Float64
y::Float64
z::Float64
#
NeuroAnalyzer.cart2sph
— Method.
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 pointtheta::Float64
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesphi::Float64
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
#
NeuroAnalyzer.sph2pol
— Method.
sph2pol(radius, theta, phi)
Convert spherical coordinates to polar.
Arguments
radius::Real
: spherical radius, the distance from the origin to the pointtheta::Real
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesphi::Real
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
Returns
radius::Float64
theta::Float64
#
NeuroAnalyzer.locs_sph2cart
— Method.
locs_sph2cart(locs)
Convert spherical locations to Cartesian.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_sph2cart!
— Method.
locs_sph2cart!(locs)
Convert spherical locations to Cartesian.
Arguments
locs::DataFrame
#
NeuroAnalyzer.locs_cart2sph
— Method.
locs_cart2sph(locs)
Convert Cartesian locations to spherical.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_cart2sph!
— Method.
locs_cart2sph!(locs)
Convert Cartesian locations to spherical.
Arguments
locs::DataFrame
#
NeuroAnalyzer.locs_cart2pol
— Method.
locs_cart2pol(locs)
Convert Cartesian locations to polar.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_cart2pol!
— Method.
locs_cart2pol!(locs)
Convert Cartesian locations to polar.
Arguments
locs::DataFrame
#
NeuroAnalyzer.locs_sph2pol
— Method.
locs_sph2pol(locs)
Convert spherical locations to polar.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_sph2pol!
— Method.
locs_sph2pol!(locs)
Convert Cartesian locations to polar.
Arguments
locs::DataFrame
#
NeuroAnalyzer.locs_details
— Method.
locs_details(obj; ch, output)
Return locations of OBJ ch electrode.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, String}
: channel number or nameout::Bool=true
: print output if true
Returns
Named tuple containing:
ch::Int64
: channel numberlabel::String
: location labeltheta::Float64
: polar planar theta coordinateradius::Float64
: polar planar radius coordinatex::Float64
: Cartesian X spherical coordinatey::Float64
: Cartesian Y spherical coordinatez::Float64
: Cartesian Z spherical coordinatetheta_sph::Float64
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Float64
: spherical radius, the distance from the origin to the pointphi_sph::Float64
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degrees
#
NeuroAnalyzer.edit_locs
— Method.
edit_locs(obj; <keyword arguments>)
Edit electrode.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{String, Int64}
: channel number or namex::Union{Real, Nothing}=nothing
: Cartesian X spherical coordinatey::Union{Real, Nothing}=nothing
: Cartesian Y spherical coordinatez::Union{Real, Nothing}=nothing
: Cartesian Z spherical coordinatetheta::Union{Real, Nothing}=nothing
: polar planar theta coordinateradius::Union{Real, Nothing}=nothing
: polar planar radius coordinatetheta_sph::Union{Real, Nothing}=nothing
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Union{Real, Nothing}=nothing
: spherical radius, the distance from the origin to the pointphi_sph::Union{Real, Nothing}=nothing
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degreesname::String=""
: channel nametype::String=""
: channel type
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.edit_locs!
— Method.
edit_locs!(obj; <keyword arguments>)
Edit electrode.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{String, Int64}
: channel number or namex::Union{Real, Nothing}=nothing
: Cartesian X spherical coordinatey::Union{Real, Nothing}=nothing
: Cartesian Y spherical coordinatez::Union{Real, Nothing}=nothing
: Cartesian Z spherical coordinatetheta::Union{Real, Nothing}=nothing
: polar planar theta coordinateradius::Union{Real, Nothing}=nothing
: polar planar radius coordinatetheta_sph::Union{Real, Nothing}=nothing
: spherical horizontal angle, the angle in the xy plane with respect to the x-axis, in degreesradius_sph::Union{Real, Nothing}=nothing
: spherical radius, the distance from the origin to the pointphi_sph::Union{Real, Nothing}=nothing
: spherical azimuth angle, the angle with respect to the z-axis (elevation), in degreesname::String=""
: channel nametype::String=""
: channel type
#
NeuroAnalyzer.locs_flipy
— Method.
locs_flipy(locs; planar, spherical)
Flip channel locations along y axis.
Arguments
locs::DataFrame
planar::Bool=true
: modify planar coordinatesspherical::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 coordinatesspherical::Bool=true
: modify spherical coordinates
#
NeuroAnalyzer.locs_flipx
— Method.
locs_flipx(locs; planar, spherical)
Flip channel locations along x axis.
Arguments
locs::DataFrame
planar::Bool=true
: modify planar coordinatesspherical::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 coordinatesspherical::Bool=true
: modify spherical coordinates
#
NeuroAnalyzer.locs_flipz
— Method.
locs_flipz(locs)
Flip channel locations along z axis.
Arguments
locs::DataFrame
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_flipz!
— Method.
locs_flipz!(locs)
Flip channel locations along z axis.
Arguments
locs::DataFrame
#
NeuroAnalyzer.locs_rotx
— Method.
locs_rotx(locs; a, planar, spherical)
Rotate channel locations in the x-plane.
Arguments
locs::DataFrame
a::Real
: angle of rotation (in degrees)planar::Bool=true
: modify planar coordinatesspherical::Bool=true
: modify spherical coordinates
Returns
locs_new::DataFrame
#
NeuroAnalyzer.locs_rotx!
— Method.
locs_rotx!(locs)
Rotate channel locations in the x-plane.
Arguments
locs::DataFrame
a::Int64
: scaling factorplanar::Bool=true
: modify planar coordinatesspherical::Bool=true
: modify spherical coordinates
#
NeuroAnalyzer.locs_scale
— Method.
locs_scale(locs; r, planar, spherical)
Scale channel locations.
Arguments
locs::DataFrame
r::Real
: scaling factorplanar::Bool=true
: modify planar coordinatesspherical::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 factorplanar::Bool=true
: modify planar coordinatesspherical::Bool=true
: modify spherical coordinates
#
NeuroAnalyzer.locs_maximize
— Method.
locs_maximize(locs; planar, spherical)
Maximize channel locations to the unit sphere.
Arguments
locs::DataFrame
planar::Bool=true
: modify planar coordinatesspherical::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 coordinatesspherical::Bool=false
: modify spherical coordinates
#
NeuroAnalyzer.locs_swapxy
— Method.
locs_swapxy(locs; planar, spherical)
Swap channel locations x and y axes.
Arguments
locs::DataFrame
planar::Bool=true
: modify planar coordinatesspherical::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 coordinatesspherical::Bool=true
: modify spherical coordinates
Analyze
#
NeuroAnalyzer.acor
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-correlation
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acor
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-correlation
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acor
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-correlation
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acor
— Method.
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 channelslag::Real=1
: lags range is0: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.acov
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-covariance
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acov
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-covariance
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acov
— Method.
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 is0:l
demean::Bool=true
: demean signal before computing auto-covariance
Returns
Named tuple containing:
ac::Matrix{Float64}
#
NeuroAnalyzer.acov
— Method.
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 channelslag::Real=1
: lags range is0: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.ampdiff
— Method.
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.ampdiff
— Method.
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_mpower
— Method.
band_mpower(s; fs, f)
Calculate mean and maximum band power and its frequency.
Arguments
s::AbstractVector
fs::Int64
: sampling ratef::Tuple{Real, Real}
: lower and upper frequency bounds
Returns
Named tuple containing:
mbp::Float64
: mean band powermaxfrq::Float64
: frequency of maximum band powermaxbp::Float64
: power at maximum band frequency
#
NeuroAnalyzer.band_mpower
— Method.
band_mpower(s; fs, f, mt)
Calculate absolute band power between two frequencies.
Arguments
s::AbstractArray
fs::Int64
: sampling ratef::Tuple{Real, Real}
: lower and upper frequency boundsmt::Bool=false
: if true use multi-tapered periodogram
Returns
Named tuple containing:
mbp::Matrix{Float64}
: mean band power per channel per epochmaxfrq::Matrix{Float64}
: frequency of maximum band power per channel per epochmaxbp::Matrix{Float64}
: power at maximum band frequency per channel per epoch
#
NeuroAnalyzer.band_mpower
— Method.
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 channelsf::Tuple{Real, Real}
: lower and upper frequency boundsmt::Bool=false
: if true use multi-tapered periodogram
Returns
Named tuple containing:
mbp::Matrix{Float64}
: mean band power per channel per epochmaxfrq::Matrix{Float64}
: frequency of maximum band power per channel per epochmaxbp::Matrix{Float64}
: power at maximum band frequency per channel per epoch
#
NeuroAnalyzer.band_power
— Method.
band_power(s; fs, f, mt)
Calculate absolute band power between two frequencies.
Arguments
s::AbstractVector
fs::Int64
: sampling ratef::Tuple{Real, Real}
: lower and upper frequency boundsmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
bp::Float64
: band power
#
NeuroAnalyzer.band_power
— Method.
band_power(s; fs, f, mt)
Calculate absolute band power between two frequencies.
Arguments
s::AbstractArray
fs::Int64
: sampling ratef::Tuple{Real, Real}
: lower and upper frequency boundsmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
bp::Matrix{Float64}
: band power
#
NeuroAnalyzer.band_power
— Method.
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 channelsf::Tuple{Real, Real}
: lower and upper frequency boundsmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
bp::Matrix{Float64}
: band power
#
NeuroAnalyzer.corm
— Method.
corm(s; norm=true)
Calculate correlation matrix of s * s'
.
Arguments
s::AbstractVector
norm::Bool
: normalize correlation matrix
Returns
cm::Matrix{Float64}
#
NeuroAnalyzer.corm
— Method.
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.corm
— Method.
corm(s; norm=true)
Calculate correlation matrix.
Arguments
s::AbstractArray
norm::Bool=false
: normalize covariance
Returns
cm::Array{Float64, 4}
#
NeuroAnalyzer.corm
— Method.
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 channelsnorm::Bool=true
: normalize matrix
Returns
cm::Array{Float64, 3}
: correlation matrix for each epoch
#
NeuroAnalyzer.covm
— Method.
covm(s; norm=true)
Calculate covariance matrix of s * s'
.
Arguments
s::AbstractVector
norm::Bool=false
: normalize covariance
Returns
cm::Matrix{Float64}
#
NeuroAnalyzer.covm
— Method.
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.covm
— Method.
covm(s; norm=true)
Calculate covariance matrix.
Arguments
s::AbstractArray
norm::Bool=false
: normalize covariance
Returns
cm::Matrix{Float64}
#
NeuroAnalyzer.covm
— Method.
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 channelsnorm::Bool=false
: normalize matrix
Returns
cm::Array{Float64, 3}
: covariance matrix for each epoch
#
NeuroAnalyzer.cps
— Method.
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 powerph::Vector{Float64}
: cross power spectrum phase (in radians)f::Vector{Float64}
: cross power spectrum frequencies
#
NeuroAnalyzer.cps
— Method.
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 powerph::Array{Float64, 4}
: cross power spectrum phase (in radians)f::Vector{Float64}
: cross power spectrum frequencies
#
NeuroAnalyzer.cps
— Method.
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 powerph::Array{Float64, 4}
: cross power spectrum phase (in radians)f::Vector{Float64}
: cross power spectrum frequencies
#
NeuroAnalyzer.cps
— Method.
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 powerph::Array{Float64, 4}
: cross power spectrum phase (in radians)f::Vector{Float64, 4}
: cross power spectrum frequencies
#
NeuroAnalyzer.cps
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
pw::Array{Float64, 3}
: cross power spectrum powerph::Array{Float64, 3}
: cross power spectrum phase (in radians)f::Vector{Float64, 3}
: cross power spectrum frequencies
#
NeuroAnalyzer.gfp
— Method.
gfp(s)
Calculate GFP (Global Field Power).
Arguments
s::AbstractVector
Returns
gfp::Float64
#
NeuroAnalyzer.gfp_norm
— Method.
gfp_norm(s)
Calculate signal normalized for GFP (Global Field Power).
Arguments
s::AbstractVector
Returns
gfp_norm::Float64
#
NeuroAnalyzer.diss
— Method.
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 dissimilaritysc::Float64
: spatial correlation
#
NeuroAnalyzer.diss
— Method.
diss(s)
Calculate DISS (global dissimilarity) and spatial correlation (channels vs channels).
Arguments
s::AbstractArray
Returns
Named tuple containing:
gd::Array{Float64, 3}
: global dissimilaritysc::Array{Float64, 3}
: spatial correlation
#
NeuroAnalyzer.diss
— Method.
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 dissimilaritysc::Array{Float64, 3}
: spatial correlation
#
NeuroAnalyzer.diss
— Method.
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 dissimilaritysc::Array{Float64, 3}
: spatial correlation
#
NeuroAnalyzer.diss
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
gd::Array{Float64, 3}
: global dissimilaritysc::Array{Float64, 3}
: spatial correlation
#
NeuroAnalyzer.entropy
— Method.
entropy(s)
Calculate entropy.
Arguments
s::AbstractVector
Returns
ent::Float64
sent::Float64
: Shanon entropyleent::Float64
: log energy entropy
#
NeuroAnalyzer.entropy
— Method.
entropy(s)
Calculate entropy.
Arguments
s::AbstractArray
Returns
Named tuple containing:
ent::Array{Float64, 2}
sent::Array{Float64, 2}
: Shanon entropyleent::Array{Float64, 2}
: log energy entropy
#
NeuroAnalyzer.entropy
— Method.
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 entropyleent::Array{Float64, 2}
: log energy entropy
#
NeuroAnalyzer.negentropy
— Method.
negentropy(signal)
Calculate negentropy.
Arguments
signal::AbstractVector
Returns
negent::Float64
#
NeuroAnalyzer.negentropy
— Method.
negentropy(s)
Calculate negentropy.
Arguments
s::AbstractArray
Returns
ne::Array{Float64, 2}
#
NeuroAnalyzer.negentropy
— Method.
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.tenv
— Method.
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 channelsd::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
t_env::Array{Float64, 3}
: temporal envelopes_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.tenv_mean
— Method.
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 channelsdims::Int64
: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)d::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
t_env_m::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: meant_env_u::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: 95% CI upper boundt_env_l::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: 95% CI lower bounds_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.tenv_median
— Method.
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 channelsdims::Int64
: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)d::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
t_env_m::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: mediant_env_u::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: 95% CI upper boundt_env_l::Union{Vector{Float64}, Matrix{Float64}}
: temporal envelope: 95% CI lower bounds_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.penv
— Method.
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 channelsd::Int64=8
: distance between peeks in samples, lower values get better envelope fitmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
p_env::Array{Float64, 3}
: power spectrum envelopep_env_frq::Vector{Float64}
: frequencies for each envelope
#
NeuroAnalyzer.penv_mean
— Method.
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 channelsdims::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 fitmt::Bool=false
: if true use multi-tapered periodogram
Returns
Named tuple containing:
p_env_m::Array{Float64, 3}
: power spectrum envelope: meanp_env_u::Array{Float64, 3}
: power spectrum envelope: 95% CI upper boundp_env_l::Array{Float64, 3}
: power spectrum envelope: 95% CI lower boundp_env_frq::Vector{Float64}
: power spectrum envelope (useful for plotting over PSD)
#
NeuroAnalyzer.penv_median
— Method.
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 channelsdims::Int64
: median over channels (dims = 1) or epochs (dims = 2)d::Int64=8
: distance between peeks in samples, lower values get better envelope fitmt::Bool=false
: if true use multi-tapered periodogram
Returns
Named tuple containing:
p_env_m::Array{Float64, 3}
: power spectrum envelope: medianp_env_u::Array{Float64, 3}
: power spectrum envelope: 95% CI upper boundp_env_l::Array{Float64, 3}
: power spectrum envelope: 95% CI lower boundp_env_frq::Vector{Float64}
: power spectrum envelope (useful for plotting over PSD)
#
NeuroAnalyzer.senv
— Method.
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 channelsd::Int64=2
: distance between peeks in samples, lower values get better envelope fitmt::Bool=false
: if true use multi-tapered spectrogramt::Union{Real, Nothing}=nothing
: spectrogram threshold (maximize all powers > t)
Returns
Named tuple containing:
s_env::Array{Float64, 3}
: spectral envelopes_env_t::Vector{Float64}
: spectrogram time
#
NeuroAnalyzer.senv_mean
— Method.
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 channelsdims::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 fitmt::Bool=false
: if true use multi-tapered spectrogramt::Union{Real, Nothing}=nothing
: spectrogram threshold (maximize all powers > t)
Returns
Named tuple containing:
s_env_m::Array{Float64, 3}
: spectral envelope: means_env_u::Array{Float64, 3}
: spectral envelope: 95% CI upper bounds_env_l::Array{Float64, 3}
: spectral envelope: 95% CI lower bounds_env_t::Vector{Float64}
: spectral envelope (useful for plotting over spectrogram)
#
NeuroAnalyzer.senv_median
— Method.
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 channelsdims::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 fitmt::Bool=false
: if true use multi-tapered spectrogramt::Union{Real, Nothing}=nothing
: spectrogram threshold (maximize all powers > t)
Returns
Named tuple containing:
s_env_m::Array{Float64, 3}
: spectral envelope: medians_env_u::Array{Float64, 3}
: spectral envelope: 95% CI upper bounds_env_l::Array{Float64, 3}
: spectral envelope: 95% CI lower bounds_env_t::Vector{Float64}
: spectral envelope (useful for plotting over spectrogram)
#
NeuroAnalyzer.henv
— Method.
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 channelsd::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
h_env::Array{Float64, 3}
: Hilbert spectrum amplitude envelopes_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.henv_mean
— Method.
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 channelsdims::Int64
: mean over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)d::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
h_env_m::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: meanh_env_u::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: 95% CI upper boundh_env_l::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: 95% CI lower bounds_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.henv_median
— Method.
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 channelsdims::Int64
: median over channels (dims = 1), epochs (dims = 2) or channels and epochs (dims = 3)d::Int64=32
: distance between peeks in samples, lower values get better envelope fit
Returns
Named tuple containing:
h_env_m::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: medianh_env_u::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: 95% CI upper boundh_env_l::Union{Vector{Float64}, Matrix{Float64}}
: Hilbert spectrum amplitude envelope: 95% CI lower bounds_t::Vector{Float64}
: signal time
#
NeuroAnalyzer.env_cor
— Method.
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 valuep::Vector{Float64}
: p-value
#
NeuroAnalyzer.erop
— Method.
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)
forfrq = :log
orncyc = linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
ero_p::Array{Float64, 3}
: powersero_f::Vector{Float64}
: frequencies
#
NeuroAnalyzer.eros
— Method.
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)
forfrq = :log
orncyc = linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :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}
: frequenciesero_t::Vector{Float64}
: time
#
NeuroAnalyzer.erp_peaks
— Method.
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_at
— Method.
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_at
— Method.
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_at
— Method.
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_at
— Method.
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.fcoherence
— Method.
fcoherence(s; fs, frq_lim)
Calculate coherence (mean over all frequencies) and MSC (magnitude-squared coherence) between channels.
Arguments
s::AbstractMatrix
fs::Int64
: sampling ratefrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing
: return coherence only for the given frequency range
Returns
Named tuple containing:
c::Array{Float64, 3}
: coherencemsc::Array{Float64, 3}
: MSCf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.fcoherence
— Method.
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}
: coherencemsc::Array{Float64, 3}
: MSCf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.fcoherence
— Method.
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}
: coherencemsc::Array{Float64, 3}
: MSCf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.fcoherence
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochsfrq_lim::Union{Tuple{Real, Real}, Nothing}=nothing
: return coherence only for the given frequency range
Returns
Named tuple containing:
c::Array{Float64, 3}
: coherencemsc::Array{Float64, 3}
: MSCf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.frqinst
— Method.
frqinst(s; fs)
Calculate instantaneous frequency.
Arguments
s::AbstractVector
fs::Int64
Returns
f::Vector{Float64}
#
NeuroAnalyzer.frqinst
— Method.
frqinst(s; fs)
Calculate instantaneous frequency.
Arguments
s::AbstractVector
fs::Int64
Returns
f::Array{Float64, 2}
#
NeuroAnalyzer.frqinst
— Method.
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.ged
— Method.
ged(s1, s2)
Perform generalized eigendecomposition.
Arguments
s1::AbstractArray
: signal to be analyzeds2::AbstractArray
: original signal
Returns
Named tuple containing:
sged::Matrix{Float64}
ress::Vector{Float64}
ress_norm::Vector{Float64}
: RESS normalized to -1..1
#
NeuroAnalyzer.ged
— Method.
ged(obj1, obj2; ch1, ch2, ep1, ep2)
Perform generalized eigendecomposition.
Arguments
obj1::NeuroAnalyzer.NEURO
: signal data to be analyzedobj2::NeuroAnalyzer.NEURO
: original signal datach1::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj1)
: index of channels, default is all signal channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::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.ica
— Method.
ica(s; <keyword arguments>)
Calculate n
first Independent Components.
Arguments
-
s::AbstractMatrix
-
n::Int64
: number of ICs -
tol::Float64=1.0e-6
: tolerance for ICA -
iter::Int64=100
: maximum number of iterations -
f::Symbol=:tanh
: neg-entropy functor::tanh
:gaus
Returns
Named tuple containing:
ic::Array{Float64, 3}:
: IC(1)..IC(n) × epochic_mw::Array{Float64, 3}:
: IC(1)..IC(n) × epoch
#
NeuroAnalyzer.ica
— Method.
ica(s; <keyword arguments>)
Calculate n
first Independent Components.
Arguments
-
s::AbstractArray
-
n::Int64
: number of ICs -
tol::Float64=1.0e-6
: tolerance for ICA -
iter::Int64=100
: maximum number of iterations -
f::Symbol=:tanh
: neg-entropy functor::tanh
:gaus
Returns
Named tuple containing:
ic::Array{Float64, 3}:
: IC(1)..IC(n) × epochic_mw::Array{Float64, 3}:
: IC(1)..IC(n) × epoch
#
NeuroAnalyzer.ica_reconstruct
— Method.
ica_reconstruct(s; ic, ic_mw, ic_idx)
Reconstructs s
via removal of ic
ICA components.
Arguments
s::AbstractArray
ic::AbstractArray:
: IC(1)..IC(n) × epochic_mw::AbstractArray:
: IC(1)..IC(n) × epoch- `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove
Returns
s_reconstructed::Array{Float64, 3}
#
NeuroAnalyzer.ica
— Method.
ica(obj; <keyword arguments>)
Perform independent component analysis (ICA).
Arguments
-
obj::NeuroAnalyzer.NEURO
-
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channels -
n::Int64
: number of ICs -
tol::Float64=1.0e-6
: tolerance for ICA -
iter::Int64=100
: maximum number of iterations -
f::Symbol=:tanh
: neg-entropy functor::tanh
:gaus
Returns
Named tuple containing:
ic::Array{Float64, 3}
: IC(1)..IC(n) × epoch (W * data)ic_mw::Array{Float64, 3}
: IC(1)..IC(n) × epoch inv(W)
#
NeuroAnalyzer.ica_reconstruct
— Method.
ica_reconstruct(obj; ch, ic_idx)
Reconstruct signals using embedded ICA components (:ic
and :ic_mw
).
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channelsic_idx::Union{Int64, Vector{Int64}, <:AbstractRange}
: list of ICs to remove
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.ica_reconstruct!
— Method.
ica_reconstruct!(obj; ch, ic_idx)
Reconstruct signals using embedded ICA components (:ic
and :ic_mw
).
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channels- `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove
#
NeuroAnalyzer.ica_reconstruct
— Method.
ica_reconstruct(obj; ic, ic_mw; ch, ic_idx)
Reconstruct signals using external ICA components (ic
and ic_mw
).
Arguments
obj::NeuroAnalyzer.NEURO
ic::Array{Float64, 3}
: IC(1)..IC(n) × epoch (W * data)ic_mw::Array{Float64, 3}
: IC(1)..IC(n) × epoch inv(W)ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channels- `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove
Returns
obj::NeuroAnalyzer.NEURO
#
NeuroAnalyzer.ica_reconstruct!
— Method.
ica_reconstruct!(obj, ic, ic_mw; ch, ic_idx)
Reconstruct signals using external ICA components (ic
and ic_mw
).
Arguments
obj::NeuroAnalyzer.NEURO
ic::Array{Float64, 3}
: IC(1)..IC(n) × epoch (W * data)ic_mw::Array{Float64, 3}
: IC(1)..IC(n) × epoch inv(W)ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channels- `ic_idx::Union{Int64, Vector{Int64}, <:AbstractRange} - list of ICs to remove
#
NeuroAnalyzer.ispc
— Method.
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 valueispc_angle::Float64
: ISPC angles_diff::Vector{Float64}
: signal difference (s2 - s1)ph_diff::Vector{Float64}
: phase difference (s2 - s1)s1_phase::Vector{Float64}
: signal 1 phases2_phase::Vector{Float64}
: signal 2 phase
#
NeuroAnalyzer.ispc
— Method.
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 epochsispc_angle::Array{Float64, 3}
: ISPC angle matrices over epochs
#
NeuroAnalyzer.ispc
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
ispc_value::Array{Float64, 2}
: ISPC valueispc_angle::Array{Float64, 2}
: ISPC angles_diff::Array{Float64, 3}
: signal difference (s2 - s1)ph_diff::Array{Float64, 3}
: phase difference (s2 - s1)s1_phase::Array{Float64, 3}
: signal 1 phases2_phase::Array{Float64, 3}
: signal 2 phase
#
NeuroAnalyzer.itpc
— Method.
itpc(s; t)
Calculate ITPC (Inter-Trial-Phase Clustering) at sample number t
over epochs.
Arguments
s::AbstractArray
: one channel over epochst::Int64
: time point (sample number) at which ITPC is calculatedw::Union{AbstractVector, Nothing}
: optional vector of epochs/trials weights for wITPC calculation
Returns
Named tuple containing:
itpc_value::Float64
: ITPC valueitpcz_value::Float64
: Rayleigh's ITPC Z valueitpc_angle::Float64
: ITPC angleitpc_phases::Vector{Float64}
: phases at timet
averaged across trials/epochs
#
NeuroAnalyzer.itpc
— Method.
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 channelst::Int64
: time point (sample number) at which ITPC is calculatedw::Union{Vector{<:Real}, Nothing}=nothing
: optional vector of epochs/trials weights for wITPC calculation
Returns
Named tuple containing:
itpc_value::Vector{Float64}
: ITPC or wITPC valueitpcz_value::Vector{Float64}
: Rayleigh's ITPC Z valueitpc_angle::Vector{Float64}
: ITPC angleitpc_phases::Array{Float64, 2}
: phase difference (channel2 - channel1)
#
NeuroAnalyzer.itpc_spec
— Method.
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 spectrogramfrq_n::Int64=_tlength(frq_lim)
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesw::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 valuesitpcz_s::Array{Float64, 3}
: spectrogram itpcz_value valuesitpc_f::Vector{Float64}
: frequencies list
#
NeuroAnalyzer.mdiff
— Method.
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.mdiff
— Method.
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.mdiff
— Method.
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.mdiff
— Method.
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_information
— Method.
mutual_information(s1, s2)
Calculate mutual information.
Arguments
s1::AbstractVector
s2::AbstractVector
Returns
mutual_information::Float64
#
NeuroAnalyzer.mutual_information
— Method.
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_information
— Method.
mutual_information(s)
Calculate mutual information (channels vs channels).
Arguments
s::AbstractArray
Returns
#
NeuroAnalyzer.mutual_information
— Method.
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_information
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
m::Array{Float64, 3}
#
NeuroAnalyzer.msci95
— Method.
msci95(s; n, method)
Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractVector
n::Int64=3
: number of bootstrapsmethod::Symbol=:normal
: use normal method (:normal
) orn
-times boostrapping (:boot
)
Returns
Named tuple containing:
sm::Float64
: meanss::Float64
: standard deviationsu::Float64
: upper 95% CIsl::Float64
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
msci95(s; n, method)
Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractMatrix
n::Int64=3
: number of bootstrapsmethod::Symbol=:normal
: use normal method (:normal
) orn
-times boostrapping (:boot
)
Returns
Named tuple containing:
sm::Vector{Float64}
: meanss::Vector{Float64}
: standard deviationsu::Vector{Float64}
: upper 95% CIsl::Vector{Float64}
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
msci95(s; n, method)
Calculate mean, standard deviation and 95% confidence interval.
Arguments
s::AbstractArray
n::Int64=3
: number of bootstrapsmethod::Symbol=:normal
: use normal method (:normal
) orn
-times boostrapping (:boot
)
Returns
Named tuple containing:
sm::Array{Float64}
: meanss::Array{Float64}
: standard deviationsu::Array{Float64}
: upper 95% CIsl::Array{Float64}
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
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 channelsn::Int64=3
: number of bootstrapsmethod::Symbol=:normal
: use normal (:normal
) method orn
-times bootstrapping (:boot
)
Returns
Named tuple containing:
sm::Matrix{Float64}
: meanss::Matrix{Float64}
: standard deviationsu::Matrix{Float64}
: upper 95% CIsl::Matrix{Float64}
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
msci95(s1, s2)
Calculate mean difference, standard deviation and 95% confidence interval.
Arguments
s1::AbstractVector
s2::AbstractVector
Returns
Named tuple containing:
sm::Float64
: meanss::Float64
: standard deviationsu::Float64
: upper 95% CIsl::Float64
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
msci95(s1, s2)
Calculate mean difference, standard deviation and 95% confidence interval.
Arguments
s1::AbstractArray
s2::AbstractArray
Returns
Named tuple containing:
sm::Array{Float64}
: meanss::Array{Float64}
: standard deviationsu::Array{Float64}
: upper 95% CIsl::Array{Float64}
: lower 95% CI
#
NeuroAnalyzer.msci95
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
sm::Matrix{Float64}
: meanss::Matrix{Float64}
: standard deviationsu::Matrix{Float64}
: upper 95% CI boundsl::Matrix{Float64}
: lower 95% CI bound
#
NeuroAnalyzer.pca
— Method.
pca(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) × epochpcv::Matrix{Float64}
: variance of PC(1)..PC(n) × epochpcm::PCA{Float64}
: PC meanpc_model::MultivariateStats.PCA{Float64}
: PC model
#
NeuroAnalyzer.pca
— Method.
pca(obj; ch, n)
Calculate n
first Primary Components (PCs).
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channelsn::Int64
: number of PCs to calculate
Returns
Named tuple containing:
pc::Array{Float64, 3}:
: PC(1)..PC(n) × epochpcv::Matrix{Float64}
: variance of PC(1)..PC(n) × epochpcm::Vector{Float64}
: PC meanpc_model::MultivariateStats.PCA{Float64}
: PC model
#
NeuroAnalyzer.pca_reconstruct
— Method.
pca_reconstruct(s, pc, pca)
Reconstructs signal using PCA components.
Arguments
s::AbstractArray
pc::AbstractArray:
: IC(1)..IC(n) × epochpc_model::MultivariateStats.PCA{Float64}:
: PC model
Returns
s_new::Array{Float64, 3}
#
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}=_c(channel_n(obj))
: index of channels, default is all 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}=_c(channel_n(obj))
: index of channels, default is all channels
#
NeuroAnalyzer.pca_reconstruct
— Method.
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) × epochpc_model::MultivariateStats.PCA{Float64}
: PC modelch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all 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) × epochpc_model::MultivariateStats.PCA{Float64}
: PC modelch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: index of channels, default is all channels
#
NeuroAnalyzer.phdiff
— Method.
phdiff(s1, s2; pad, h)
Calculate phase difference between signals.
Arguments
s1::AbstractVector
s2::AbstractVector
pad::Int64=0
: number of zeros to addh::Bool=false
: use FFT or Hilbert transformation (if h=true)
Returns
Named tuple containing:
phd::Vector{Float64}
: phase differences in radians
#
NeuroAnalyzer.phdiff
— Method.
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.phdiff
— Method.
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.pli
— Method.
pli(s1, s2)
Calculate PLI (Phase-Lag Index).
Arguments
s1::AbstractVector
s2::AbstractVector
Returns
Named tuple containing:
pv::Float64
: PLI valuesd::Vector{Float64}
: signal difference (s2 - s1)phd::Vector{Float64}
: phase difference (s2 - s1)s1ph::Vector{Float64}
: signal 1 phases2ph::Vector{Float64}
: signal 2 phase
#
NeuroAnalyzer.pli
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
pv::Array{Float64, 2}
: PLI valuesd::Array{Float64, 3}
: signal difference (s2 - s1)phd::Array{Float64, 3}
: phase difference (s2 - s1)s1ph::Array{Float64, 3}
: signal 1 phases2ph::Array{Float64, 3}
: signal 2 phase
#
NeuroAnalyzer.pli
— Method.
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.psd
— Method.
psd(s; fs, norm, mt, nt)
Calculate power spectrum density.
Arguments
s::Vector{Float64}
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
pw::Vector{Float64}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd
— Method.
psd(s; fs, norm, mt, nt)
Calculate power spectrum density.
Arguments
s::AbstractMatrix
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
pw::Array{Float64, 2}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd
— Method.
psd(s; fs, norm, mt, nt)
Calculate power spectrum density.
Arguments
s::AbstractArray
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd
— Method.
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 channelsnorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_mw
— Method.
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 withpad
zerosnorm::Bool=true
: normalize powers to dBfs::Int64
: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64=length(frq_lim[1]:frq_lim[2])
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesncyc::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)
forfrq = :log
orncyc=linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
pw::Matrix{Float64}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_mw
— Method.
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 withpad
zerosnorm::Bool=true
: normalize powers to dBfs::Int64
: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64=10
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesncyc::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)
forfrq = :log
orncyc = linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
pw::Array{Float64, 2}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_mw
— Method.
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 withpad
zerosnorm::Bool=true
: normalize powers to dBfs::Int64
: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64=10
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesncyc::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)
forfrq = :log
orncyc = linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_mw
— Method.
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 channelspad::Int64=0
: pad withpad
zerosnorm::Bool
=true: normalize powers to dBfrq_lim::Tuple{Real, Real}=(0, sr(obj) ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64=_tlength(frq_lim)
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesncyc::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)
forfrq = :log
orncyc=linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_rel
— Method.
psd_rel(s; fs, norm, mt, nt, f)
Calculate relative power spectrum density.
Arguments
s::AbstractVector
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapersf::Union(Tuple{Real, Real}, Nothing)=nothing
: calculate power relative to frequency range or total power
Returns
Named tuple containing:
pw::Vector{Float64}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_rel
— Method.
psd_rel(s; fs, norm, mt, nt, f)
Calculate relative power spectrum density.
Arguments
s::AbstractMatrix
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapersf::Union(Tuple{Real, Real}, Nothing)=nothing
: calculate power relative to frequency range or total power
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_rel
— Method.
psd_rel(s; fs, norm, mt, nt, f)
Calculate relative power spectrum density.
Arguments
s::AbstractArray
fs::Int64
: sampling ratenorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapersf::Union(Tuple{Real, Real}, Nothing)=nothing
: calculate power relative to frequency range or total power
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.psd_rel
— Method.
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 channelsnorm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapersf::Union(Tuple{Real, Real}, Nothing)=nothing
: calculate power relative to frequency range or total power
Returns
Named tuple containing:
pw::Array{Float64, 3}
: powerspf::Array{Float64, 3}
: frequencies
#
NeuroAnalyzer.psd_slope
— Method.
psd_slope(s; fs, f, norm, mt, nt)
Calculate PSD linear fit and slope.
Arguments
s::AbstractVector
fs::Int64
: sampling ratef::Tuple{Real, Real}=(0, fs ÷ 2)
: calculate slope of the total power (default) or frequency rangef[1]
tof[2]
norm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
lf::Vector{Float64}
: linear fitls::Float64
: slopes of linear fitpf::Vector{Float64}
: range of frequencies for the linear fit
#
NeuroAnalyzer.psd_slope
— Method.
psd_slope(s; fs, f, norm, mt, nt)
Calculate PSD linear fit and slope.
Arguments
s::AbstractArray
fs::Int64
: sampling ratef::Tuple{Real, Real}=(0, fs ÷ 2)
: calculate slope of the total power (default) or frequency rangef[1]
tof[2]
norm::Bool=false
: normalize do dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
lf::Matrix{Float64}
: linear fits::Vector{Float64}
: slope of linear fitpf::Vector{Float64}
: range of frequencies for the linear fit
#
NeuroAnalyzer.psd_slope
— Method.
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 channelsf::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 dBmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
Named tuple containing:
lf::Array{Float64, 3}
: linear fitls::Array{Float64, 2}
: slope of linear fitpf::Vector{Float64}
: range of frequencies for the linear fit
#
NeuroAnalyzer.rms
— Method.
rms(s)
Calculate Root Mean Square.
Arguments
s::AbstractVector
Returns
rms::Float64
#
NeuroAnalyzer.rms
— Method.
rms(s)
Calculate Root Mean Square.
Arguments
s::AbstractArray
Returns
r::Array{Float64, 2}
#
NeuroAnalyzer.rms
— Method.
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.rmse
— Method.
rmse(s1, s2)
Calculate Root Mean Square Error (RMSE).
Arguments
s1::AbstractVector
s2::AbstractVector
Returns
rmse::Float64
: RMSE
#
NeuroAnalyzer.rmse
— Method.
rmse(s1, s2)
Calculate Root Mean Square Error (RMSE).
Arguments
s1::AbstractArray
s2::AbstractArray
Returns
r::Array{Float64, 2}
: RMSE
#
NeuroAnalyzer.rmse
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(epoch_n(obj2))
: default use all epochs
Returns
Named tuple containing:
r::Array{Float64, 3}
: RMSEcps_ph::Array{Float64, 3}
: cross power spectrum phase (in radians)cps_fq::Vector{Float64, 3}
: cross power spectrum frequencies
#
NeuroAnalyzer.snr
— Method.
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.snr2
— Method.
snr2(s)
Calculate RMS-based SNR.
Arguments
s::AbstractVector
Returns
snr2::Float64
: SNR
#
NeuroAnalyzer.snr
— Method.
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:Nyquistf::Vector(Float64)
: frequencies
#
NeuroAnalyzer.snr
— Method.
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:Nyquistf::Vector(Float64)
: frequencies
#
NeuroAnalyzer.spec_seg
— Method.
spec_seg(sp, sf, st; t, f)
Return spectrogram segment.
Arguments
sp::Matrix{Float64}
: spectrogram powersst::Vector{Float64}
: spectrogram timesf::Vector{Float64}
: spectrogram frequenciest::Tuple{Real, Real}
: time boundsf::Tuple{Real, Real}
: frequency bounds
Returns
Named tuple containing:
segp::Matrix{Float64}
: powerssegs::Shape{Real, Int64}
: shape for plottingtidx::Tuple{Real, Real}
: time indicesfidx::Tuple{Real, Real}
: frequency indices
#
NeuroAnalyzer.spec_seg
— Method.
spec_seg(sp, sf, st; ch, t, f)
Return spectrogram segment.
Arguments
sp::AbstractArray
: spectrogram powersst::AbstractVector
: spectrogram timesf::AbstractVector
: spectrogram frequenciesch::Int64
: channelt::Tuple{Real, Real}
: time boundsf::Tuple{Real, Real}
: frequency bounds
Returns
Named tuple containing:
segp::Array{Float64, 3}
: segment of powerssegs::Shape{Real, Int64}
: segment coordinates (shape for plotting)tidx::Tuple{Real, Real}
: time indicesfidx::Tuple{Real, Real}
: frequency indices
#
NeuroAnalyzer.spectrogram
— Method.
spectrogram(s; fs, norm, mt, st)
Calculate spectrogram.
Arguments
s::AbstractVector
fs::Int64
: sampling frequencynorm::Bool=true
: normalize powers to dBmt::Bool=false
: if true use multi-tapered spectrogramst::Bool=false
: if true use short time Fourier transform
Returns
Named tuple containing:
sp::Matrix{Float64}
: powerssf::Vector{Float64}
: frequenciesst::Vector{Float64}
: time
#
NeuroAnalyzer.wspectrogram
— Method.
wspectrogram(s; pad, norm, fs, frq_lim, frq_n, frq, ncyc)
Calculate spectrogram using wavelet convolution.
Arguments
s::AbstractVector
pad::Int64
: pad withpad
zerosnorm::Bool=true
: normalize powers to dBfs::Int64
: sampling ratefrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64=_tlength(frq_lim)
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesncyc::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)
forfrq = :log
orncyc=linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :lin
Returns
Named tuple containing:
cs::Matrix(ComplexF64}
: convoluted signalsp::Matrix{Float64}
: powerssph::Matrix{Float64}
: phasessf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.ghspectrogram
— Method.
ghspectrogram(s; fs, norm, frq_lim, frq_n, frq, fs)
Calculate spectrogram using Gaussian and Hilbert transform.
Arguments
s::AbstractVector
fs::Int64
: sampling ratenorm::Bool=true
: normalize powers to dBfrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogramfrq_n::Int64_tlength(frq_lim)
: number of frequenciesfrq::Symbol=:log
: linear (:lin
) or logarithmic (:log
) frequenciesgw::Real=5
: Gaussian width in Hz
Returns
Named tuple containing:
sp::Matrix{Float64}
: powerssph::Matrix{Float64}
: phasessf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.cwtspectrogram
— Method.
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 waveletsfs::Int64
: sampling ratenorm::Bool=true
: normalize powers to dBfrq_lim::Tuple{Real, Real}=(0, fs ÷ 2)
: frequency bounds for the spectrogram
Returns
Named tuple containing:
sp::Matrix{Float64}
: powerssf::Vector{Float64}
: frequencies
#
NeuroAnalyzer.spectrogram
— Method.
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)
forfrq = :log
orncyc = linspace(ncyc[1], ncyc[2], frq_n)
forfrq = :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.spectrum
— Method.
spectrum(s; pad)
Calculate FFT, amplitudes, powers and phases.
Arguments
s::AbstractVector
pad::Int64=0
: number of zeros to addnorm::Bool=false
: normalize do dB
Returns
Named tuple containing:
ft::Vector{ComplexF64}
: Fourier transformssa::Vector{Float64}
: amplitudessp::Vector{Float64}
: powerssph::Vector{Float64}
: phases
#
NeuroAnalyzer.hspectrum
— Method.
hspectrum(s; pad=0)
Calculate amplitudes, powers and phases using Hilbert transform.
Arguments
s::AbstractVector
pad::Int64
: pad thes
withpad
zerosnorm::Bool=true
: normalize do dB
Returns
Named tuple containing:
hc::Vector(ComplexF64}
: Hilbert componentssa::Vector{Float64}
: amplitudessp::Vector{Float64}
: powerssph::Vector{Float64}
: phases
#
NeuroAnalyzer.hspectrum
— Method.
hspectrum(s; pad=0)
Calculate amplitudes, powers and phases using Hilbert transform.
Arguments
s::AbstractArray
pad::Int64
: pad thes
withpad
zerosnorm::Bool=true
: normalize do dB
Returns
Named tuple containing:
hc::Array(ComplexF64, 3}
: Hilbert componentssa::Array{Float64, 3}
: amplitudessp::Array{Float64, 3}
: powerssph::Array{Float64, 3}
: phases
#
NeuroAnalyzer.spectrum
— Method.
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 FFTh::Bool=false
: use Hilbert transform for calculations instead of FFTnorm::Bool=false
: normalize do dB
Returns
Named tuple containing:
c::Array{ComplexF64, 3}
: Fourier or Hilbert componentssa::Array{Float64, 3}
: amplitudessp::Array{Float64, 3}
: powers- `sph::Array{Float64, 3}: phase angles
#
NeuroAnalyzer.spectrum
— Method.
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 channelspad::Int64=0
: number of zeros to add signal for FFTh::Bool=false
: use Hilbert transform for calculations instead of FFTnorm::Bool=false
: normalize do dB
Returns
Named tuple containing:
c::Array{ComplexF64, 3}
: Fourier or Hilbert componentssa::Array{Float64, 3}
: amplitudessp::Array{Float64, 3}
: powers- `sph::Array{Float64, 3}: phase angles
#
NeuroAnalyzer.stationarity_hilbert
— Method.
stationarity_hilbert(s)
Calculate phase stationarity using Hilbert transformation.
Arguments
s::AbstractVector
Returns
stph::Vector{Float64}
#
NeuroAnalyzer.stationarity_mean
— Method.
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_var
— Method.
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.stationarity
— Method.
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 acrosswindow
-long windows:var
: variance acrosswindow
-long windows:cov
: covariance stationarity based on Euclidean distance between covariance matrix of adjacent time windows:hilbert
: phase stationarity using Hilbert transformation:adf
: Augmented Dickey–Fuller test; returns ADF-test value and p-value (H0: signal is non-stationary; p-value < alpha means that signal is stationary)
Returns
stationarity::Array{Float64, 3}
#
NeuroAnalyzer.epoch_stats
— Method.
epoch_stats(obj)
Calculate epochs statistics.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
e_mean::Vector(Float64)
: meane_median::Vector(Float64)
: mediane_std::Vector(Float64)
: standard deviatione_var::Vector(Float64)
: variancee_kurt::Vector(Float64)
: kurtosise_skew::Vector(Float64)
: skewnesse_mean_diff::Vector(Float64)
: mean diff valuee_median_diff::Vector(Float64)
: median diff valuee_max_dif::Vector(Float64)
: max differencee_dev_mean::Vector(Float64)
: deviation from channel mean
#
NeuroAnalyzer.channel_stats
— Method.
channel_stats(obj)
Calculate channels statistics per epoch.
Arguments
obj::NeuroAnalyzer.NEURO
Returns
Named tuple containing:
c_mean::Matrix(Float64)
: meanc_median::Matrix(Float64)
: medianc_std::Matrix(Float64)
: standard deviationc_var::Matrix(Float64)
: variancec_kurt::Matrix(Float64)
: kurtosisc_skew::Matrix(Float64)
: skewnessc_mean_diff::Matrix(Float64)
: mean diff valuec_median_diff::Matrix(Float64)
: median diff valuec_max_dif::Matrix(Float64)
: max differencec_dev_mean::Matrix(Float64)
: deviation from channel mean
#
NeuroAnalyzer.tcoherence
— Method.
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}
: coherencemsc::Vector{Float64}
: magnitude-squares coherenceic::Vector{Float64}
: imaginary part of coherence
#
NeuroAnalyzer.tcoherence
— Method.
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}
: coherencemsc::Array{Float64, 3}
: MSCic::Array{Float64, 3}
: imaginary part of coherence
#
NeuroAnalyzer.tcoherence
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2))
: default use all epochspad::Int64=0
: number of zeros to add signal for FFT
Returns
Named tuple containing:
c::Array{Float64, 3}
: coherencemsc::Array{Float64, 3}
: MSCic::Array{Float64, 3}
: imaginary part of coherence
#
NeuroAnalyzer.tkeo
— Method.
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.tkeo
— Method.
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.tkeo
— Method.
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_power
— Method.
total_power(s; fs, mt)
Calculate total power.
Arguments
s::AbstractVector
fs::Int64
: sampling ratemt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
tp::Float64
: total power
#
NeuroAnalyzer.total_power
— Method.
total_power(s; fs, mt)
Calculate total power.
`# Arguments
s::AbstractArray
fs::Int64
: sampling ratemt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
tp::Matrix{Float64}
: total power
#
NeuroAnalyzer.total_power
— Method.
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 channelsmt::Bool=false
: if true use multi-tapered periodogramnt::Int64=8
: number of Slepian tapers
Returns
tp::Matrix{Float64}
: total power
#
NeuroAnalyzer.vartest
— Method.
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.vartest
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::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.xcor
— Method.
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.xcor
— Method.
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.xcor
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2))
: default use all epochslag::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-correlationlag::Vector{Float64}
: lags [s]
#
NeuroAnalyzer.xcov
— Method.
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.xcov
— Method.
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.xcov
— Method.
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 channelsch2::Union{Int64, Vector{Int64}, AbstractRange}=signal_channels(obj2)
: index of channels, default is all signal channelsep1::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj1))
: default use all epochsep2::Union{Int64, Vector{Int64}, AbstractRange}=_c(epoch_n(obj2))
: default use all epochslag::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-covariancelag::Vector{Float64}
: lags [s]
Plot
#
NeuroAnalyzer.plot_compose
— Method.
plot_compose(p; <keyword arguments>)
Compose a complex plot of various plots contained in vector p
using layout layout
. Layout scheme is:
(2, 2)
: 2 × 2 plots, regular layoutgrid(4, 1, heights=[0.6, 0.1, 0.1, 0.1]
: 4 × 1 plots, irregular layout@layout [a{0.2w} b{0.8w};_ c{0.6}]
: complex layout using Plots.jl@layout
macro
Arguments
p::Vector{Plots.Plot{Plots.GRBackend}}
: vector of plotslayout::Union(Matrix{Any}, Tuple{Int64, Int64}, Plots.GridLayout}
: layoutmono::Bool=false
: use color or grey palettekwargs
: optional arguments forp
vector plots
Returns
pc::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_empty
— Method.
plot_empty()
Return an empty plot, useful for filling matrices of plots.
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_connections
— Method.
plot_connections(obj; <keyword arguments>)
Plot weights at electrode positions. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj)
: index of channels, default is all signal channelsconnections::Matrix{<:Real}
: matrix of connections weightsthreshold::Real
: plot all connection above thresholdthreshold_type::Symbol=:g
: rule for thresholding: = (:eq
), ≥ (:geq
), ≤ (:leq
), > (:g
), < (:l
)weights::Bool=true
: weight line widths and alpha based on connection valuechannel_labels::Bool=false
: plot channel labelshead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsplot_size::Int64=800
: plot dimensions in pixels (size × size)title::String=""
: plot titlekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_connections
— Method.
plot_connections(obj; <keyword arguments>)
Plot connections between channels. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Vector{Int64}, AbstractRange}
: channel(s) to plotconnections::Matrix{<:Real}
: matrix of connections weightsthreshold::Real
: plot all connection above thresholdthreshold_type::Symbol=:g
: rule for thresholding: = (:eq
), ≥ (:geq
), ≤ (:leq
), > (:g
), < (:l
)weights::Bool=true
: weight line widths and alpha based on connection valuechannel_labels::Bool=false
: plot channel labelshead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsplot_size::Int64=800
: plot dimensions in pixels (size × size)kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_dipole2d
— Method.
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_dipole3d
— Method.
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_erp
— Method.
plot_erp(t, s, bad; <keyword arguments>)
Plot ERP.
Arguments
t::Union{AbstractVector, AbstractRange}
: x-axis values (usually time)s::AbstractVector
: data to plotxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteyrev::Bool=false
: reverse Y axiskwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_erp_butterfly
— Method.
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 plotclabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteavg::Bool=false
: plot average ERPyrev::Bool=false
: reverse Y axiskwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_erp_avg
— Method.
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 plotxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteyrev::Bool=false
: reverse Y axiskwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_erp_topo
— Method.
plot_erp_topo(locs, t, s; <keyword arguments>)
Plot topographical map ERPs. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
locs::DataFrame
: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_spht::Vector{Float64}
: time vectors::Array{Float64, 2}
: ERPsch::Union{Vector{Int64}, AbstractRange}
: which channels to plotclabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titleyrev::Bool=false
: reverse Y axismono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
fig::GLMakie.Figure
#
NeuroAnalyzer.plot_erp_stack
— Method.
plot_erp_stack(s; <keyword arguments>)
Plot EPRs stacked by channels or by epochs.
Arguments
t::AbstractVector
: x-axis valuess::AbstractArray
clabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlecb::Bool=true
: plot color barcb_title::String=""
: color bar titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_erp
— Method.
plot_erp(obj; <keyword arguments>)
Plot ERP.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectch::Union{Int64, Vector{Int64}, <:AbstractRange}
: channel(s) to plottm::Union{Int64, Vector{Int64}}=0
: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time pointsxlabel::String="default"
: x-axis label, default is Time [ms]ylabel::String="default"
: y-axis label, default is Amplitude [units]title::String="default"
: plot title, default is ERP amplitude [channel: 1, epochs: 1:2, time window: -0.5 s:1.5 s]cb::Bool=true
: plot color barcb_title::String="default"
: color bar title, default is Amplitude [units]mono::Bool=false
: use color or grey palettepeaks::Bool=true
: draw peakschannel_labels::Bool=true
: draw labels legend (using channel labels) for multi-channel:butterfly
plottype::Symbol=:normal
: plot type::normal
, butterfly plot (:butterfly
), topographical plot of ERPs (:topo
) or stacked epochs/channels (:stack
)yrev::Bool=false
: reverse Y axisavg::Bool=false
: plot average ERP for:butterfly
plotkwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_filter_response
— Method.
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_locs
— Method.
plot_locs(locs; <keyword arguments>)
Preview of channel locations. It uses polar :loc_radius
and :loc_theta
locations, which are translated into Cartesian x and y positions.
Arguments
locs::DataFrame
: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}, <:AbstractRange}
: channel(s) to plotselected::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: selected channel(s) to plotch_labels::Bool=true
: plot channel labelshead::Bool=true
: draw headhead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsgrid::Bool=false
: draw grid, useful for locating positionsplot_size::Int64=400
: plot dimensions in pixels (size × size)
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_locs3d
— Method.
plot_locs3d(locs; <keyword arguments>)
3D interactive preview of channel locations. It uses spherical :locradiussph, :locthetasph and :locphisph locations.
Arguments
locs::DataFrame
: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}, <:AbstractRange}
: channel(s) to plotselected::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: selected channel(s) to plotch_labels::Bool=true
: plot channel labelshead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey paletteplot_size::Int64=800
: plot dimensions in pixels (plotsize×plotsize)
c
Returns
fig::GLMakie.Figure
#
NeuroAnalyzer.plot_locs
— Method.
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 channelsselected::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: which channel should be highlightedch_labels::Bool=true
: plot channel labelssrc_labels::Bool=false
: plot source labelsdet_labels::Bool=false
: plot detector labelsopt_labels::Bool=false
: plot optode type (S for source, D for detector) and numberhead::Bool=true
: draw headhead_labels::Bool=false
: plot head labelsplot_size::Int64=400
: plot dimensions in pixels (plotsize×plotsize)head_details::Bool=true
: draw nose and earsmono::Bool=false
: use color or grey palettethreed::Bool=false
: 3-dimensional plotgrid::Bool=false
: draw grid, useful for locating positionskwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
!!! warning "Missing docstring."
Missing docstring for NeuroAnalyzer.plot_locs_nirs(obj::NeuroAnalyzer.NEURO; grid::Bool=false, mono::Bool=false, plot_size::Int64=800)
. Check Documenter's build log for details.
#
NeuroAnalyzer.plot_locs_nirs
— Method.
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_sphch_pairs::Matrix{Int64}
: pairs of source and detectorsrc_n::Int64
: number of sourcesdet_n::Int64
: number of detectorsch::Union{Int64, Vector{Int64}, <:AbstractRange}
: channel(s) to plotselected::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: selected channel(s) to plotsrc_labels::Bool=false
: plot source labelsdet_labels::Bool=false
: plot detector labelsopt_labels::Bool=false
: plot optode type (S for source, D for detector) and numberhead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsgrid::Bool=false
: draw grid, useful for locating positionsplot_size::Int64=400
: plot dimensions in pixels (size × size)
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_psd
— Method.
plot_psd(sf, sp; <keyword arguments>)
Plot PSD (power spectrum density).
Arguments
sf::Vector{Float64}
: frequenciessp::Vector{Float64}
: powersnorm::Bool=true
: whether powers are normalized to dBfrq_lim::Tuple{Real, Real}=(sf[1], sf[end])
: frequency limit for the Y-axisxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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
— Method.
plot_psd(sf, sp; <keyword arguments>)
Plot multi-channel PSD (power spectrum density).
Arguments
sf::Vector{Float64}
: frequenciessp::Matrix{Float64}
: powersclabels::Vector{String}=[""]
: signal channel labels vectornorm::Bool=true
: whether powers are normalized to dBfrq_lim::Tuple{Real, Real}=(sf[1], sf[end])
: frequency limit for the Y-axisxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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_avg
— Method.
plot_psd_avg(sf, sp; <keyword arguments>)
Plot PSD mean and ±95% CI of averaged channels.
Arguments
sf::Vector{Float64}
: frequenciessp::Array{Float64, 3}
: powersxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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_butterfly
— Method.
plot_psd_butterfly(sf, sp; <keyword arguments>)
Butterfly PSD plot.
Arguments
sf::Vector{Float64}
: frequenciessp::Array{Float64, 3}
: powersclabels::Vector{String}=[""]
: signal channel labels vectornorm::Bool=true
: whether powers are normalized to dB- `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
xlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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_3d
— Method.
plot_psd_w3d(sf, sp; <keyword arguments>)
Plot 3-d waterfall PSD plot.
Arguments
sf::Vector{Float64}
: frequenciessp::Array{Float64, 3}
: powersclabels::Vector{String}=[""]
: signal channel labels vectornorm::Bool=true
: whether powers are normalized to dB- `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
xlabel::String=""
: x-axis labelylabel::String=""
: y-axis labelzlabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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_topo
— Method.
plot_psd_topo(locs, sf, sp; <keyword arguments>)
Plot topographical map PSDs. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
locs::DataFrame
: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sphsf::Vector{Float64}
: frequenciessp::Array{Float64, 3}
: powersch::Union{Vector{Int64}, AbstractRange}
: which channels to plotclabels::Vector{String}=[""]
: signal channel labels vectornorm::Bool=true
: whether powers are normalized to dB- `frq_lim::Tuple{Real, Real}=(sf[1], sf[end]): frequency limit for the x-axis
xlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteax::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
fig::GLMakie.Figure
#
NeuroAnalyzer.plot_psd
— Method.
plot_psd(obj; <keyword arguments>)
Plot power spectrum density.
Arguments
-
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO object -
ep::Int64=1
: 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_psd
— Method.
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 -
ep::Int64
: 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_save
— Method.
plot_save(p; file_name::String)
Saves plot as file (PDF/PNG/TIFF). File format is determined using file_name
extension.
Arguments
p::Union{Plots.Plot{Plots.GRBackend}, GLMakie.Figure}
file_name::String
#
NeuroAnalyzer.plot_signal
— Method.
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 plotclabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettescale::Bool=true
: draw scaleunits::String=""
: units of the scalekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_signal
— Method.
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 plotnorm::Bool=false
: normalize signal for butterfly and averaged plotsbad::Vector{Bool}}
: list of bad channelsclabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettescale::Bool=true
: draw scaleunits::String=""
: units of the scalekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_signal_avg
— Method.
plot_signal_avg(t, signal; <keyword arguments>)
Plot amplitude mean and ±95% CI of averaged signal
channels.
Arguments
t::Union{AbstractVector, AbstractRange}
: x-axis values (usually time)s::AbstractArray
: data to plotxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettescale::Bool=true
: draw scaleunits::String=""
: units of the scalenorm::Bool=false
: normalize to -1 .. +1kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_signal_butterfly
— Method.
plot_signal_butterfly(t, s; <keyword arguments>)
Butterfly plot of s
channels.
Arguments
t::Union{AbstractVector, AbstractRange}
: x-axis values (usually time)s::AbstractArray
: data to plotclabels::Vector{String}=[""]
: signal channel labels vectorxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlescale::Bool=true
: draw scaleunits::String=""
: units of the scalemono::Bool=false
: use color or grey palettenorm::Bool=false
: normalize to -1 .. +1kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot
— Method.
plot(obj; <keyword arguments>)
Plot signal.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectep::Union{Int64, AbstractRange}=0
: epoch to displaych::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: channel(s) to plot, default is all channelsseg::Tuple{Real, Real}=(0, 10)
: segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterxlabel::String="default"
: x-axis label, default is Time [s]ylabel::String="default"
: y-axis label, default is no labeltitle::String="default"
: plot title, default is Amplitude [channels: 1:2, epochs: 1:2, time window: 0 ms:20 s]mono::Bool=false
: use color or grey paletteemarkers::Bool
: draw epoch markers if availablemarkers::Bool
: draw markers if availablescale::Bool=true
: draw scaleunits::String=""
: units of the scaletype::Symbol=:normal
: plot type::normal
, mean ± 95%CI (:mean
), butterfly plot (:butterfly
)norm::Bool=false
: normalize signal for butterfly and averaged plotsbad::Union{Bool, Matrix{Bool}}=false
: list of bad channels; if not empty - plot bad channels using this listkwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot
— Method.
plot(obj, c; <keyword arguments>)
Plot embedded or external component.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectc::Union{Symbol, AbstractArray}
: component to plotep::Union{Int64, AbstractRange}=0
: epoch to displayc_idx::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: component channel to display, default is all component channelsseg::Tuple{Real, Real}=(0, 10)
: segment (from, to) in seconds to display, default is 10 seconds or less if single epoch is shorterxlabel::String="default"
: x-axis label, default is Time [s]ylabel::String="default"
: y-axis label, default is no labeltitle::String="default"
: plot title, default is Amplitude [channels: 1:2, epochs: 1:2, time window: 0 ms:20 s]mono::Bool=false
: use color or grey paletteemarkers::Bool
: draw epoch markers if availablemarkers::Bool
: draw markers if availablescale::Bool=true
: draw scaleunits::String=""
: units of the scaletype::Symbol=:normal
: plot type::normal
, mean ± 95%CI (:mean
), butterfly plot (:butterfly
)norm::Bool=false
: normalize signal for butterfly and averaged plotskwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_spectrogram
— Method.
plot_spectrogram(st, sf, sp; <keyword arguments>)
Plot single-channel spectrogram.
Arguments
st::Vector{Float64}
: timesf::Vector{Float64}
: frequenciessp::Array{Float64, 2}
: powersnorm::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 labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteunits::String=""
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_spectrogram
— Method.
plot_spectrogram(sch, sf, sp; <keyword arguments>)
Plot multiple-channel spectrogram.
Arguments
sch::Vector{String}
: channel labelssf::Vector{Float64}
: frequenciessp::Array{Float64, 2}
: powersnorm::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 labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey paletteunits::String=""
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_spectrogram
— Method.
plot_spectrogram(obj; <keyword arguments>)
Plots spectrogram.
Arguments
-
obj::NeuroAnalyzer.NEURO
-
ep::Int64
: 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 palettemarkers::Bool
: draw markers if availablekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_spectrogram
— Method.
plot_spectrogram(obj, c; <keyword arguments>)
Plots spectrogram of embedded or external component.
Arguments
-
obj::NeuroAnalyzer.NEURO
-
c::Union{Symbol, AbstractArray}
: component to plot -
ep::Int64
: 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 palettemarkers::Bool
: draw markers if availableunits::String=""
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_topo
— Method.
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, seenormalize()
-
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 -
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_topo
— Method.
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}=(1, 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, seenormalize()
-
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 -
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_topo
— Method.
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}=(1, 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, seenormalize()
-
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 -
kwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_matrix
— Method.
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 titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_xac
— Method.
plot_xac(m, lags; <keyword arguments>)
Plot cross/auto-covariance/correlation.
Arguments
m::Abstractvector
: covariance matrixlags::AbstractVector
: covariance lags, lags will be displayed in sxlabel::String="lag"
ylabel::String=""
title::String=""
cb_title::String=""
: color bar titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_histogram
— Method.
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 labelxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_bar
— Method.
plot_bar(s; <keyword arguments>)
Bar plot.
Arguments
s::AbstractVector
xlabels::Vector{String}
: x-ticks labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_line
— Method.
plot_line(s; <keyword arguments>)
Line plot.
Arguments
s::AbstractVector
xlabels::Vector{String}
: x-ticks labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_line
— Method.
plot_line(s; <keyword arguments>)
Line plot.
Arguments
s::AbstractArray
rlabels::Vector{String}
: signal rows labelsxlabels::Vector{String}
: x-ticks labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_box
— Method.
plot_box(s; <keyword arguments>)
Box plot.
Arguments
s::AbstractArray
glabels::Vector{String}
: group labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_violin
— Method.
plot_violin(s; <keyword arguments>)
Violin plot.
Arguments
s::AbstractArray
glabels::Vector{String}
: group labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_dots
— Method.
plot_dots(s; <keyword arguments>)
Dots plot.
Arguments
s::Vector{Vector{Float64}}
glabels::Vector{String}
: group labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_paired
— Method.
plot_paired(signal; <keyword arguments>)
Plot paired data.
Arguments
signal::Vector{Vector{Float64}}
glabels::Vector{String}
: group labelsxlabel::String=""
: x-axis labelylabel::String=""
: y-axis labeltitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_polar
— Method.
plot_polar(s; <keyword arguments>)
Polar plot.
Arguments
s::Union{AbstractVector, AbstractArray}
m::Tuple{Real, Real}=(0, 0)
: major value to plottitle::String=""
: plot titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_eros
— Method.
plot_eros(s, f, t; <keyword arguments>)
Plot ERO (Event-Related Oscillations) spectrogram.
Arguments
s::AbstractArray
: ERO spectrogramf::AbstractVector
: ERO frequenciest::AbstractVector
: ERO timetm::Union{Int64, Vector{Int64}}=0
: time markers (in miliseconds) to plot as vertical lines, useful for adding topoplots at these time pointsxlabel::String="default"
ylabel::String="default"
title::String="default"
cb::Bool=true
: draw color barcb_title::String="Power [dB]"
: color bar titlemono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_erop
— Method.
plot_erop(p, f; <keyword arguments>)
Plot ERO (Event-Related Oscillations) power-spectrum.
Arguments
p::AbstractArray
: ERO powersf::AbstractVector
: ERO frequenciesxlabel::String="default"
ylabel::String="default"
title::String="default"
mono::Bool=false
: use color or grey palettekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_weights
— Method.
plot_weights(locs; <keyword arguments>)
Plot weights at electrode positions. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
locs::DataFrame
: columns: channel, labels, loctheta, locradius, locx, locy, locz, locradiussph, locthetasph, locphi_sphch::Union{Int64, Vector{Int64}, <:AbstractRange}
: channel(s) to plotselected::Union{Int64, Vector{Int64}, <:AbstractRange}=0
: selected channel(s) to plotweights::Vector{<:Real}=[]
: weights vectorchannel_labels::Bool=true
: plot channel_labelshead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsplot_size::Int64=400
: plot dimensions in pixels (size × size)
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.plot_weights
— Method.
plot_weights(obj; <keyword arguments>)
Plot weights at electrode positions. It uses polar :locradius and :loctheta locations, which are translated into Cartesian x and y positions.
Arguments
obj::NeuroAnalyzer.NEURO
ch::Union{Int64, Vector{Int64}, <:AbstractRange}=signal_channels(obj)
: index of channels, default is all signal channelsweights::Matrix{<:Real}
: matrix of weightschannel_labels::Bool=false
: plot channel_labelshead_labels::Bool=true
: plot head labelsmono::Bool=false
: use color or grey palettehead_details::Bool=true
: draw nose and earsplot_size::Int64=800
: plot dimensions in pixels (size × size)title::String=""
: plot titlekwargs
: optional arguments for plot() function
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.preview
— Method.
preview(obj; <keyword arguments>)
Interactive preview of continuous or epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: channel(s) to plot, default is all channelsmono::Bool=false
: use color or grey palette
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.preview_ep
— Method.
preview_ep(obj; <keyword arguments>)
Interactive preview of epoched signal.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: channel(s) to plot, default is all channelsmono::Bool=false
: use color or grey palette
Returns
p::Plots.Plot{Plots.GRBackend}
#
NeuroAnalyzer.preview_cont
— Method.
preview_cont(obj; <keyword arguments>)
Interactive preview of continuous signal.
Arguments
obj::NeuroAnalyzer.NEURO
: NeuroAnalyzer NEURO objectch::Union{Int64, Vector{Int64}, <:AbstractRange}=_c(channel_n(obj))
: channel(s) to plot, default is all channelsmono::Bool=false
: use color or grey palette
Returns
p::Plots.Plot{Plots.GRBackend}
Statistics
#
NeuroAnalyzer.cmp_test
— Method.
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 leveltype::Symbol=:auto
: choose test automatically (:auto
), permutation-based (:perm
) parametric (:p
) or non-parametric (:np
)exact::Bool=false
: if true, use exact Wilcoxon testnperm::Int64=1000
: number of permutation for:perm
method
Returns
Named tuple containing for type !== :perm
:
t
: test resultsts::Tuple{Float64, String}
: test statisticstc::Tuple{Float64, Float64}
: test statistics confidence intervaldf::Int64
: degrees of freedomp::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-valuep2::Float64
: two-sided p-value
#
NeuroAnalyzer.cor_test
— Method.
cor_test(seg1, seg2)
Calculate correlation between two vectors.
Arguments
s1::AbstractVector
s2::AbstractVector
Returns
Named tuple containing:
t::CorrelationTest{Float64}
r::Float64
: correlation coefficientrc::Tuple{Float64, Float64}
: correlation coefficient confidence intervaltt::Tuple{Float64, String}
: t-statisticsdf::Int64
: degrees of freedomp::Float64
: p-value
#
NeuroAnalyzer.dprime
— Method.
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.effsize
— Method.
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 dg::Float64
: Hedges g
#
NeuroAnalyzer.hildebrand_rule
— Method.
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_similarity
— Method.
jaccard_similarity(x, y)
Calculate Jaccard similarity between two vectors x
and y
.
Arguments
x::AbstractVector
y::AbstractVector
Returns
j::Float64
#
NeuroAnalyzer.linreg
— Method.
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
: modelradj::Flpoat64
: R^2c::Vector{Float64}
: coefficientsse::Vector{Float64}
: standard error for coefficientsaic::Float64
:: Akaike’s Information Criterion (AIC)bic::Float64
:: Bayesian Information Criterion (BIC)lf::Vector{Float64}
: linear fit (plot(x, lf))
#
NeuroAnalyzer.infcrit
— Method.
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.meang
— Method.
meang(x)
Calculate geometric mean.
Arguments
x::AbstractVector
Returns
m::Float64
#
NeuroAnalyzer.meanh
— Method.
meanh(x)
Calculate harmonic mean.
Arguments
x::AbstractVector
Returns
m::Float64
#
NeuroAnalyzer.meanw
— Method.
meanw(x, w)
Calculate weighted mean.
Arguments
x::AbstractVector
w::AbstractVector
: weights
Returns
m::Float64
#
NeuroAnalyzer.meanc
— Method.
meanc(x; rad)
Calculate circular mean.
Arguments
x::AbstractVector
: anglesrad::Bool=false
: angles in radians (rad=true
) or degrees (rad=false
)
Returns
m::Float64
#
NeuroAnalyzer.z_score
— Method.
z_score(x)
Calculate Z-scores for each value of the vector x
.
Arguments
x::AbstractVector
Returns
z_score::Vector{Float64}
#
NeuroAnalyzer.k_categories
— Method.
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.se
— Method.
se(x)
Calculate standard error.
Arguments
x::AbstractVector
Returns
se::Float64
#
NeuroAnalyzer.rng
— Method.
rng(x)
Calculate range.
Arguments
x::AbstractVector
Returns
rng::Float64
#
NeuroAnalyzer.rng
— Method.
rng(x)
Calculate range.
Arguments
x::AbstractArray
Returns
rng::Float64
#
NeuroAnalyzer.moe
— Method.
moe(n)
Calculate margin of error for given sample size n
.
Arguments
n::Int64
Returns
moe::Float64
#
NeuroAnalyzer.cvar
— Method.
cvar(se, s)
Calculate coefficient of variation for statistic s
.
Arguments
se::Real
: standard errors::Real
: statistics, e.g. mean value
Returns
cvar::Float64
#
NeuroAnalyzer.effsize
— Method.
effsize(p1, p2)
Calculate effect size for two proportions p1
and p2
.
Arguments
p1::Float64
: 1st proportion, e.g. 0.7p2::Float64
: 2nd proportion, e.g. 0.3
Returns
e::Float64
#
NeuroAnalyzer.binom_prob
— Method.
binom_prob(p, r, n)
Calculate probability of exactly r
successes in n
trials.
Arguments
p::Float64
: proportion of successesr::Int64
: number of successesn::Int64
: number of trials
Returns
binom_prob::Float64
: probability
#
NeuroAnalyzer.binom_stat
— Method.
binom_stat(p, n)
Calculate mean and standard deviation for probability p
.
Arguments
p::Float64
: proportion of successesn::Int64
: number of trials
Returns
Named tuple containing:
m::Float64
: means::Float64
: standard deviation
#
NeuroAnalyzer.cvar_mean
— Method.
cvar_mean(x)
Calculate coefficient of variation for a mean.
Arguments
x::AbstractVector
Returns
cvar_mean::Float64
#
NeuroAnalyzer.cvar_median
— Method.
cvar_median(x)
Calculate coefficient of variation for a median.
Arguments
x::AbstractVector
Returns
cvar_median::Float64
#
NeuroAnalyzer.mcc
— Method.
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 positivestn::Int64
: number of true negativesfp::Int64
: number of false positivesfn::Int64
: number of false negatives
Returns
mcc::Float64
Source
https://finnstats.com/index.php/2022/09/06/assess-performance-of-the-classification-model/
#
NeuroAnalyzer.norminv
— Method.
norminv(x::Real)
Convert probability to a normal distribution with a peak at 0.5.
Arguments
x::Real
Returns
norminv::Float64
#
NeuroAnalyzer.outlier_detect
— Method.
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.grubbs
— Method.
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_int
— Method.
pred_int(n)
Calculates the prediction interval (95% CI adjusted for sample size)
Arguments
n::Int64
: sample size
Returns
pred_int::Float64
#
NeuroAnalyzer.prank
— Method.
prank(x)
Calculate percentile rank.
Arguments
x::AbstractVector
: the vector to analyze
Returns
p::Vector{Float64}
: percentile ranks
#
NeuroAnalyzer.dranks
— Function.
dranks(x, nbins)
Calculate ranks scaled in 0..nbins.
Arguments
x::AbstractArray
: some continuous variable such as reaction time (the time it takes to indicate the response)nbins::Int64
: number of bins, default is Sturges' formula
Returns
caf::Array{Float64}
#
NeuroAnalyzer.res_norm
— Function.
res_norm(x, g)
Test normal distribution of residuals.
Arguments
x::AbstractVector
: data valuesg::Vector{Int64}
: group(s) to which each data value belongs
Returns
Named tuple containing:
adt_p::Vector{Float64}
: p-values for k-sample Anderson–Darling test vs normal distributionks_p::Vector{Float64}
: p-values for one-sample exact Kolmogorov–Smirnov test vs normal distribution
Notes
p-values are reported for each group and for the whole sample. If there is only one group, p-values are returned only for the whole sample p-values are reported.
#
NeuroAnalyzer.seg_mean
— Method.
seg_mean(seg)
Calculate mean of a segment (e.g. spectrogram).
Arguments
seg::AbstractArray
Returns
seg_mean::Vector{Float64}
: averaged segment
#
NeuroAnalyzer.seg_mean
— Method.
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 1seg2::Vector{Float64}
: averaged segment 2
#
NeuroAnalyzer.sem_diff
— Method.
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_study
— Method.
study(obj, group)
Create NeuroAnalyzer STUDY object.
Arguments
obj::Vector{NeuroAnalyzer.NEURO}
group::Vector{Symbol}
Returns
study::NeuroAnalyzer.STUDY
#
NeuroAnalyzer.obj_n
— Method.
obj_n(study)
Return number of NeuroAnalyzer NEURO objects in the study.
Arguments
study::NeuroAnalyzer.STUDY
Returns
n::Int64
#
NeuroAnalyzer.channel_n
— Method.
channel_n(study)
Return number of channels per NeuroAnalyzer NEURO object in the study.
Arguments
study::NeuroAnalyzer.STUDY
Returns
n::Int64
#
NeuroAnalyzer.epoch_n
— Method.
epoch_n(study)
Return number of epochs per NeuroAnalyzer NEURO object in the study.
Arguments
study::NeuroAnalyzer.STUDY
Returns
n::Int64
#
NeuroAnalyzer.epoch_len
— Method.
epoch_len(study)
Return length of epochs per NeuroAnalyzer NEURO object in the study.
Arguments
study::NeuroAnalyzer.STUDY
Returns
len::Int64
#
NeuroAnalyzer.sr
— Method.
sr(study)
Return sampling rate of NeuroAnalyzer NEURO objects in the study.
Arguments
study::NeuroAnalyzer.STUDY
Returns
sr::Int64
NIBS
#
NeuroAnalyzer.ect_charge
— Method.
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_dose
— Method.
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
: delibvered charge density [kC/m²]
Source
Chhatbar PY, George MS, Kautz SA, Feng W. Quantitative reassessment of safety limits of tDCS for two animal studies. Brain Stimulation. 2017;10(5):1011–2.
#
NeuroAnalyzer.tes_protocol
— Method.
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 electrodescurrent::Real
: stimulation current [mA]frequency::Real=0
: stimulation frequency [mA]anode_size::Tuple{Int64, Int64}
: anode dimensions [mm]cathode_size::Tuple{Int64, Int64}
: cathode dimensions [mm]anode_loc::Symbol
: anode location (according to 10-20 Positioning System)cathode_loc::Symbol
: cathode location (according to 10-20 Positioning System)duration::Real
: stimulation duration [s]ramp_in::Real
: stimulation duration [s]ramp_out::Real
: stimulation duration [s]sham::Bool
: protocol includes sham stimulations
Returns
protocol::Dict