RuntimeWarning: Not setting positions of 3 misc channels

Hello everybody
For reading and loading raw EEG data in BIDS format, I have the RuntimeWarning: Not setting positions of 3 misc channels found in montage: [‘GSR’, ‘HR’, ‘RESP’].

I used the code below, but I still have the warning.
I should note that there is no participants.tsv file in the database.
I was wondering if anybody could help me with that.

mapping = {'GSR': 'misc', 'HR': 'misc', 'RESP': 'misc'}
bids_path = BIDSPath(subject=subject_id.replace('sub-', ''),  
                     session='00',
                     task='rest',
                     datatype='eeg',
                     root=basepath)

raw = read_raw_bids(bids_path=bids_path)

raw.set_channel_types(mapping)

eeg_channels = [ch for ch, ch_type in zip(raw.ch_names, raw.get_channel_types()) if ch_type == 'eeg']

montage = mne.channels.make_standard_montage('standard_1020')
raw.pick_channels(eeg_channels) 
raw.set_montage(montage, match_case=False, on_missing='ignore')

Note that this is just a warning and not an error, so there is nothing wrong with your code as far as I can see. However, it is still weird that you’re getting this warning, because it sounds like the montage contains those three channels, which is not the case.

You are selecting only EEG channels before assigning the montage, but you do not have to set the channel type misc for the three channels, because you’re picking only EEG channels anyway. Also, picking EEG channels and assigning a montage can be done more concisely as follows:

bids_path = BIDSPath(
    subject=subject_id.replace("sub-", ""),
    session="00",
    task="rest",
    datatype="eeg",
    root=basepath,
)

raw = read_raw_bids(bids_path=bids_path)
raw.pick_channels("eeg")
raw.set_montage("standard_1020", match_case=False, on_missing="ignore")

Thank you for your response.