UnfoldBIDS._load_resultsFunction
_load_results(files_df; generate_Xs::Bool = true)

Internal function to load Unfold models into memory. Can also be used to load data after file information was loaded lazily (lazy=true) using load_results()

source
UnfoldBIDS.bids_coeftableMethod
bids_coeftable(model_df)

Turns all models found in model_df into tydy DataFrames and aggregates them in a new DataFrame.

source
UnfoldBIDS.bids_layoutMethod
bids_layout(bidsPath::AbstractString;
    derivatives::Bool=true,
    specific_folder::Union{Nothing,AbstractString}=nothing,
    exclude_folder::Union{Nothing,AbstractString}=nothing,
    ses::Union{Nothing,AbstractString}=nothing,
    task::Union{Nothing,AbstractString}=nothing,
    run::Union{Nothing,AbstractString}=nothing)

Main function to load paths of all subjects in one bidsroot folder. Will return a DataFrame containing all found paths with specific subject information. Used before loading data into memore using @Ref(`loadbidseegdata`)

Keywords

  • derivatives::Bool = true
    Look for data in the derivatives folder
  • specific_folder::Union{Nothing,AbstractString} = nothing
    Specify a specific folder name in either derivatives or bids_root to look for data.
  • exclude_folder::Union{Nothing,AbstractString} = nothing
    Exclude a specific folder from data detection.
  • ses:Union{Nothing,AbstractString} = nothing
    Which session to load; loads all if nothing
  • task::Union{Nothing,AbstractString} = nothing
    Which task to load; loads all if nothing
  • run::Union{Nothing,AbstractString} = nothing
    Which run to load; loads all if nothing
source
UnfoldBIDS.check_dfMethod
check_df(files_df, ses, task, run)

Internal; Checks if the multiple sessions/task/runs are found if none of these are provided

source
UnfoldBIDS.load_bids_eeg_dataMethod
load_bids_eeg_data(layout_df; verbose::Bool=true, kwargs...)

Load data found with @Ref('bids_layout') into memory.

  • verbose::Bool = true
    Show ProgressBar
  • kwargs...
    kwargs for CSV.read to load events from .tsv file; e.g. to specify delimeter
source
UnfoldBIDS.load_eventsMethod
load_events(layoutDF::DataFrame; kwargs...)

Internal function to load events based on paths in the layout Df

source
UnfoldBIDS.load_resultsMethod
load_results(bids_root::String;
    derivatives_subfolder::String="Unfold",
    lazy::Bool=false,
    generate_Xs::Bool = true,
    ses::Union{Nothing,AbstractString}=nothing,
    task::Union{Nothing,AbstractString}=nothing,
    run::Union{Nothing,AbstractString}=nothing)

Load Unfold models existing in a derivatives_subfolder in your BIDS root folder.

Keywords

  • derivatives_subfolder::String = "Unfold"
    Defines in which subfolder of bids_root/derivatives to look for Unfold models.
  • lazy::Bool = false
    Do not actually load the dataset into memore if true, only return a dataframe with paths
  • generate_Xs::Bool = true
    Do not recreate the designmatrix; improves loading time.
  • ses::Union{Nothing,AbstractString} = nothing
    Which session to load; loads all if nothing
  • task::Union{Nothing,AbstractString} = nothing
    Which task to load; loads all if nothing
  • run::Union{Nothing,AbstractString} = nothing
    Which run to load; loads all if nothing
source
UnfoldBIDS.raw_to_dataMethod
raw_to_data(raw; channels::AbstractVector{<:Union{String,Integer}}=[])

Function to get data from MNE raw object. Can choose specific channels; default loads all channels.

source
UnfoldBIDS.rename_to_latencyMethod
rename_to_latency(data_df)

This is a convenience function to add a :latency collumn (needed by Unfold) based on another variable in the events_df (e.g. sample)

source
UnfoldBIDS.run_unfoldMethod
run_unfold(dataDF, bfDict; 
	eventcolumn="event",
	remove_time_expanded_Xs=true, 
	extract_data = raw_to_data, 
	verbose::Bool=true, 
	kwargs...)

Run Unfold analysis on all data in dataDF.

Keywords

  • eventcolumn::String = "event"
    Which collumn Unfold should use during the analysis.
  • remove_time_expanded_Xs::Bool = true
    Removes the timeexpanded designmatrix which significantly reduces the memory-consumption. This Xs is rarely needed, but can be recovered (look into the Unfold.load function)
  • extract_data::function = raw_to_data
    Specify the function that translate the MNE Raw object to an data array. Default is raw_to_data which uses get_data and allows to pick channels - see @Ref(raw_to_data). The optional kw- arguments (e.g. channels) need to be specified directly in the run_unfold function as kw-args
  • verbose::Bool = true)
    Show ProgressBar or not.
source
UnfoldBIDS.save_resultsMethod
save_results(results::DataFrame, bids_root::String; 
    derivatives_subfolder::String="Unfold",
    overwrite::Bool=false)

Function to save unfold models in your BIDS root folder. Automatically creates a derivatives_subfolder (default = "Unfold") in the derivatives and subsequentely safes each model in results according to BIDS. Example of path so saved file: bids_root/derivatives/Unfold/sub-XXX/eeg/sub-XXX_ses-XX_task-XXX_run-XX_unfold.jld2

Keywords

  • derivatives_subfolder::String = "Unfold"
    Creates the named subfolder and saves Unfold models according to BIDS.
  • overwrite::Bool = false
    Does not overwrite existing datasets; can be set to true.
source
UnfoldBIDS.unpack_eventsMethod
unpack_events(df::DataFrame)

Unpack events into tidy data frame; useful with AlgebraOfGraphics.jl

df is expected to be a UnfoldBIDS DataFrame where events are loaded already.

source