Reference API

ffrprep.preproc - Preprocessing functions

preproc module for ffrprep.

Local imports are used inside functions so that Nipype Function nodes executed in separate processes have the necessary imports available at runtime. Avoid top-level imports for packages that are imported inside functions to prevent redefinition and lint warnings.

load_data([bids_root, sub_label, ...])

Identify and load EEG data from a BIDS directory using pybids for querying.

reference_data([eeg_data, ref_channels])

Re-reference the provided EEG data object.

filter_data([eeg_data, high_pass, low_pass])

Apply frequency filters to the provided EEG data object.

epoch_data(eeg_data, baseline[, ...])

Epoch the provided EEG data object based on events.

make_evoked(epochs[, by_event_type])

Create evoked responses by averaging epochs.

make_combined_evoked(epochs)

Average across every event in epochs, ignoring event_id groups.

make_difference_evokeds(evoked_dict[, pairs])

Compute A - B Evokeds for one or more trial-type pairs.

build_analysis_payload(epochs[, ...])

Compute the structured {by_type, combined, diff} analysis shape.

save_preprocessing_outputs(epochs, ...[, ...])

Save preprocessing outputs to BIDS derivatives structure.

save_analysis_outputs(evoked, bids_root, ...)

Save analysis outputs to BIDS derivatives structure.

create_preprocessing_workflow([name, ...])

Create nipype workflow for FFR preprocessing.

create_analysis_workflow([name])

Build a nipype workflow that averages epochs into evoked responses and saves them to BIDS-derivatives.

ffrprep.analysis - FFR analysis functions

compute_power(avg_evoked[, f_low, f_high, ...])

Compute the average oscillatory power of a given frequency band.

rms_snr(evoked[, response_lower, response_upper])

Compute RMS-based signal-to-noise ratio (SNR) for an Evoked response.

autocorrelation(evoked)

Autocorrelation function and 95% CI for the first channel of evoked.

compute_pitch_and_conf(evoked[, win_dur, ...])

Compute the pitch (f0) and confidence metrics for an Evoked response.

plot_pitch_and_conf(results)

Plot a smoothed pitch track together with associated confidence measures.

compute_phase_consistency(epochs_A, epochs_B)

Compute phase consistency from FFR epochs.

plot_phase_consistency(phasecon, xaxis, yaxis)

Plot phase consistency matrices.

plot_phase_consistency_masked(phasecon, ...)

Plot phase consistency with significance masking.

corr_stim_to_resp(stim, resp, sfreq)

Compute the correlation between stimulus and brain response.

corr_resp_to_resp(resp1, resp2, sfreq)

Compute the correlation between two brain responses.

response_consistency(epochs[, tmin, tmax, picks])

Compute trial-to-trial response consistency from an MNE Epochs object.

compute_fft(signal_data, sfreq[, fmin, fmax])

Compute the FFT amplitude spectrum for a time-domain signal.

ffrprep.reports - Report builders

This module provides functions for creating, updating, and saving MNE reports.

For FFRPREP BIDS datasets, including support for figures, HTML blocks, and special MNE objects.

build_raw_section(raw, *, section_id, title)

Build a section descriptor from a Raw object.

build_epoch_section(epochs, *, section_id, title)

Build a section descriptor from an Epochs object.

build_evoked_section(evoked, *, section_id, ...)

Build a section descriptor from an Evoked object.

build_phase_consistency_section(epochs_a, ...)

Build a phase-consistency section from two polarities of Epochs.

make_group(*, sections[, session, task, ...])

Construct a group descriptor consumable by the report builders.

build_subject_report(bids_root, subject, out_dir)

Render a single-file HTML preprocessing report for a subject.

build_analysis_report(bids_root, subject, ...)

Render a single-file HTML analysis report for a subject.

evoked_qa(evoked[, save_dir, prefix])

Generate FFR-specific QA figures for an mne.Evoked object.

epoch_qa(epochs[, save_dir, prefix])

Generate QA figures for an mne.Epochs object.

ffrprep.datasets - Dataset functions

download_example_data([dataset_path, ...])

Download example EEG data (1 subject) for testing and tutorials.

download_raw_data([subjects, dataset_path, ...])

Download raw EEG data for specified subjects from OSF.

download_epoch_data([subjects, dataset_path])

Download epoched EEG data for specified subjects from OSF.

download_stimuli([dataset_path])

Download FFR stimulus files into a BIDS-compliant stimuli/ directory.

ffrprep.utils - Utility functions

Utility functions for validating BIDS directories and related operations.

validate_input_dir(exec_env, bids_dir, ...)

Validate BIDS directory and structure via the BIDS-validator.