Thank you for your reply.
I tried the following as advised, but I got an error.
Below is the code I ran.
l_freq = 1
h_freq = 20
ch_names = ["FP1","FP2","F3","F4","C3","C4","P3","P4","O1","O2","F7","F8","T3","T4","T5","T6","Fz","Cz","Pz"]
data = mne.io.read_raw_edf("./0629.edf")
data.rename_channels(ch_names)
data.filter(l_freq, h_freq)
print(data.info)
This is the error for changing the channel.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/h7/03ld7ngj5wj0p_fbv23g528c0000gn/T/ipykernel_64428/2163577672.py in
---> 10 data.rename_channels(ch_names)
11 # data.filter(l_freq, h_freq)
12 print(data.info)
in rename_channels(self, mapping, allow_duplicates, verbose)
/opt/anaconda3/lib/python3.9/site-packages/mne/channels/channels.py in rename_channels(self, mapping, allow_duplicates, verbose)
412
413 ch_names_orig = list(self.info['ch_names'])
--> 414 rename_channels(self.info, mapping, allow_duplicates)
415
416 # Update self._orig_units for Raw
in rename_channels(info, mapping, allow_duplicates, verbose)
/opt/anaconda3/lib/python3.9/site-packages/mne/channels/channels.py in rename_channels(info, mapping, allow_duplicates, verbose)
1094 for ci, ch_name in enumerate(ch_names)]
1095 else:
-> 1096 raise ValueError('mapping must be callable or dict, not %s'
1097 % (type(mapping),))
1098
ValueError: mapping must be callable or dict, not
Next is the error for the filter.
RuntimeError Traceback (most recent call last)
/var/folders/h7/03ld7ngj5wj0p_fbv23g528c0000gn/T/ipykernel_64428/2415822929.py in
10 # data.rename_channels(ch_names)
---> 11 data.filter(l_freq = 1, h_freq = 20)
12 print(data.info)
13
/opt/anaconda3/lib/python3.9/site-packages/mne/io/base.py in filter(self, l_freq, h_freq, picks, filter_length, l_trans_bandwidth, h_trans_bandwidth, n_jobs, method, iir_params, phase, fir_window, fir_design, skip_by_annotation, pad, verbose)
975 skip_by_annotation=('edge', 'bad_acq_skip'),
976 pad='reflect_limited', verbose=None): # noqa: D102
--> 977 return super().filter(
978 l_freq, h_freq, picks, filter_length, l_trans_bandwidth,
979 h_trans_bandwidth, n_jobs=n_jobs, method=method,
in filter(self, l_freq, h_freq, picks, filter_length, l_trans_bandwidth, h_trans_bandwidth, n_jobs, method, iir_params, phase, fir_window, fir_design, skip_by_annotation, pad, verbose)
/opt/anaconda3/lib/python3.9/site-packages/mne/filter.py in filter(self, l_freq, h_freq, picks, filter_length, l_trans_bandwidth, h_trans_bandwidth, n_jobs, method, iir_params, phase, fir_window, fir_design, skip_by_annotation, pad, verbose)
2004 """
2005 from .io.base import BaseRaw
-> 2006 _check_preload(self, 'inst.filter')
2007 if pad is None and method != 'iir':
2008 pad = 'edge'
...
--> 283 raise RuntimeError(
284 "By default, MNE does not load data into main memory to "
285 "conserve resources. " + msg + ' requires %s data to be '
RuntimeError: By default, MNE does not load data into main memory to conserve resources. inst.filter requires raw data to be loaded. Use preload=True (or string) in the constructor or raw.load_data().
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
Thank you in advance for your help.