# Problem with reading events from .fif-file

**URL:** <https://mne.discourse.group/t/problem-with-reading-events-from-fif-file/1365>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [November 16, 2017, 9:18am UTC](https://mne.discourse.group/t/problem-with-reading-events-from-fif-file/1365 "2017-11-16T09:18:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 16, 2017, 9:18am UTC](https://mne.discourse.group/t/problem-with-reading-events-from-fif-file/1365/1 "2017-11-16T09:18:10Z")

</div>

Dear mne experts,

I am trying to read events from MEG data as follows:

raw=mne.io.read\_raw\_fif('/m/nbe/scratch/alex/subjects/' + subject +  
'/neuromag/t' + str(c) + '\_' + subject + '\_trans\_sss.fif')

events=mne.find\_events(raw)

However, with one file I am getting an error pasted below. mne.find\_events  
works without problems for other files. I have been wondering if the file  
could be somehow corrupted but at least meg signals and the trigger channel  
looked normal when I plotted them. Any ideas what might be wrong?

The error message:

---\> 27 events=mne.find\_events(raw)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;28 events[:,0]=events[:,0]-raw.first\_samp

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;29 i = 0

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/event.pyc in  
find\_events(raw, stim\_channel, output, consecutive,  
min\_duration , shortest\_event, mask,  
uint\_cast, mask\_type, verbose)

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/utils.pyc in  
verbose(function, \*args, \*\*kwargs)

&nbsp;&nbsp;&nbsp;&nbsp;705 with use\_log\_level(verbose\_level):

&nbsp;&nbsp;&nbsp;&nbsp;706 return function(\*args, \*\*kwargs)

--\> 707 return function(\*args, \*\*kwargs)

&nbsp;&nbsp;&nbsp;&nbsp;708

&nbsp;&nbsp;&nbsp;&nbsp;709

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/event.pyc in  
find\_events(raw, stim\_channel, output, consecutive,  
min\_duration , shortest\_event, mask,  
uint\_cast, mask\_type, verbose)

&nbsp;&nbsp;&nbsp;&nbsp;648 if len(pick) == 0:

&nbsp;&nbsp;&nbsp;&nbsp;649 raise ValueError('No stim channel found to extract event  
triggers.')

--\> 650 data, \_ = raw[pick, :]

&nbsp;&nbsp;&nbsp;&nbsp;651

&nbsp;&nbsp;&nbsp;&nbsp;652 events = \_find\_events(data, raw.first\_samp, verbose=verbose,  
output=output,

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/io/base.pyc in  
\_\_getitem\_\_(self, item)

&nbsp;&nbsp;&nbsp;&nbsp;826 data = self.\_read\_segment(start=start, stop=stop,  
sel=sel,

&nbsp;&nbsp;&nbsp;&nbsp;827 projector=self.\_projector,

--\> 828 verbose=self.verbose)

&nbsp;&nbsp;&nbsp;&nbsp;829 times = self.times[start:stop]

&nbsp;&nbsp;&nbsp;&nbsp;830 return data, times

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/io/base.pyc in  
\_read\_segment(self, start, stop, sel, data\_buffer,  
projector, verbose)

&nbsp;&nbsp;&nbsp;&nbsp;515 self.\_read\_segment\_file(data[:, this\_sl], idx, fi,

&nbsp;&nbsp;&nbsp;&nbsp;516 int(start\_file), int(stop\_file),

--\> 517 cals, mult)

&nbsp;&nbsp;&nbsp;&nbsp;518 offset += n\_read

&nbsp;&nbsp;&nbsp;&nbsp;519 return data

/u/01/mhhakone/unix/.local/lib/python2.7/site-packages/mne/io/fiff/raw.pyc  
in \_read\_segment\_file(self, data, idx, fi, start, stop,  
cals, mult)

&nbsp;&nbsp;&nbsp;&nbsp;393 self.info  
['nchan']),

&nbsp;&nbsp;&nbsp;&nbsp;394 rlims=(first\_pick,  
last\_pick)).data

--\> 395 one.shape = (picksamp, self.info  
['nchan'])

&nbsp;&nbsp;&nbsp;&nbsp;396 \_mult\_cal\_one(data[:, offset:(offset +  
picksamp)],

&nbsp;&nbsp;&nbsp;&nbsp;397 one.T, idx, cals, mult)

AttributeError: 'NoneType' object has no attribute 'shape'

Best,

Maria  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20171116/d08487eb/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171116/d08487eb/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 16, 2017, 1:56pm UTC](https://mne.discourse.group/t/problem-with-reading-events-from-fif-file/1365/2 "2017-11-16T13:56:24Z")

</div>

hi,

please share the file privately with me and Eric so we can have a look.

Best,  
Alex
