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

raw ='sample_data_raw_file')

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

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

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

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

~/anacondalele/envs/mne/lib/python3.8/site-packages/mne/io/nihon/ in _read_nihon_header(fname)
    131     header = {}
    132'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:

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

The specified file cannot be found.

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

1 Like

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.