jdammers / jumeg

MEG Data Analysis at FZJ
BSD 3-Clause "New" or "Revised" License
10 stars 26 forks source link

jumeg noise reducer error when passing list of files #85

Closed pravsripad closed 9 years ago

pravsripad commented 9 years ago
Artefact detected in [118320, 118524]
    Rejecting  epoch based on MAG : ['MEG 177', 'MEG 212', 'MEG 228', 'MEG 229']
Artefact detected in [119748, 119952]
    Rejecting  epoch based on MAG : ['MEG 212']
Artefact detected in [120972, 121176]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/data/megraid21/sripad/cau_detailed_analysis/cau_preprocessing.py in <module>()
     35 # Apply noise reducer to all files with refnotch 50. Hz
     36 from jumeg.jumeg_noise_reducer import noise_reducer
---> 37 noise_reducer(file_list, refnotch=50.)
     38 
     39 string = 'nr'  # for noise reduced

/home/psripad/.local/lib/python2.7/site-packages/jumeg/jumeg_noise_reducer.pyc in noise_reducer(fname_raw, signals, noiseref, detrending, tmin, tmax, reflp, refhp, refnotch, exclude_artifacts, checkresults, complementary_signal, fnout, verbose)
    521             if not exclude_artifacts or \
    522                _is_good(raw_segmentsig, infosig['ch_names'], idx_by_typesig, reject, flat=None,
--> 523                         ignore_chs=raw.info['bads']):
    524                 sigmean += raw_segmentsig.sum(axis=1)
    525                 refmean += raw_segmentref.sum(axis=1)

/home/psripad/.local/lib/python2.7/site-packages/mne-0.9.git-py2.7.egg/mne/epochs.pyc in _is_good(e, ch_names, channel_type_idx, reject, flat, full_report, ignore_chs, verbose)

/home/psripad/.local/lib/python2.7/site-packages/mne-0.9.git-py2.7.egg/mne/utils.pyc in verbose(function, *args, **kwargs)
    510         finally:
    511             set_log_level(old_level)
--> 512     return function(*args, **kwargs)
    513 
    514 

/home/psripad/.local/lib/python2.7/site-packages/mne-0.9.git-py2.7.egg/mne/epochs.pyc in _is_good(e, ch_names, channel_type_idx, reject, flat, full_report, ignore_chs, verbose)
   1839                 if len(idx) > 0:
   1840                     e_idx = e[idx]
-> 1841                     deltas = np.max(e_idx, axis=1) - np.min(e_idx, axis=1)
   1842                     checkable_idx = checkable[idx]
   1843                     idx_deltas = np.where(np.logical_and(f(deltas, thresh),

/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.pyc in amax(a, axis, out, keepdims)
   2128     else:
   2129         return _methods._amax(a, axis=axis,
-> 2130                             out=out, keepdims=keepdims)
   2131 
   2132 def amin(a, axis=None, out=None, keepdims=False):

/usr/lib/python2.7/dist-packages/numpy/core/_methods.pyc in _amax(a, axis, out, keepdims)
     15 def _amax(a, axis=None, out=None, keepdims=False):
     16     return um.maximum.reduce(a, axis=axis,
---> 17                             out=out, keepdims=keepdims)
     18 
     19 def _amin(a, axis=None, out=None, keepdims=False):

ValueError: zero-size array to reduction operation maximum which has no identity

This is the traceback when passing a list of files instead of a single file.

ebeich commented 9 years ago

Hello Praveen,

now I can also reproduce the problem - my choice of files was wiser in terms of hiding my errors ;-) Now I know that the problem is due to missing input sanitation, but I want to make sure I don't leave similar problems.

For the moment call noise_reducer only for single files, not lists of files!

Sorry for the inconvenience, Eberhard

-------- Original Message --------

Subject: Re: [jumeg] jumeg noise reducer error when passing list of files (#85) From: pravsripad pravsripad@gmail.com To: Eberhard Eich e.eich@fz-juelich.de Date: 2015-06-18 11:28

Hello Eberhard,

I am able to reproduce the error by passing two file names as a list. The files are from CAU data and it is passed as shown below:

In [1]: raw_fname = '109925_CAU01A_100715_0842_2_c,rfDC-raw.fif' In [2]: empty_fname = '109925_CAU01A_100715_0844_2_c,rfDC-empty.fif' jumeg_noise_reducer.noise_reducer([raw_fname, empty_fname])

Attached are two error logs, one with verbose=True and the other without. Hope this helps.

It works very nicely if I simply pass one file and I am already using it successfully so far.

Thank you.



Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,

Prof. Dr. Sebastian M. Schmidt


pravsripad commented 9 years ago

I will do that. Thank you @ebeich

fboers commented 9 years ago

Looks like always the same problem with as input parameter instead of one raw-obj

https://github.com/fboers/jumeg/blob/fb_devel_150602_v001/jumeg_noise_reducer_4raw_data.py line 391 ff, in the next version this will be a function in the jumeg_base class

On 18.06.2015 15:22, Praveen Sripad wrote:

I will do that. Thank you @ebeichhttps://github.com/ebeich

— Reply to this email directly or view it on GitHubhttps://github.com/jdammers/jumeg/issues/85#issuecomment-113154231.

Frank Boers Institute of Neuroscience and Medicine - 4 Medical Imaging Physics Forschungszentrum Juelich GmbH 52425 Juelich phone: +49 - (0)2461-61-6005 fax : +49 - (0)2461-61-2820 email: f.boers@fz-juelich.demailto:f.boers@fz-juelich.de http://www.fz-juelich.de/inm/inm-4/DE/Forschung/MEG-Physik/_node.html



Forschungszentrum Juelich GmbH 52425 Juelich Sitz der Gesellschaft: Juelich Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498 Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender), Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,

Prof. Dr. Sebastian M. Schmidt