NeuroAnalyzer tutorials: Analyze EEG (1)

Load data:

using NeuroAnalyzer
eeg = load("files/eeg.hdf");
[ Info: Loaded: EEG (24 × 308480 × 1; 1204.996 s)

Any analysis data (e.g. ICA, PCA) can be stored within the NeuroAnalyzer object as a component.

For more details, see add_component(), list_component(), delete_component(), rename_component(), component_type(), extract_component().

(!) All components are removed from the object when the signal data is altered in any way (e.g. channel removal, filtering).

(!) All components are saved together with the signal data when using the native NeuroAnalyzer format (HDF5).

Add component:

e = epoch_stats(eeg)
add_component!(eeg, c=:epoch_mean, v=e[1])

Show components:

list_component(eeg)

Get component type:

component_type(eeg, c=:epoch_mean)
Vector{Float64} (alias for Array{Float64, 1})

Get data of the embedded component:

extract_component(eeg, c=:epoch_mean)
1-element Vector{Float64}:
 0.07735638622613686

Delete component:

delete_component(eeg, c=:epoch_mean)
NeuroAnalyzer.NEURO(NeuroAnalyzer.HEADER(Dict{Symbol, Any}(:weight => -1, :id => "", :middle_name => "", :height => -1, :head_circumference => -1, :handedness => "", :last_name => "528004  SIT 52, 20220831-122227-{d589f756-53fc-4f1b-915d-6e3b8c1560ad}", :first_name => ""), Dict{Symbol, Any}(:epoch_id => "", :channel_type => ["eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg"  …  "eeg", "eeg", "ref", "ref", "eeg", "eeg", "eeg", "eog", "eog", "ecg"], :label => ["Fp1", "Fp2", "F3", "F4", "C3", "C4", "P3", "P4", "O1", "O2"  …  "T5", "T6", "A1", "A2", "Fz", "Cz", "Pz", "EOG1", "EOG2", "ECG"], :prefiltering => ["HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz"  …  "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz"], :gain => [0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218  …  0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218], :data_type => "eeg", :recording_notes => "", :recording_date => "31.08.22", :sampling_rate => 256, :file_type => "EDF"…), Dict(:name => "", :design => "", :notes => "")), [0.0, 0.004, 0.008, 0.012, 0.016, 0.02, 0.023, 0.027, 0.031, 0.035  …  1204.961, 1204.965, 1204.969, 1204.973, 1204.977, 1204.98, 1204.984, 1204.988, 1204.992, 1204.996], [0.0, 0.004, 0.008, 0.012, 0.016, 0.02, 0.023, 0.027, 0.031, 0.035  …  1204.961, 1204.965, 1204.969, 1204.973, 1204.977, 1204.98, 1204.984, 1204.988, 1204.992, 1204.996], [0.06299352498755795 98.63512726760528 … -3.1830986460670267 0.0006574697346035663; 0.11655563660927726 -53.828853350413745 … 2.690060794085174 0.0004150149321296981; … ; -0.022184604323419066 127.03733086748798 … -0.6385598239986807 0.0008236881401195717; -0.055585528301492104 530.00037195304 … -8.80813398237423 0.0018241535887852933;;;], Dict{Any, Any}(), 0×5 DataFrame
 Row  id      start    length   description  channel  String  Float64  Float64  String       Int64   
─────┴────────────────────────────────────────────────, 23×9 DataFrame
 Row  label   loc_radius  loc_theta  loc_x    loc_y    loc_z    loc_radius_sp ⋯
     │ String  Float64     Float64    Float64  Float64  Float64  Float64       ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ Fp1           1.0       108.0    -0.31     0.95    -0.03            1.0 ⋯
   2 │ Fp2           1.0        72.0     0.31     0.95    -0.03            1.0
   3 │ F7            1.0       144.0    -0.81     0.59    -0.03            1.0
   4 │ F3            0.65      129.0    -0.55     0.67     0.5             1.0
   5 │ Fz            0.51       90.0     0.0      0.72     0.7             1.0 ⋯
   6 │ F4            0.65       51.0     0.55     0.67     0.5             1.0
   7 │ F8            1.0        36.0     0.81     0.59    -0.03            1.0
   8 │ T3            1.0       180.0    -1.0      0.0     -0.03            1.0
   9 │ C3            0.51      180.0    -0.72     0.0      0.7             1.0 ⋯
  10 │ Cz            0.0         0.0     0.0      0.0      1.0             1.0
  11 │ C4            0.51        0.0     0.72     0.0      0.7             1.0
  ⋮  │   ⋮         ⋮           ⋮         ⋮        ⋮        ⋮           ⋮       ⋱
  14 │ P3            0.65      231.0    -0.55    -0.67     0.5             1.0
  15 │ Pz            0.51      270.0     0.0     -0.72     0.7             1.0 ⋯
  16 │ P4            0.65      309.0     0.55    -0.67     0.5             1.0
  17 │ T6            1.0       324.0     0.81    -0.59    -0.03            1.0
  18 │ O1            1.0       252.0    -0.31    -0.95    -0.03            1.0
  19 │ O2            1.0       288.0     0.31    -0.95    -0.03            1.0 ⋯
  20 │ A1            1.0       192.0    -0.92    -0.23    -0.55            1.1
  21 │ A2            1.0       -12.0     0.92    -0.23    -0.55            1.1
  22 │ EOG1          1.01      149.0    -0.87     0.51    -0.37            1.0
  23 │ EOG2          1.01       31.0     0.87     0.51    -0.37            1.0 ⋯
                                                    3 columns and 2 rows omitted, ["reset_components(OBJ)", "filter(OBJ, ch=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], fprototype=iirnotch, ftype=nothing, cutoff=50, order=8, rp=-1, rs=-1, dir=twopass, w=nothing)", "reset_components(OBJ)", "filter(OBJ, ch=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], fprototype=fir, ftype=hp, cutoff=0.1, order=8, rp=-1, rs=-1, dir=twopass, w=nothing)", "add_component(OBJ, c=epoch_mean, v", "delete_component(OBJ, c=epoch_mean)"])

Delete all components:

reset_components(eeg)
NeuroAnalyzer.NEURO(NeuroAnalyzer.HEADER(Dict{Symbol, Any}(:weight => -1, :id => "", :middle_name => "", :height => -1, :head_circumference => -1, :handedness => "", :last_name => "528004  SIT 52, 20220831-122227-{d589f756-53fc-4f1b-915d-6e3b8c1560ad}", :first_name => ""), Dict{Symbol, Any}(:epoch_id => "", :channel_type => ["eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg", "eeg"  …  "eeg", "eeg", "ref", "ref", "eeg", "eeg", "eeg", "eog", "eog", "ecg"], :label => ["Fp1", "Fp2", "F3", "F4", "C3", "C4", "P3", "P4", "O1", "O2"  …  "T5", "T6", "A1", "A2", "Fz", "Cz", "Pz", "EOG1", "EOG2", "ECG"], :prefiltering => ["HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz"  …  "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz", "HP:0,18Hz LP:104,0Hz"], :gain => [0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218  …  0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218, 0.17935713740749218], :data_type => "eeg", :recording_notes => "", :recording_date => "31.08.22", :sampling_rate => 256, :file_type => "EDF"…), Dict(:name => "", :design => "", :notes => "")), [0.0, 0.004, 0.008, 0.012, 0.016, 0.02, 0.023, 0.027, 0.031, 0.035  …  1204.961, 1204.965, 1204.969, 1204.973, 1204.977, 1204.98, 1204.984, 1204.988, 1204.992, 1204.996], [0.0, 0.004, 0.008, 0.012, 0.016, 0.02, 0.023, 0.027, 0.031, 0.035  …  1204.961, 1204.965, 1204.969, 1204.973, 1204.977, 1204.98, 1204.984, 1204.988, 1204.992, 1204.996], [0.06299352498755795 98.63512726760528 … -3.1830986460670267 0.0006574697346035663; 0.11655563660927726 -53.828853350413745 … 2.690060794085174 0.0004150149321296981; … ; -0.022184604323419066 127.03733086748798 … -0.6385598239986807 0.0008236881401195717; -0.055585528301492104 530.00037195304 … -8.80813398237423 0.0018241535887852933;;;], Dict{Any, Any}(), 0×5 DataFrame
 Row  id      start    length   description  channel  String  Float64  Float64  String       Int64   
─────┴────────────────────────────────────────────────, 23×9 DataFrame
 Row  label   loc_radius  loc_theta  loc_x    loc_y    loc_z    loc_radius_sp ⋯
     │ String  Float64     Float64    Float64  Float64  Float64  Float64       ⋯
─────┼──────────────────────────────────────────────────────────────────────────
   1 │ Fp1           1.0       108.0    -0.31     0.95    -0.03            1.0 ⋯
   2 │ Fp2           1.0        72.0     0.31     0.95    -0.03            1.0
   3 │ F7            1.0       144.0    -0.81     0.59    -0.03            1.0
   4 │ F3            0.65      129.0    -0.55     0.67     0.5             1.0
   5 │ Fz            0.51       90.0     0.0      0.72     0.7             1.0 ⋯
   6 │ F4            0.65       51.0     0.55     0.67     0.5             1.0
   7 │ F8            1.0        36.0     0.81     0.59    -0.03            1.0
   8 │ T3            1.0       180.0    -1.0      0.0     -0.03            1.0
   9 │ C3            0.51      180.0    -0.72     0.0      0.7             1.0 ⋯
  10 │ Cz            0.0         0.0     0.0      0.0      1.0             1.0
  11 │ C4            0.51        0.0     0.72     0.0      0.7             1.0
  ⋮  │   ⋮         ⋮           ⋮         ⋮        ⋮        ⋮           ⋮       ⋱
  14 │ P3            0.65      231.0    -0.55    -0.67     0.5             1.0
  15 │ Pz            0.51      270.0     0.0     -0.72     0.7             1.0 ⋯
  16 │ P4            0.65      309.0     0.55    -0.67     0.5             1.0
  17 │ T6            1.0       324.0     0.81    -0.59    -0.03            1.0
  18 │ O1            1.0       252.0    -0.31    -0.95    -0.03            1.0
  19 │ O2            1.0       288.0     0.31    -0.95    -0.03            1.0 ⋯
  20 │ A1            1.0       192.0    -0.92    -0.23    -0.55            1.1
  21 │ A2            1.0       -12.0     0.92    -0.23    -0.55            1.1
  22 │ EOG1          1.01      149.0    -0.87     0.51    -0.37            1.0
  23 │ EOG2          1.01       31.0     0.87     0.51    -0.37            1.0 ⋯
                                                    3 columns and 2 rows omitted, ["reset_components(OBJ)", "filter(OBJ, ch=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], fprototype=iirnotch, ftype=nothing, cutoff=50, order=8, rp=-1, rs=-1, dir=twopass, w=nothing)", "reset_components(OBJ)", "filter(OBJ, ch=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24], fprototype=fir, ftype=hp, cutoff=0.1, order=8, rp=-1, rs=-1, dir=twopass, w=nothing)", "add_component(OBJ, c=epoch_mean, v", "reset_components(OBJ)"])