# How to read nihon EEG file and how to set raw nihon

**URL:** <https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951>\
**Category:** Support & Discussions\
**Tags:** meg, eeg, visualization\
**Created:** [April 9, 2021, 2:14am UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951 "2021-04-09T02:14:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![21012015](https://avatars.discourse-cdn.com/v4/letter/2/50afbb/32.png) [@21012015](https://mne.discourse.group/u/21012015)\
**Post date:** [April 9, 2021, 2:14am UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951/1 "2021-04-09T02:14:51Z")

</div>

```python
raw = mne.io.read_raw_nihon('sample_data_raw_file')

FileNotFoundError Traceback (most recent call last)
<ipython-input-56-0931b2c6efb6> in <module>
      1 #raw = mne.io.read_raw_nihon(sample_data_raw_file)
      2 
----> 3 raw = mne.io.read_raw_nihon('sample_data_raw_file')

~/anacondalele/envs/mne/lib/python3.8/site-packages/mne/io/nihon/nihon.py in read_raw_nihon(fname, preload, verbose)
     44 mne.io.Raw : Documentation of attribute and methods.
     45 """
---> 46 return RawNihon(fname, preload, verbose)
     47 
     48 

<decorator-gen-224> in __init__ (self, fname, preload, verbose)

~/anacondalele/envs/mne/lib/python3.8/site-packages/mne/io/nihon/nihon.py in __init__ (self, fname, preload, verbose)
    314 logger.info('Loading %s' % data_name)
    315 
--> 316 header = _read_nihon_header(fname)
    317 metadata = _read_nihon_metadata(fname)
    318 

~/anacondalele/envs/mne/lib/python3.8/site-packages/mne/io/nihon/nihon.py in _read_nihon_header(fname)
    131 header = {}
    132 logger.info(f'Reading header from {fname}')
--> 133 with open(fname, 'r') as fid:
    134 version = np.fromfile(fid, '|S16', 1).astype('U16')[0]
    135 if version not in _valid_headers:

```

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [April 9, 2021, 6:30am UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951/2 "2021-04-09T06:30:43Z")

</div>

See [UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 6437: character maps to \<undefined\> · Issue #9272 · mne-tools/mne-python · GitHub](https://github.com/mne-tools/mne-python/issues/9272) and [How to fix: “UnicodeDecodeError: ‘ascii’ codec can’t decode byte” · Issue #9267 · mne-tools/mne-python · GitHub](https://github.com/mne-tools/mne-python/issues/9267), this seems like a bug and should be discussed there.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [April 9, 2021, 7:19am UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951/3 "2021-04-09T07:19:09Z")

</div>

> [@21012015](#):
>
> raw = mne.io.read\_raw\_nihon(‘sample\_data\_raw\_file’)
> 
> FileNotFoundError

The specified file cannot be found.

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [April 9, 2021, 7:24am UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951/4 "2021-04-09T07:24:20Z")

</div>

Ah, I didn’t see that! Yes, this explains the error.

---

<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:** [April 9, 2021, 3:14pm UTC](https://mne.discourse.group/t/how-to-read-nihon-eeg-file-and-how-to-set-raw-nihon/2951/5 "2021-04-09T15:14:33Z")

</div>

to expand on Richard’s answer, the problem is most likely that you’re trying to load a file with the _filename_ “sample\_data\_raw\_file” (note that you have quote marks around it in your code), and there is no file with that filename. Instead you probably meant to load a file whose filename is stored in a _variable_ called `sample_data_raw_file`.
