Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Zhou2016 #681

Open
toncho11 opened this issue Feb 4, 2025 · 2 comments
Open

Problem with Zhou2016 #681

toncho11 opened this issue Feb 4, 2025 · 2 comments

Comments

@toncho11
Copy link
Contributor

toncho11 commented Feb 4, 2025

I am using MOABB from git and MOABB benchmark function.

Does anyone has any problems with Zhou2016? Is it possible that the last commit to Zhou2016 made it unusable?

I am getting this error:

Zhou2016-WithinSession:   0%|          | 0/4 [00:00<?, ?it/s]
---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\mne\io\cnt\cnt.py:545, in RawCNT.__init__(self, input_fname, eog, misc, ecg, emg, data_format, date_format, header, preload, verbose)
    544 try:
--> 545     info, cnt_info = _get_cnt_info(
    546         input_fname, eog, ecg, emg, misc, data_format, _date_format, header
    547     )
    548 except Exception:

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\mne\io\cnt\cnt.py:346, in _get_cnt_info(input_fname, eog, ecg, emg, misc, data_format, date_format, header)
    345 if data_format == "auto":
--> 346     if n_samples == 0 or data_size // (n_samples * n_channels) not in [2, 4]:
    347         warn(
    348             "Could not define the number of bytes automatically. "
    349             "Defaulting to 2."
    350         )

OverflowError: Python int too large to convert to C long

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\spyder_kernels\customize\utils.py:209, in exec_encapsulate_locals(code_ast, globals, locals, exec_fun, filename)
    207     if filename is None:
    208         filename = "<stdin>"
--> 209     exec_fun(compile(code_ast, filename, "exec"), globals, None)
    210 finally:
    211     if use_locals_hack:
    212         # Cleanup code

File c:\work\pythoncode\ml_examples\eeg\mdm-mf\article_comparison_moabb.py:81
     77     pipeline_folder = "C:\\Work\\PythonCode\\ML_examples\\EEG\\MDM-MF\\pipelines9\\"
     79 #The EN_grid.yml is too slow!!!!!!!! and memory consuming
---> 81 results = benchmark(
     82     pipelines=pipeline_folder,
     83     evaluations=["WithinSession"],
     84     paradigms=["LeftRightImagery"],
     85     #include_datasets=["BNCI2014_001"],
     86     #include_datasets=["Stieger2021"],
     87     
     88     exclude_datasets=["Stieger2021","Liu2024"],
     89     results="./results/",
     90     overwrite=False,
     91     plot=False,
     92     n_jobs=9, #4 otherwise memory is not enough
     93     output="./benchmark/",
     94 )
     96 print("Results:")
     97 print(results)

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\benchmark.py:214, in benchmark(pipelines, evaluations, paradigms, results, overwrite, output, n_jobs, plot, contexts, include_datasets, exclude_datasets, n_splits, cache_config, optuna)
    202 if len(ppl_with_array) > 0:
    203     context = eval_type[evaluation](
    204         paradigm=p,
    205         datasets=d,
   (...)
    212         optuna=optuna,
    213     )
--> 214     paradigm_results = context.process(
    215         pipelines=ppl_with_array, param_grid=param_grid
    216     )
    217     paradigm_results["paradigm"] = f"{paradigm}"
    218     paradigm_results["evaluation"] = f"{evaluation}"

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\evaluations\base.py:237, in BaseEvaluation.process(self, pipelines, param_grid, postprocess_pipeline)
    228 # (we only keep the pipeline for the first frequency band, better ideas?)
    230 results = self.evaluate(
    231     dataset,
    232     pipelines,
   (...)
    235     postprocess_pipeline=postprocess_pipeline,
    236 )
--> 237 for res in results:
    238     self.push_result(res, pipelines, process_pipeline)
    239 res_per_db.append(
    240     self.results.to_dataframe(
    241         pipelines=pipelines, process_pipeline=process_pipeline
    242     )
    243 )

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\evaluations\evaluations.py:427, in WithinSessionEvaluation.evaluate(self, dataset, pipelines, param_grid, process_pipeline, postprocess_pipeline)
    423     yield from self._evaluate_learning_curve(
    424         dataset, pipelines, process_pipeline, postprocess_pipeline
    425     )
    426 else:
--> 427     yield from self._evaluate(
    428         dataset, pipelines, param_grid, process_pipeline, postprocess_pipeline
    429     )

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\evaluations\evaluations.py:157, in WithinSessionEvaluation._evaluate(self, dataset, pipelines, param_grid, process_pipeline, postprocess_pipeline)
    154     return []
    156 # get the data
--> 157 X, y, metadata = self.paradigm.get_data(
    158     dataset=dataset,
    159     subjects=[subject],
    160     return_epochs=self.return_epochs,
    161     return_raws=self.return_raws,
    162     cache_config=self.cache_config,
    163     postprocess_pipeline=postprocess_pipeline,
    164 )
    165 # iterate over sessions
    166 for session in np.unique(metadata.session):

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\paradigms\base.py:274, in BaseProcessing.get_data(self, dataset, subjects, return_epochs, return_raws, cache_config, postprocess_pipeline)
    269 process_pipelines = self.make_process_pipelines(
    270     dataset, return_epochs, return_raws, postprocess_pipeline
    271 )
    272 labels_pipeline = self.make_labels_pipeline(dataset, return_epochs, return_raws)
--> 274 data = [
    275     dataset.get_data(
    276         subjects=subjects,
    277         cache_config=cache_config,
    278         process_pipeline=process_pipeline,
    279     )
    280     for process_pipeline in process_pipelines
    281 ]
    283 X = []
    284 labels = []

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\paradigms\base.py:275, in <listcomp>(.0)
    269 process_pipelines = self.make_process_pipelines(
    270     dataset, return_epochs, return_raws, postprocess_pipeline
    271 )
    272 labels_pipeline = self.make_labels_pipeline(dataset, return_epochs, return_raws)
    274 data = [
--> 275     dataset.get_data(
    276         subjects=subjects,
    277         cache_config=cache_config,
    278         process_pipeline=process_pipeline,
    279     )
    280     for process_pipeline in process_pipelines
    281 ]
    283 X = []
    284 labels = []

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\datasets\base.py:433, in BaseDataset.get_data(self, subjects, cache_config, process_pipeline)
    431     if subject not in self.subject_list:
    432         raise ValueError("Invalid subject {:d} given".format(subject))
--> 433     data[subject] = self._get_single_subject_data_using_cache(
    434         subject,
    435         cache_config,
    436         process_pipeline,
    437     )
    438 check_subject_names(data)
    439 check_session_names(data)

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\datasets\base.py:527, in BaseDataset._get_single_subject_data_using_cache(self, subject, cache_config, process_pipeline)
    525 # Load and eventually overwrite:
    526 if len(cached_steps) == 0:  # last option: we don't use cache
--> 527     sessions_data = self._get_single_subject_data(subject)
    528     assert sessions_data is not None  # should not happen
    529 else:

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\moabb\datasets\Zhou2016.py:104, in Zhou2016._get_single_subject_data(self, subject)
    102 for run_ind, fname in enumerate(runlist):
    103     run_key = str(run_ind)
--> 104     raw = read_raw_cnt(fname, preload=True, eog=["VEOU", "VEOL"])
    105     stim = raw.annotations.description.astype(np.dtype("<10U"))
    106     stim[stim == "1"] = "left_hand"

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\mne\io\cnt\cnt.py:263, in read_raw_cnt(input_fname, eog, misc, ecg, emg, data_format, date_format, header, preload, verbose)
    178 @fill_doc
    179 def read_raw_cnt(
    180     input_fname,
   (...)
    190     verbose=None,
    191 ) -> "RawCNT":
    192     """Read CNT data as raw object.
    193 
    194     .. Note::
   (...)
    261     .. versionadded:: 0.12
    262     """
--> 263     return RawCNT(
    264         input_fname,
    265         eog=eog,
    266         misc=misc,
    267         ecg=ecg,
    268         emg=emg,
    269         data_format=data_format,
    270         date_format=date_format,
    271         header=header,
    272         preload=preload,
    273         verbose=verbose,
    274     )

File C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\mne\io\cnt\cnt.py:549, in RawCNT.__init__(self, input_fname, eog, misc, ecg, emg, data_format, date_format, header, preload, verbose)
    545     info, cnt_info = _get_cnt_info(
    546         input_fname, eog, ecg, emg, misc, data_format, _date_format, header
    547     )
    548 except Exception:
--> 549     raise RuntimeError(
    550         f"{_explain_exception()}\n"
    551         "WARNING: mne.io.read_raw_cnt "
    552         "supports Neuroscan CNT files only. If this file is an ANT Neuro CNT, "
    553         "please use mne.io.read_raw_ant instead."
    554     )
    555 last_samps = [cnt_info["n_samples"] - 1]
    556 super().__init__(
    557     info,
    558     preload,
   (...)
    563     verbose=verbose,
    564 )

RuntimeError: :
>   File "C:\Work\PythonCode\envs\eeg4_pr_moabb_git\lib\site-packages\mne\io\cnt\cnt.py", line 346, in _get_cnt_info
>     if n_samples == 0 or data_size // (n_samples * n_channels) not in [2, 4]:
> 
> OverflowError: Python int too large to convert to C long

WARNING: mne.io.read_raw_cnt supports Neuroscan CNT files only. If this file is an ANT Neuro CNT, please use mne.io.read_raw_ant instead.
@toncho11
Copy link
Contributor Author

toncho11 commented Feb 4, 2025

@bruAristimunha can you have a look please?

@toncho11
Copy link
Contributor Author

toncho11 commented Feb 4, 2025

I am using MNE 1.9.0 and pyRIemann 0.8.dev0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant