import mne
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
raw = mne.io.read_raw_edf('C:/Users//SC4001E0-PSG.edf', preload=True)
print(raw)
print(raw.ch_names)
info = mne.create_info(ch_names=['EEG Fpz-Cz'],
ch_types=['eeg'],
sfreq=100)
np_raw = mne.io.RawArray(raw, info)
print(np_raw)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_11320/1799635321.py in <module>
15 sfreq=100)
16
---> 17 np_raw=mne.io.RawArray(raw, info)
18 print(np_raw)
<decorator-gen-219> in __init__(self, data, info, first_samp, copy, verbose)
~\anaconda3\lib\site-packages\mne\io\array\array.py in __init__(self, data, info, first_samp, copy, verbose)
55 _validate_type(info, 'info', 'info')
56 _check_option('copy', copy, ('data', 'info', 'both', 'auto', None))
---> 57 dtype = np.complex128 if np.any(np.iscomplex(data)) else np.float64
58 orig_data = data
59 data = np.asanyarray(orig_data, dtype=dtype)
<__array_function__ internals> in iscomplex(*args, **kwargs)
~\anaconda3\lib\site-packages\numpy\lib\type_check.py in iscomplex(x)
238
239 """
--> 240 ax = asanyarray(x)
241 if issubclass(ax.dtype.type, _nx.complexfloating):
242 return ax.imag != 0
~\anaconda3\lib\site-packages\numpy\core\_asarray.py in asanyarray(a, dtype, order, like)
169 return _asanyarray_with_like(a, dtype=dtype, order=order, like=like)
170
--> 171 return array(a, dtype, copy=False, order=order, subok=True)
172
173
~\anaconda3\lib\site-packages\mne\io\base.py in __getitem__(self, item)
807
808 """ # noqa: E501
--> 809 return self._getitem(item)
810
811 def _getitem(self, item, return_times=True):
~\anaconda3\lib\site-packages\mne\io\base.py in _getitem(self, item, return_times)
810
811 def _getitem(self, item, return_times=True):
--> 812 sel, start, stop = self._parse_get_set_params(item)
813 if self.preload:
814 data = self._data[sel, start:stop]
~\anaconda3\lib\site-packages\mne\io\base.py in _parse_get_set_params(self, item)
742 "and time)")
743
--> 744 sel = _picks_to_idx(self.info, item[0])
745
746 if isinstance(item[1], slice):
~\anaconda3\lib\site-packages\mne\io\pick.py in _picks_to_idx(info, picks, none, exclude, allow_empty, with_ref_meg, return_kind)
1067 % (-n_chan, orig_picks))
1068 if (picks >= n_chan).any():
-> 1069 raise ValueError('All picks must be < n_channels (%d), got %r'
1070 % (n_chan, orig_picks))
1071 picks %= n_chan # ensure positive
ValueError: All picks must be < n_channels (7), got 7