Skip to content

set2bids - 2 bugs on set files. #118

@regisoc

Description

@regisoc

Describe the bug
When trying to upload/parse a .set file two types of behaviour appeared.
Extracted from: https://docs.google.com/document/d/104zOjSfpGifbEgERGuI-6UTma1i_r4rHlmKc0ZSFl-o/edit?usp=sharing

Browser Environment (please complete the following information):

  • OS: Manjaro Linux x86_64
  • Kernel: 6.1.53-1-MANJARO
  • python: 3.8.18
  • node: v16.20.1
  • npm: v8.19.4

List

Case 1: `Cannot read file - list index out of range`

Logs:
Case 1:

127.0.0.1 - - [22/Nov/2023 10:45:55] "GET /socket.io/?EIO=4&transport=polling HTTP/1.1" 200 242 0.000417
(3541620) accepted ('127.0.0.1', 43558)
connect:  9bU2t8_FzNRciT9nAAAC
get_set_data: {'files': [{'path': '/home/seden/work/bids/1234-1234-FACE.set', 'task': 'FACE', 'run': 1}]}
{'files': [{'path': '/home/seden/work/bids/1234-1234-FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01 00:00:00', 'fileFormat': 'set'}
get_set_data: {'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}]}
{'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01 00:00:00', 'fileFormat': 'set'}
BIDS Conversion - START
eeg_to_bids:  {'eegData': {'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01T05:00:00.000Z', 'fileFormat': 'set'}, 'fileFormat': 'set', 'eegRuns': [{'eegFile': '/home/seden/work/bids/1234_1234_FACE.set', 'eegBIDSBasename': None, 'eventFile': None, 'task': 'FACE', 'run': 1}], 'modality': 'eeg', 'bids_directory': '/home/seden/work/EEG2BIDS_output', 'read_only': False, 'event_files': '', 'site_id': '', 'project_id': '', 'sub_project_id': '', 'session': '1234', 'participantID': '1234', 'preparedBy': 'roc', 'bidsMetadata': '', 'reference': '1234', 'powerLineFreq': '50', 'subject_id': '', 'outputFilename': '1234_1234_bids', 'age': 'n/a', 'sex': 'n/a', 'project': 'n/a', 'cohort': 'n/a'}
eeg_to_bids_thread: {'eegData': {'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01T05:00:00.000Z', 'fileFormat': 'set'}, 'fileFormat': 'set', 'eegRuns': [{'eegFile': '/home/seden/work/bids/1234_1234_FACE.set', 'eegBIDSBasename': None, 'eventFile': None, 'task': 'FACE', 'run': 1}], 'modality': 'eeg', 'bids_directory': '/home/seden/work/EEG2BIDS_output', 'read_only': False, 'event_files': '', 'site_id': '', 'project_id': '', 'sub_project_id': '', 'session': '1234', 'participantID': '1234', 'preparedBy': 'roc', 'bidsMetadata': '', 'reference': '1234', 'powerLineFreq': '50', 'subject_id': '', 'outputFilename': '1234_1234_bids', 'age': 'n/a', 'sex': 'n/a', 'project': 'n/a', 'cohort': 'n/a'}
- Time: init started.
- Converter: init started.
Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 286, in to_bids
	raw = mne.io.read_raw_eeglab(input_fname=file, preload=False, verbose=True)
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 311, in read_raw_eeglab
	return RawEEGLAB(
  File "<decorator-gen-305>", line 10, in __init__
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 432, in __init__
	raise TypeError(
TypeError: The number of trials is 23. It must be 1 for raw files. Please use `mne.io.read_epochs_eeglab` if the .set file contains epochs.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 289, in to_bids
	raw = mne.io.read_epochs_eeglab(input_fname=file, verbose=True)
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 377, in read_epochs_eeglab
	epochs = EpochsEEGLAB(
  File "<decorator-gen-306>", line 10, in __init__
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 644, in __init__
	events[idx, 0] = event_latencies[idx]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/eeg2bids.py", line 436, in eeg_to_bids_thread
	iEEG.Converter(data)  # EDF to BIDS format.
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 219, in __init__
	eegRun['eegBIDSBasename'] = self.to_bids(
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 291, in to_bids
	raise ReadError(ex)
python.libs.iEEG.ReadError: list index out of range

{'error': 'Cannot read file - list index out of range'}
{'error': 'Cannot read file - list index out of range'}
Case 2: `Cannot read file - The file does not seem to contain epochs (trials less than 2). You should try using read_raw_eeglab function.`
BIDS Conversion - START
eeg_to_bids:  {'eegData': {'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01T05:00:00.000Z', 'fileFormat': 'set'}, 'fileFormat': 'set', 'eegRuns': [{'eegFile': '/home/seden/work/bids/1234_1234_FACE.set', 'eegBIDSBasename': None, 'eventFile': None, 'task': 'FACE', 'run': 1}], 'modality': 'eeg', 'bids_directory': '/home/seden/work/EEG2BIDS_output', 'read_only': False, 'event_files': '', 'site_id': '', 'project_id': '', 'sub_project_id': '', 'session': '1234', 'participantID': '1234', 'preparedBy': 'roc', 'bidsMetadata': '', 'reference': '1234', 'powerLineFreq': '50', 'subject_id': '', 'outputFilename': '1234_1234_bids', 'age': 'n/a', 'sex': 'n/a', 'project': 'n/a', 'cohort': 'n/a'}
eeg_to_bids_thread: {'eegData': {'files': [{'path': '/home/seden/work/bids/1234_1234_FACE.set', 'task': 'FACE', 'run': 1}], 'subjectID': '', 'recordingID': '', 'date': '2000-01-01T05:00:00.000Z', 'fileFormat': 'set'}, 'fileFormat': 'set', 'eegRuns': [{'eegFile': '/home/seden/work/bids/1234_1234_FACE.set', 'eegBIDSBasename': None, 'eventFile': None, 'task': 'FACE', 'run': 1}], 'modality': 'eeg', 'bids_directory': '/home/seden/work/EEG2BIDS_output', 'read_only': False, 'event_files': '', 'site_id': '', 'project_id': '', 'sub_project_id': '', 'session': '1234', 'participantID': '1234', 'preparedBy': 'roc', 'bidsMetadata': '', 'reference': '1234', 'powerLineFreq': '50', 'subject_id': '', 'outputFilename': '1234_1234_bids', 'age': 'n/a', 'sex': 'n/a', 'project': 'n/a', 'cohort': 'n/a'}
- Time: init started.
- Converter: init started.
/home/seden/work/EEG2BIDS/python/libs/iEEG.py:286: RuntimeWarning: Estimated head radius (0.9 cm) is below the 3rd percentile for infant head size. Check if the montage_units argument is correct (the default is "mm", but your channel positions may be in different units).
  raw = mne.io.read_raw_eeglab(input_fname=file, preload=False, verbose=True)
Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 286, in to_bids
	raw = mne.io.read_raw_eeglab(input_fname=file, preload=False, verbose=True)
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 311, in read_raw_eeglab
	return RawEEGLAB(
  File "<decorator-gen-305>", line 10, in __init__
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 444, in __init__
	data_fname = _check_eeglab_fname(input_fname, eeg.data)
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 69, in _check_eeglab_fname
	raise FileNotFoundError(msg.format(data_fname, fdt_from_set_fname))
FileNotFoundError: Could not find the .fdt data file, tried /home/seden/work/bids/sub-015_task-path_eeg.fdt and /home/seden/work/bids/1234_1234_FACE.fdt.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 289, in to_bids
	raw = mne.io.read_epochs_eeglab(input_fname=file, verbose=True)
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 377, in read_epochs_eeglab
	epochs = EpochsEEGLAB(
  File "<decorator-gen-306>", line 10, in __init__
  File "/home/seden/work/EEG2BIDS/python/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 595, in __init__
	raise ValueError(
ValueError: The file does not seem to contain epochs (trials less than 2). You should try using read_raw_eeglab function.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/seden/work/EEG2BIDS/python/eeg2bids.py", line 436, in eeg_to_bids_thread
	iEEG.Converter(data)  # EDF to BIDS format.
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 219, in __init__
	eegRun['eegBIDSBasename'] = self.to_bids(
  File "/home/seden/work/EEG2BIDS/python/libs/iEEG.py", line 291, in to_bids
	raise ReadError(ex)
python.libs.iEEG.ReadError: The file does not seem to contain epochs (trials less than 2). You should try using read_raw_eeglab function.

{'error': 'Cannot read file - The file does not seem to contain epochs (trials less than 2). You should try using read_raw_eeglab function.'}
{'error': 'Cannot read file - The file does not seem to contain epochs (trials less than 2). You should try using read_raw_eeglab function.'}
BIDS Conversion - END

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions