# AttributeError: 'numpy.ndarray' object has no attribute 'get'

**URL:** <https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145>\
**Category:** Support & Discussions\
**Created:** [May 17, 2021, 6:17am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145 "2021-05-17T06:17:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_mbrain](https://avatars.discourse-cdn.com/v4/letter/_/9fc29f/32.png) [@\_mbrain](https://mne.discourse.group/u/_mbrain)\
**Post date:** [May 17, 2021, 6:17am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/1 "2021-05-17T06:17:17Z")

</div>

- MNE-Python version: 0.23.0
- operating system: Ubuntu 18.04.5 LTS  
-IDE: Pycharm-community

```python
import matplotlib
import matplotlib.pyplot as plt
import mne
import numpy
matplotlib.use('Qt5Agg')
mne.set_log_level('warning')

# Load raw data
data_path = '/MNE/BrainVision/3.vhdr'
raw = mne.io.read_raw_brainvision(data_path, preload=True, verbose=False)
raw.info['line_freq'] = 50.
#raw.ch_names[28] = "AFz"
#raw.ch_names[60] = "Fpz"
raw.set_channel_types({'EOGr': 'eog', 'EOGl': 'eog'})

# Set montage
montage = mne.channels.make_standard_montage('easycap-M1')
raw.set_montage(montage, on_missing = 'ignore', match_case=False, verbose=False)

# Re-reference
raw.set_eeg_reference('average', projection=False, verbose=False)
raw.filter(l_freq=1, h_freq=45, fir_design='firwin', verbose=False)

# Construct epochs
# read events
events, event_id = mne.events_from_annotations(raw, verbose=False)
raw.info["events"] = events
raw.info["events_id"] = event_id

# Epoching
tmin, tmax = -1., 1. # in s
baseline = None

epochs = mne.Epochs(
    raw, events=events,
    event_id=[event_id['Stimulus/A']], tmin=tmin,
    tmax=tmax, baseline=baseline, verbose=False)

#Save
root = '/MNE/BrainVision'
epochs.save(pathlib.Path(root) / 'epochs-epo.fif', overwrite = True)

```

Greeting,

After running the above code (which simply load brain vision EEG data ‘.vhdr’, set montage, reref, epoch, and save it ), I get the below error:

Traceback (most recent call last):  
File “”, line 1, in   
File “”, line 22, in save  
File “/MNE/BrainVision/venv/lib/python3.6/site-packages/mne/epochs.py”, line 1814, in save  
\_save\_split(this\_epochs, fname, part\_idx, n\_parts, fmt)  
File “/MNE/BrainVision/venv/lib/python3.6/site-packages/mne/epochs.py”, line 99, in \_save\_split  
\_save\_part(fid, epochs, fmt, n\_parts, next\_fname, next\_idx)  
File “/MNE/BrainVision/venv/lib/python3.6/site-packages/mne/epochs.py”, line 112, in \_save\_part  
write\_meas\_info(fid, info)  
File “/MNE/BrainVision/venv/lib/python3.6/site-packages/mne/io/meas\_info.py”, line 1584, in write\_meas\_info  
if event.get(‘channels’) is not None:  
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get’

Could you please help what the source of problem might be…

Sincerely  
Emanuel

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [May 17, 2021, 7:23am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/2 "2021-05-17T07:23:30Z")

</div>

can you share the vhdr file?

A

---

<div class="post-metadata">

**Author:** ![\_mbrain](https://avatars.discourse-cdn.com/v4/letter/_/9fc29f/32.png) [@\_mbrain](https://mne.discourse.group/u/_mbrain)\
**Post date:** [May 17, 2021, 7:49am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/3 "2021-05-17T07:49:00Z")

</div>

Sure.

> **[3.vhdr](https://www.dropbox.com/s/f04pd75yhi2pf5c/3.vhdr?dl=0)**
>
> Shared with Dropbox

thanks in advance

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [May 17, 2021, 11:27am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/4 "2021-05-17T11:27:41Z")

</div>

well I will need the full brainvision dataset not just the header file

A

---

<div class="post-metadata">

**Author:** ![\_mbrain](https://avatars.discourse-cdn.com/v4/letter/_/9fc29f/32.png) [@\_mbrain](https://mne.discourse.group/u/_mbrain)\
**Post date:** [May 17, 2021, 11:44am UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/5 "2021-05-17T11:44:54Z")

</div>

Sure. below are .eeg, .vmrk and .vhdr files

> **[3.eeg](https://www.dropbox.com/s/dwp9qfh5pyt3nkz/3.eeg?dl=0)**
>
> Shared with Dropbox

> **[3.vhdr](https://www.dropbox.com/s/f04pd75yhi2pf5c/3.vhdr?dl=0)**
>
> Shared with Dropbox

> **[3.vmrk](https://www.dropbox.com/s/zfv54jov61h80me/3.vmrk?dl=0)**
>
> Shared with Dropbox

thanks

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [May 17, 2021, 3:52pm UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/6 "2021-05-17T15:52:57Z")

</div>

The problem is one of these two lines

```python
raw.info["events"] = events
raw.info["events_id"] = event_id

```

(probably the first one). generally speaking you should not stick things into the `raw.info` dictionary manually. Quoting from [the API documentation](https://mne.tools/stable/generated/mne.Info.html#mne.Info):

> The only entries that should be manually changed by the user are `info['bads']` and `info['description']` . All other entries should be considered read-only, though they can be modified by various MNE-Python functions or methods (which have safeguards to ensure all fields remain in sync).

Incidentally, after a quick look at your data, you may want to consider marking some bad channels (before you do your average reference); maybe:

```python
raw.info['bads'] = ['C1', 'CP3', 'C5']

```

Although I recommend you look at the data yourself using `raw.plot()` and click channel names to mark as bad interactively.

---

<div class="post-metadata">

**Author:** ![\_mbrain](https://avatars.discourse-cdn.com/v4/letter/_/9fc29f/32.png) [@\_mbrain](https://mne.discourse.group/u/_mbrain)\
**Post date:** [May 17, 2021, 5:38pm UTC](https://mne.discourse.group/t/attributeerror-numpy-ndarray-object-has-no-attribute-get/3145/7 "2021-05-17T17:38:04Z")

</div>

Great…problem have been solved by commenting the first one (raw.info[“events”]). Sure, I should take out bad channels, but possibly also bad trials before re-referencing…thank you 🙂
