Skip to content

Cheatsheet

Quick reference for common EEG processing tasks in EegFun.jl.

Data Import

I want to...Function
Load a BioSemi .bdf fileEegFun.read_raw_data("file.bdf")
Load a BrainVision fileEegFun.read_raw_data("file.vhdr")
Load an EEGLAB fileEegFun.read_eeglab("file.set")
Load a FieldTrip .mat fileEegFun.read_fieldtrip("file.mat")
Load a channel layoutEegFun.read_layout("layout.csv")
Create EegFun data structureEegFun.create_eegfun_data(raw, layout)

Data Persistence (JLD2)

I want to...Function
Save data to JLD2jldsave("file.jld2"; data = dat)
Load data from JLD2load("file.jld2", "data")
Smart-load EegFun dataEegFun.read_data("file.jld2")
Batch load all matching filesEegFun.read_all_data("dir/pattern")
Group loaded data by conditionEegFun.group_by_condition(data)

Preprocessing

I want to...Function
Rereference to averageEegFun.rereference!(dat, :avg)
Rereference to specific channelsEegFun.rereference!(dat, [:M1, :M2])
High-pass filterEegFun.highpass_filter!(dat, 0.1)
Low-pass filterEegFun.lowpass_filter!(dat, 30.0)
Bandpass filterEegFun.bandpass_filter!(dat, 0.1, 30.0)
Resample dataEegFun.resample!(dat, 256)
Apply baseline correctionEegFun.baseline!(dat, (-0.2, 0.0))
Create channel differenceEegFun.channel_difference!(dat, channel_selection1=channels([:C3]), channel_selection2=channels([:C4]), channel_out=:laterality)
Average channels into ROIEegFun.channel_average!(dat, channel_selections=[channels([:Fz, :Cz, :Pz])], output_labels=[:midline])
Delete channelsEegFun.channel_delete!(dat, channels([:M1, :M2]))
Mark extreme valuesEegFun.is_extreme_value!(dat, 100)
View trigger countsEegFun.trigger_count(dat)
Search trigger sequencesEegFun.search_sequence(dat.data.trigger, [1, 2])

ICA

I want to...Function
Run ICA decompositionEegFun.run_ica(dat)
Identify EOG componentsEegFun.identify_eog_components(dat, ica)
Identify ECG componentsEegFun.identify_ecg_components(dat, ica)
Identify line noise componentsEegFun.identify_line_noise_components(dat, ica)
Remove componentsEegFun.remove_ica_components!(dat, ica, component_selection=components([1, 3]))
Restore componentsEegFun.restore_ica_components!(dat, ica, component_selection=components([1]))

Epoching

I want to...Function
Define epoch conditionscfg = [EegFun.EpochCondition(name="Cond1", trigger_sequences=[[1]])]
Extract epochsEegFun.extract_epochs(dat, cfg, (-0.2, 1.0))
Baseline correct epochsEegFun.baseline!(epochs, (-0.2, 0.0))
Detect bad epochs automaticallyEegFun.detect_bad_epochs_automatic(epochs)
Detect bad epochs interactivelyEegFun.detect_bad_epochs_interactive(epochs)
Reject marked epochsEegFun.reject_epochs(epochs)
Repair artifacts (interpolation)EegFun.repair_artifacts(epochs)

ERP Operations

I want to...Function
Average epochs into ERPsEegFun.average_epochs(epochs)
Combine conditionsEegFun.condition_combine(erps, [[1, 2]])
Subtract conditionsEegFun.condition_difference(erps, [(1, 2)])
Average conditionsEegFun.condition_average(erps, [[1, 2]])
Compute grand averageEegFun.grand_average(all_erps)
Jackknife averageEegFun.jackknife_average(all_erps)
Compute GFPEegFun.gfp(erps)
Realign ERPsEegFun.realign(erps, :peak)
Compute LRPEegFun.lrp(erps, channel_selection1=channels([:C3]), channel_selection2=channels([:C4]))

ERP Measurements & Export

I want to...Function
Extract mean amplitudeEegFun.erp_measurements("erps", "mean_amplitude", analysis_interval=(0.3, 0.5))
Extract peak amplitudeEegFun.erp_measurements("erps", "max_peak_amplitude", analysis_interval=(0.3, 0.5))
Extract peak latencyEegFun.erp_measurements("erps", "max_peak_latency", analysis_interval=(0.3, 0.5))
Explore measurements in GUIEegFun.plot_erp_measurement_gui(erps)

Time-Frequency Analysis

I want to...Function
Morlet wavelet decompositionEegFun.tf_morlet(epochs, frequencies=4:1:30, n_cycles=3)
Multitaper decompositionEegFun.tf_multitaper(epochs, frequencies=4:1:30)
STFT decompositionEegFun.tf_stft(epochs, frequencies=4:1:30)
Baseline correct TF dataEegFun.tf_baseline!(tf, (-0.2, 0.0); method=:db)
TF channel averageEegFun.channel_average!(tf, channel_selections=[channels([:Fz, :Cz])], output_labels=[:frontal])
TF channel differenceEegFun.channel_difference!(tf, channel_selection1=channels([:C3]), channel_selection2=channels([:C4]))
TF condition differenceEegFun.condition_difference(tf_data, [(1, 2)])
TF condition averageEegFun.condition_average(tf_data, [[1, 2]])
TF grand averageEegFun.grand_average(all_tf)

Statistics

I want to...Function
Prepare group data for statsEegFun.prepare_stats("erps", :paired, condition_selection=conditions([1, 2]))
Run analytic t-testEegFun.analytic_test(stat_data)
Run permutation testEegFun.permutation_test(stat_data, n_permutations=1000)
Test decoding against chanceEegFun.test_against_chance(decoded_list)
Cluster permutation (decoding)EegFun.test_against_chance_cluster(decoded_list)

Plotting

I want to...Function
Browse continuous dataEegFun.plot_databrowser(dat)
Browse with ICAEegFun.plot_databrowser(dat, ica)
Plot ERPsEegFun.plot_erp(erps, channel_selection=channels(:Pz))
Plot topographyEegFun.plot_topography(erps, interval_selection=times(0.3, 0.5))
Plot ERP statisticsEegFun.plot_erp_stats(result, channel_selection=channels(:Pz))
Plot TF powerEegFun.plot_tf(tf, channel_selection=channels(:Cz))
Plot TF statisticsEegFun.plot_tf_stats(result, channel_selection=channels(:Cz))
Plot TF topography statsEegFun.plot_topography_stats(result, freq_range=(8.0, 12.0))
Plot ICA componentsEegFun.plot_topography(ica)
Plot epochs gridEegFun.plot_epochs(epochs)
Plot ERP imageEegFun.plot_erp_image(epochs, channel_selection=channels(:Pz))
Plot GFPEegFun.plot_gfp(erps)
Plot channel layoutEegFun.plot_layout_2d(layout)
Plot artifact detectionEegFun.plot_artifact_detection(epochs)
Plot frequency spectrumEegFun.plot_frequency_spectrum(dat)
Plot filter responseEegFun.plot_filter_response(dat)
Plot decoding resultsEegFun.plot_decoding(decoded)
Plot RSA resultsEegFun.plot_rsa(rsa_result)

Selection Helpers

I want to select...Helper
Specific channelsEegFun.channels([:Fz, :Cz, :Pz])
All channels exceptEegFun.channels_not([:M1, :M2])
Channel rangeEegFun.channels(1:32)
Specific conditionsEegFun.conditions([1, 2])
All conditions exceptEegFun.conditions_not([3])
Time intervalEegFun.times((0.3, 0.5))
Specific participantsEegFun.participants([1, 2, 3])
All participants exceptEegFun.participants_not([10])
Specific samplesEegFun.samples(:is_extreme_value_100)
All samples exceptEegFun.samples_not(:is_extreme_value_100)
Specific componentsEegFun.components([1, 3, 5])