msqms.io.raw_dataset module

msqms.io.raw_dataset module#

Read Raw datasets DatasetFormat: Format 1 (Subject directories): - datasets dir/

  • sub01/ *.fif

  • sub02/ *.fif

… - sub03/ *.fif

or Format 2 (Single directory): - datasets dir/

  • *.fif

Get all fif file,and return the raw object lists.

Summary#

Functions:#

read_raw_dataset

Finds raw data file paths with the specified suffix from subdirectories or directly within a specified dataset directory.

Reference#

msqms.io.raw_dataset.read_raw_dataset(dataset_dir, file_suffix='.fif', dataset_format=None)[source]#

Finds raw data file paths with the specified suffix from subdirectories or directly within a specified dataset directory. It supports both standard MNE formats (.fif) and CTF formats (.ds).

This function checks that the dataset follows one of two possible structures: - datasets dir/

  • sub01/
    • *.fif (or *.ds)

  • sub02/
    • *.fif (or *.ds)

OR - datasets dir/

  • *.fif (or *.ds)

Parameters:
  • dataset_dir (str) – The path to the main directory containing raw data files. This can either be a directory containing subdirectories for each subject or just a collection of raw data files in the main directory.

  • file_suffix (str, optional) – The suffix of the files to find (default is ‘.fif’). Can be ‘.fif’ for MNE datasets or ‘.ds’ for CTF datasets.

  • dataset_format (str, optional) – The format of the dataset. Can be one of: - ‘format1’: Dataset with subject subdirectories. - ‘format2’: Dataset with raw data files directly in the main directory. If not provided, the function will attempt to detect the format automatically.

Returns:

raw_list – A list of file paths of the raw data files found in the subdirectories or directly in the dataset directory.

Return type:

list of str

Raises:

ValueError – If the dataset directory doesn’t follow the expected structure or contains unsupported file types.

Notes

This function assumes that the dataset directory contains either: - subdirectories for each subject, each containing one or more raw data files with the specified suffix, OR - just raw data files directly within the main directory.

Example

dataset_dir = “/path/to/dataset” raw_list = read_raw_dataset(dataset_dir, file_suffix=’.fif’, dataset_format=’format1’)

# Print the file paths for path in raw_list:

print(path)