russellu / eegfmripy

python code for denoising eeg data from eeg-fmri experiments, and fusing with FMRI
8 stars 7 forks source link

Using eegfmripy with jupyter notebook #9

Open tvanasse opened 4 years ago

tvanasse commented 4 years ago

Hello, thanks for creating this tool. How can I apply this tool using Jupyter notebook?

If I pip in the repo:

pip install git+git://github.com/russellu/eegfmripy.git

I can access some functions with:

from eegfmripy.clianalysis import remove_gradient

But if I try to access other packages that need the helper functions (e.g., clean or basic_gradient), I run into an error, here is the traceback

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-209-a0d5e9147731> in <module>
      4 import eegfmripy
      5 import sys
----> 6 from eegfmripy.clianalysis import remove_gradient, clean
      7 
      8 get_ipython().run_line_magic('matplotlib', 'inline')

~/anaconda3/envs/mnedev/lib/python3.7/site-packages/eegfmripy/clianalysis/clean.py in <module>
      5 
      6 from ..cli import AnalysisParser
----> 7 from ..clianalysis.run_bcg_denoise import remove_bcg
      8 from ..clianalysis.remove_gradient_single import remove_gradient
      9 

~/anaconda3/envs/mnedev/lib/python3.7/site-packages/eegfmripy/clianalysis/run_bcg_denoise.py in <module>
     12 from mne.preprocessing import ICA
     13 
---> 14 from ..clianalysis import remove_bcg as bcg_utils
     15 from ..utils import helpers
     16 from ..cli import AnalysisParser

~/anaconda3/envs/mnedev/lib/python3.7/site-packages/eegfmripy/clianalysis/remove_bcg.py in <module>
     12 
     13 from ..cli import AnalysisParser
---> 14 from ..utils.general_utils import write_same_line, finish_same_line
     15 
     16 log = logging.getLogger("eegfmripy")

ModuleNotFoundError: No module named 'eegfmripy.utils'

Any help would be appreciated.

gmierz commented 4 years ago

Hello @tvanasse, sorry but this code wasn't fully prepared for use with pip so that's likely why you are hitting these errors. The .. imports look for the references in a folder above the current working directory, but you can't use this in a pip package. To make it work, you would have to remove those .. imports and change them to eegfmripy.* imports.