[Mne_analysis] ImportError: cannot import name sigtools

Mainak Jas mainakjas at gmail.com
Mon Sep 1 05:37:05 EDT 2014
Search archives:

Hi Maria,

I am forwarding this email to the mailing list since this is a new issue
than the one you had previously posted. There are more people on the
mailing list who can answer your questions and you can expect a faster
response. In the future, can you try to share a small gist (
https://gist.github.com/), not more than 15-20 lines to reproduce the
problem using the sample dataset? Here is an example to reproduce this
problem you had: https://gist.github.com/mainakjas/966714622a73eaeb9b6f.

The issue is that picks is a numpy array but evoked.pick_channels expects a
list of strings. You can do something like:

evoked_clean.pick_channels([evoked_clean.info['ch_names'][p] for p in
picks_good])

to solve your problem. Does this work?

Mainak

On Sun, Aug 31, 2014 at 11:04 PM, Hakonen Maria <maria.hakonen at aalto.fi>
wrote:

> Hi again Mainak,
>
> I managed to solve that import error already by closing all terminals and
> logging off. The figures are also saved correctly now and the events are
> printed in a file. Many thanks for your advice!
>
> However, there is still one problem, I haven't managed to solve. I wonder
> if you have any ideas how it could be solved? I get the following error:
>
> ValueError                                Traceback (most recent call last)
> /usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in
> execfile(fname, *where)
>     173             else:
>     174                 filename = fname
> --> 175             __builtin__.execfile(filename, *where)
>
> /scratch/braindata/mhhakone/intell/scripts/evoke_and_do_ica.py in
> <module>()
>     141         filename =subject+session+file_end
>     142         picks_good = mne.pick_types(evoked_clean.info, meg=True,
> eeg=False, eog=True, ecg=False, stim=False, exclude='bads')
> --> 143         evoked_clean.pick_channels(picks_good)
>     144         evoked_clean.save(filename)
>     145
>
> /home/mhhakone/env/src/mne/mne/channels.pyc in pick_channels(self,
> ch_names, copy)
>     147
>     148         idx = [inst.ch_names.index(c) for c in ch_names if c in
> inst.ch_names]
> --> 149         inst._pick_drop_channels(idx)
>     150
>     151         return inst
>
> /home/mhhakone/env/src/mne/mne/channels.pyc in _pick_drop_channels(self,
> idx)
>     189             self.cals = self.cals[idx]
>     190
> --> 191         self.info = pick_info(self.info, idx, copy=False)
>     192
>     193         if inst_has('_projector'):
>
> /home/mhhakone/env/src/mne/mne/io/pick.pyc in pick_info(info, sel, copy)
>     285
>     286     if len(sel) == 0:
> --> 287         raise ValueError('Warning : No channels match the
> selection.')
>     288
>     289     info['chs'] = [info['chs'][k] for k in sel]
>
> ValueError: Warning : No channels match the selection.
>
> I don't really understand how it is possible that no channels match the
> selection if picks_good are calculated from evoked_clean?
>
> picks_good and evoked_clean are as follows:
>
> In [4]: picks_good
> Out[4]:
> array([  0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,
>         13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,
>         26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,
>         39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,
>         52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,  63,  64,
>         65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,
>         78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,
>         91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103,
>        104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
>        117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
>        130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
>        143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155,
>        156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
>        169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
>        182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
>        195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
>        208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
>        221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233,
>        234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
>        247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
>        260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
>        273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285,
>        286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
>        299, 300, 301, 302, 303, 304, 305])
>
>   In [5]: evoked_clean
> Out[5]: <Evoked  |  comment : 'Unknown', time : [-0.099994, 0.999936],
> n_epochs : 148, n_channels x n_times : 306 x 1321>
>
> Thanks already in advance if you have yet time to help!
>
> Regards,
> Maria
> ________________________________________
> Lähettäjä: Hakonen Maria
> Lähetetty: 30. elokuuta 2014 10:02
> Vastaanottaja: mainakjas at gmail.com
> Aihe: ImportError: cannot import name sigtools
>
> Hi,
>
> I have tried to run the MEG preprocessing script but import mne gives the
> error:
>
> ImportError                               Traceback (most recent call last)
> /scratch/braindata/mhhakone/intell/scripts/<ipython-input-12-39fc8b1a8697>
> in <module>()
> ----> 1 import mne
>
> /home/mhhakone/env/src/mne/mne/__init__.py in <module>()
>       8                     get_config, get_config_path, set_cache_dir,
>       9                     set_memmap_min_size)
> ---> 10 from .io.pick import (pick_types, pick_channels, pick_types_evoked,
>      11                       pick_channels_regexp, pick_channels_forward,
>      12                       pick_types_forward, pick_channels_cov,
>
> /home/mhhakone/env/src/mne/mne/io/__init__.py in <module>()
>       6 # License: BSD (3-clause)
>
>       7
> ----> 8 from .open import fiff_open, show_fiff, _fiff_get_fid
>       9 from .meas_info import read_fiducials, write_fiducials, read_info,
> write_info
>      10
>
> /home/mhhakone/env/src/mne/mne/io/open.py in <module>()
>      10
>      11 from .tag import read_tag_info, read_tag, read_big, Tag
> ---> 12 from .tree import make_dir_tree
>      13 from .constants import FIFF
>      14 from ..utils import logger, verbose
>
> /home/mhhakone/env/src/mne/mne/io/tree.py in <module>()
>      10 from .tag import Tag
>      11 from .tag import read_tag
> ---> 12 from .write import write_id, start_block, end_block, _write
>      13 from ..utils import logger, verbose
>      14
>
> /home/mhhakone/env/src/mne/mne/io/write.py in <module>()
>      15 from ..utils import logger
>      16 from ..externals.jdcal import jcal2jd
> ---> 17 from ..fixes import gzip_open
>      18
>      19
>
> /home/mhhakone/env/src/mne/mne/fixes.py in <module>()
>      24 from numpy.fft import irfft
>      25 from nose.tools import assert_true
> ---> 26 from scipy.signal import filtfilt as sp_filtfilt
>      27 from distutils.version import LooseVersion
>      28 from functools import partial
>
> /home/mhhakone/env/local/lib/python2.7/site-packages/scipy/signal/__init__.py
> in <module>()
>     230 from __future__ import division, print_function, absolute_import
>     231
> --> 232 from . import sigtools
>     233 from .waveforms import *
>     234
>
> ImportError: cannot import name sigtools
>
> I wonder if you know what could cause this error? I haven't got it before.
> Could it be relatrd to the Python version I have. Now I have the following
> version:
>
> In [18]: sys.version
> Out[18]: '2.7.3 (default, Feb 27 2014, 19:58:35) \n[GCC 4.6.3]'
>
> Thanks,
> Maria
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140901/52cdbace/attachment.html 


More information about the Mne_analysis mailing list