UnfoldBIDS._load_results
— Function_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()
UnfoldBIDS.add_event_files!
— Methodadd_event_files!(layoutDF)
Function to find and load all events file-paths into Layout-DataFrame.
UnfoldBIDS.bids_coeftable
— Methodbids_coeftable(model_df)
Turns all models found in model_df into tydy DataFrames and aggregates them in a new DataFrame.
UnfoldBIDS.bids_layout
— Methodbids_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 folderspecific_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 nothingtask::Union{Nothing,AbstractString} = nothing
Which task to load; loads all if nothingrun::Union{Nothing,AbstractString} = nothing
Which run to load; loads all if nothing
UnfoldBIDS.check_df
— Methodcheck_df(files_df, ses, task, run)
Internal; Checks if the multiple sessions/task/runs are found if none of these are provided
UnfoldBIDS.extract_subject_id!
— Methodextract_subject_id!(files_df, file)
Internal function to get subject information from dataframe.
UnfoldBIDS.list_all_paths
— Methodlist_all_paths(path)
Internal function to find pathfiles
UnfoldBIDS.load_bids_eeg_data
— Methodload_bids_eeg_data(layout_df; verbose::Bool=true, kwargs...)
Load data found with @Ref('bids_layout') into memory.
verbose::Bool = true
Show ProgressBarkwargs...
kwargs for CSV.read to load events from .tsv file; e.g. to specify delimeter
UnfoldBIDS.load_events
— Methodload_events(layoutDF::DataFrame; kwargs...)
Internal function to load events based on paths in the layout Df
UnfoldBIDS.load_results
— Methodload_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 pathsgenerate_Xs::Bool = true
Do not recreate the designmatrix; improves loading time.ses::Union{Nothing,AbstractString} = nothing
Which session to load; loads all if nothingtask::Union{Nothing,AbstractString} = nothing
Which task to load; loads all if nothingrun::Union{Nothing,AbstractString} = nothing
Which run to load; loads all if nothing
UnfoldBIDS.raw_to_data
— Methodraw_to_data(raw; channels::AbstractVector{<:Union{String,Integer}}=[])
Function to get data from MNE raw object. Can choose specific channels; default loads all channels.
UnfoldBIDS.rename_to_latency
— Methodrename_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)
UnfoldBIDS.run_unfold
— Methodrun_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 israw_to_data
which usesget_data
and allows to pickchannels
- see @Ref(raw_to_data
). The optional kw- arguments (e.g. channels) need to be specified directly in therun_unfold
function as kw-argsverbose::Bool = true)
Show ProgressBar or not.
UnfoldBIDS.save_results
— Methodsave_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.
UnfoldBIDS.unpack_events
— Methodunpack_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.
UnfoldBIDS.unpack_results
— Methodunpack_results(results_df)
Unpack all results into one tidy dataframe/ coeftable.