PyEEGLab icon indicating copy to clipboard operation
PyEEGLab copied to clipboard

Can't process TUH Artifact Dataset

Open lienz opened this issue 4 years ago • 4 comments

Hi, I'm trying to create the TUH Artifact Dataset as follows:

dataset = TUHEEGArtifactDataset('~/Documents/eeg/tuh_artifact_eeg/edf')
dataset.set_cache_manager(PickleCache('~/Documents/eeg/export'))

preprocessing = Pipeline([
    CommonChannelSet(),
    LowestFrequency(),
    ToDataframe(),
    MinMaxCentralizedNormalization(),
    ToNumpy()
])
dataset = dataset.set_pipeline(preprocessing).load()
data, labels = dataset['data'], dataset['labels']

But it fails with the following message: ValueError: tmin (600.9454) must be less than tmax (600.9)

I'm using the v2.0.0 of the dataset: https://www.isip.piconepress.com/projects/tuh_eeg/downloads/tuh_eeg_artifact/v2.0.0/edf/

lienz avatar Aug 11 '20 09:08 lienz

The TUH Artifact has been recently updated, the adapters for the v2.0.0 are in early alpha in the feature-workspace branch

AlessioZanga avatar Aug 11 '20 10:08 AlessioZanga

Thanks so the above code should work with v1.0.0?

lienz avatar Aug 11 '20 10:08 lienz

It will work without the ToNumpy, please refer to this about the Numpy preprocessor

AlessioZanga avatar Aug 11 '20 11:08 AlessioZanga

Hi, I'm trying to run this code but it gives error

dataset = TUHEEGAbnormalDataset()
preprocessing = Pipeline([
    CommonChannelSet(),
    LowestFrequency(),
    ToDataframe(),
    MinMaxCentralizedNormalization(),
    DynamicWindow(8),
    ToNumpy()
])
dataset = dataset.set_pipeline(preprocessing).load()
data, labels = dataset['data'], dataset['labels']

output : **2021/03/11 01:24:44 INFO: Init dataset 'Temple University Hospital EEG Abnormal Dataset'@'v2.0.0' at '/content/data/tuh_eeg_abnormal/v2.0.0' 2021/03/11 01:24:44 DEBUG: Make .pyeeglab directory 2021/03/11 01:24:44 DEBUG: Make .pyeeglab/cache directory 2021/03/11 01:24:44 DEBUG: Set MNE log .pyeeglab/mne.log 2021/03/11 01:24:44 DEBUG: Make index session 2021/03/11 01:24:44 INFO: Index data set directory 2021/03/11 01:24:44 INFO: Index data set completed 2021/03/11 01:24:44 DEBUG: Init default query 2021/03/11 01:24:44 DEBUG: SQL query representation: 'SELECT file.uuid AS file_uuid, file.path AS file_path, file.extension AS file_extension, metadata.file_uuid AS metadata_file_uuid, metadata.duration AS metadata_duration, metadata.channels_set AS metadata_channels_set, metadata.channels_reference AS metadata_channels_reference, metadata.sampling_frequency AS metadata_sampling_frequency, metadata.max_value AS metadata_max_value, metadata.min_value AS metadata_min_value, annotation.uuid AS annotation_uuid, annotation.file_uuid AS annotation_file_uuid, annotation."begin" AS annotation_begin, annotation."end" AS annotation_end, annotation.label AS annotation_label FROM file JOIN metadata ON file.uuid = metadata.file_uuid JOIN annotation ON file.uuid = annotation.file_uuid WHERE 1 = 1 AND 1 = 1 AND annotation."end" - annotation."begin" >= ?' 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create common channels_set preprocessor 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create lowest_frequency preprocessor 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create DataFrame converter preprocessor 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create dynamic frames (8) generator 2021/03/11 01:24:44 DEBUG: Create new preprocessor 2021/03/11 01:24:44 DEBUG: Create Numpy (float32) converter preprocessor 2021/03/11 01:24:44 DEBUG: Create new preprocessing pipeline


TypeError Traceback (most recent call last)

in () 8 ToNumpy() 9 ]) ---> 10 dataset2 = dataset2.set_pipeline(preprocessing).load() 11 data, labels = dataset2['data'], dataset2['labels']

2 frames

/usr/local/lib/python3.7/dist-packages/pyeeglab/dataset/dataset.py in maximal_channels_subset(self) 216 for channel in channels 217 ] --> 218 channels = reduce(and_, channels) 219 channels = channels - frozenset(self.exclude_channels_set) 220 channels = sorted(channels)

TypeError: reduce() of empty sequence with no initial value**

ayoub1996-01 avatar Mar 11 '21 01:03 ayoub1996-01