MedMaxLab/selfEEG

Import failure

Closed this issue · 2 comments

I am trying to run the following import on my Kaggle notebook, but I am getting the following error.

import selfeeg
import selfeeg.augmentation as aug
import selfeeg.dataloading as dl
Traceback (most recent call last):

  File /opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py:3553 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[3], line 9
    import selfeeg

  File /opt/conda/lib/python3.10/site-packages/selfeeg/__init__.py:2
    from . import dataloading

  File /opt/conda/lib/python3.10/site-packages/selfeeg/dataloading/__init__.py:1
    from .load import (GetEEGPartitionNumber, GetEEGSplitTable, GetEEGSplitTableKfold,

  File /opt/conda/lib/python3.10/site-packages/selfeeg/dataloading/load.py:1550
    sample=self.currEEG[*first_dims_idx,:,-self.Nsample:]
                        ^
SyntaxError: invalid syntax

I don't know but I think this is an issue regarding the package code base.

Hi, @adejumoridwan.

The issue you are encountering is related to a syntax I used to get a specific partition from 3D (or higher dimensional) tensors, which was added only in Python 3.11 (my fault, I forgot that colab and kaggle still run Python 3.10, sorry). The issue was solved during the JOSS Journal peer-review with the following PR #4 .

Unfortunately, I'm waiting the Journal's review to be done before uploading a new version with this and other corrections on PyPI and Anaconda. There's only one reviewer left, so I believe it won't take much time. Until then, can you try to install directly from git with the command and see if you are still encountering the error?

!pip install git+https://github.com/MedMaxLab/selfEEG

Just to double check, If you run

import selfeeg.dataloading as dl
dl.EEGDataset.__getitem__??

You can check if the lines of interest have the following changes

if end > self.currEEG.shape[-1]:  # in case of partial ending samples
    sample = self.currEEG[
        (
            *first_dims_idx,
            slice(None),
            slice(self.currEEG.shape[-1] - Nsample, self.currEEG.shape[-1]),
        )
    ]
else:
    sample = self.currEEG[(*first_dims_idx, slice(None), slice(start, end))]

Let me know if this solves your problem

Hi @fedepup, thanks for your help. It works.