eelbrain.pipeline.RawSource

class eelbrain.pipeline.RawSource(filename='{subject}_{recording}-raw.fif', reader=<function read_raw_fif>, sysname=None, rename_channels=None, montage=None, connectivity=None, **kwargs)

Raw data source

Parameters:
  • filename (str) – Pattern for filenames. The pattern should contain the fields {subject} and {recording} (which internally is expanded to session and, if applicable, visit; default '{subject}_{recording}-raw.fif').

  • reader (Callable) – Function for reading data (default is mne.io.read_raw_fif()).

  • sysname (str) – Used to determine sensor positions (not needed for KIT files, or when a montage is specified).

  • rename_channels (dict) – Rename channels before applying montage, {from: to} dictionary; useful to convert idiosyncratic naming conventions to standard montages.

  • montage (str) – Name of a montage that is applied to raw data to set sensor positions.

  • connectivity (str | List[Tuple[str, str]] | Path) –

    Connectivity between sensors. Can be specified as:

    • list of connections (e.g., [('OZ', 'O1'), ('OZ', 'O2'), ...])

    • numpy.ndarray of int, shape (n_edges, 2), to specify connections in terms of indices. Each row should specify one connection [i, j] with i < j. If the array’s dtype is uint32, property checks are disabled to improve efficiency.

    • 'auto' to use mne.channels.find_ch_adjacency()

    • Path object to load connectivity from a file

    • "none" for no connections

    If unspecified, it is inferred from sysname if possible.

  • ... – Additional parameters for the reader function.

Examples

If you would load the EEG data like this:

form pathlib import Path

subject = '0001'
raw = mne.io.read_raw_brainvision(
    f'/data/eeg/{subject}/raw/task_{subject}.vhdr',
    eog=['EOG horizontal left', 'EOG horizontal right', 'EOG vertical below', 'EOG vertical above'],
)
raw.rename_channels({'FZ': 'Fz', 'OZ': 'Oz', 'CZ': 'Cz', 'Ref right mastoid': 'A1'})
raw.set_montage('standard_1020')

Then the equivalent RawSource is:

raw = {
    'raw': RawSource(
        'raw/{recording}_{subject}.vhdr',
        reader=mne.io.read_raw_brainvision,
        rename_channels={'FZ': 'Fz', 'OZ': 'Oz', 'CZ': 'Cz', 'Ref right mastoid': 'A1'},
        eog=['EOG horizontal left', 'EOG horizontal right', 'EOG vertical below', 'EOG vertical above'],
        montage='standard_1020'),
    ...
}