Repository: mne-tools/mne-python

Issue:
GSR and temperature channels do not show up in plot
MWE:
```python
# %%
from pathlib import Path
import openneuro
import mne
import mne_bids

dataset_name = 'ds003061'
bids_root = Path('/tmp') / dataset_name

# %%
openneuro.download(
    dataset=dataset_name,
    include='sub-001',
    target_dir=bids_root,
)

# %%
bp = mne_bids.BIDSPath(
    subject='001',
    task='P300',
    run='1',
    datatype='eeg',
    suffix='eeg',
    extension='.set',
    root=bids_root,
)
raw = mne_bids.read_raw_bids(bp)

with mne.viz.use_browser_backend('matplotlib'):
    raw.copy().pick(['GSR1', 'GSR2' 'Temp']).plot()
```

produces:
![image](https://user-images.githubusercontent.com/2046265/187235163-ac101aa4-ef2f-4e98-92b5-9c3b4f8ec015.png)



Discussion:
This is probably a scaling issue. There were no data to test with at the time of addition, so the `mne/defaults.py` scale factors are probably way off. In particular, the raw scale for `temperature` is almost certainly a problem here since room temperature (~20 deg C) will be off the plot given a unity `plot_raw` scale factor (the default right now IIRC)
> This is probably a scaling issue.

You sure? I don't even see channel names on the ordinate … I think we're just not doing … anything. No?

Same problem with the qt-browser too btw

cc @marsipu 
Ahh I didn't even notice that. Yeah it seems like a picking problem
@hoechenberger Yes, when it is in matplotlib and qt-backend and no traces/y-axis-marks show I think too that it is a picking problem inside mne-python-code
I can try to look tomorrow
@hoechenberger running your example I get a bunch of junk from MNE-BIDS, followed by a real error:
```
/home/larsoner/python/mne-bids/mne_bids/read.py:60: RuntimeWarning: Unknown types found, setting as type EEG:
temp: ['Temp']
  raw = reader[ext](raw_path, **kwargs)
/home/larsoner/python/mne-bids/mne_bids/read.py:60: RuntimeWarning: Data will be preloaded. preload=False or a string preload is not supported when the data is stored in the .set file
  raw = reader[ext](raw_path, **kwargs)
/home/larsoner/python/mne-bids/mne_bids/read.py:60: RuntimeWarning: Not setting positions of 14 gsr/misc/resp channels found in montage:
['EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8', 'GSR1', 'GSR2', 'Erg1', 'Erg2', 'Resp', 'Plet']
Consider setting the channel types to be of EEG/sEEG/ECoG/DBS/fNIRS using inst.set_channel_types before calling inst.set_montage, or omit these channels when creating your montage.
  raw = reader[ext](raw_path, **kwargs)
/home/larsoner/python/mne-bids/mne_bids/read.py:586: RuntimeWarning: The unit for channel(s) EXG1, EXG2, EXG3, EXG4, EXG5, EXG6, EXG7, EXG8, Erg1, Erg2, Plet has changed from NA to V.
  raw.set_channel_types(channel_type_bids_mne_map_available_channels)
/home/larsoner/python/mne-bids/mne_bids/read.py:586: RuntimeWarning: The unit for channel(s) Temp has changed from V to C.
  raw.set_channel_types(channel_type_bids_mne_map_available_channels)
/home/larsoner/python/mne-bids/mne_bids/dig.py:540: RuntimeWarning: There are channels without locations (n/a) that are not marked as bad: ['EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8', 'GSR1', 'GSR2', 'Erg1', 'Erg2', 'Resp', 'Plet', 'Temp']
  warn(f"There are channels without locations "
/home/larsoner/python/mne-bids/mne_bids/dig.py:550: RuntimeWarning: Not setting positions of 15 gsr/misc/resp/temperature channels found in montage:
['EXG1', 'EXG2', 'EXG3', 'EXG4', 'EXG5', 'EXG6', 'EXG7', 'EXG8', 'GSR1', 'GSR2', 'Erg1', 'Erg2', 'Resp', 'Plet', 'Temp']
Consider setting the channel types to be of EEG/sEEG/ECoG/DBS/fNIRS using inst.set_channel_types before calling inst.set_montage, or omit these channels when creating your montage.
  raw.set_montage(montage, on_missing='warn')
/home/larsoner/Desktop/temp.py:29: RuntimeWarning: Channel(s) ['GSR2Temp'] could not be picked, because they are not present in the info instance.
  raw.copy().pick(['GSR1', 'GSR2' 'Temp']).plot()
/home/larsoner/python/mne-python/mne/viz/_mpl_figure.py:441: UserWarning: Attempting to set identical low and high ylims makes transformation singular; automatically expanding.
  ax_vscroll.set_ylim(len(ch_order), 0)
/home/larsoner/python/mne-python/mne/viz/_mpl_figure.py:1733: UserWarning: Attempting to set identical low and high ylims makes transformation singular; automatically expanding.
  self.mne.ax_main.set_ylim(ylim)
Traceback (most recent call last):
  File "/home/larsoner/Desktop/temp.py", line 29, in <module>
    raw.copy().pick(['GSR1', 'GSR2' 'Temp']).plot()
  File "/home/larsoner/python/mne-python/mne/io/base.py", line 1529, in plot
    return plot_raw(self, events, duration, start, n_channels, bgcolor,
  File "<decorator-gen-155>", line 12, in plot_raw
  File "/home/larsoner/python/mne-python/mne/viz/raw.py", line 355, in plot_raw
    fig = _get_browser(show=show, block=block, **params)
  File "/home/larsoner/python/mne-python/mne/viz/_figure.py", line 659, in _get_browser
    fig = backend._init_browser(**kwargs)
  File "/home/larsoner/python/mne-python/mne/viz/_mpl_figure.py", line 2278, in _init_browser
    fig._update_trace_offsets()
  File "/home/larsoner/python/mne-python/mne/viz/_mpl_figure.py", line 1738, in _update_trace_offsets
    self._update_yaxis_labels()
  File "/home/larsoner/python/mne-python/mne/viz/_mpl_figure.py", line 1642, in _update_yaxis_labels
    ticklabels = self.mne.ch_names[self.mne.picks]
IndexError: arrays used as indices must be of integer (or boolean) type
```
I see in the output and a quick sanity check a few things:

1. MNE-BIDS not setting the `Temp` channel as a temperature channel
2. Missing comma between `'GSR2'` and `'Temp'` causing them not to be picked
3. Us not handling empty picks correctly, which I'm fixing
4. The data appearing broken on read: `raw.get_data('temperature').max()` is `-5.005000233650207e-07`

I'll open a WIP PR to fix the picking bug (3), but two of the other things (1, 4) probably need to be fixed at the MNE-BIDS/OpenNeuro end I think.
Please also check the `GSR`, I see:
```
>>> raw.get_data('gsr').max()
-4.843750298023223e-07
>>> raw.get_data('gsr').min()
-4.843750298023223e-07
```
If these are reasonable values we can figure out how to plot them nicely. But it appears totally constant, which seems suspicious.

Resolving patch:
diff --git a/mne/defaults.py b/mne/defaults.py
--- a/mne/defaults.py
+++ b/mne/defaults.py
@@ -42,7 +42,7 @@
                            fnirs_fd_ac_amplitude=2e-2, fnirs_fd_phase=2e-1,
                            fnirs_od=2e-2, csd=200e-4,
                            dipole=1e-7, gof=1e2,
-                           gsr=1., temperature=1.),
+                           gsr=1., temperature=0.1),
     scalings_cov_rank=dict(mag=1e12, grad=1e11, eeg=1e5,  # ~100x scalings
                            seeg=1e1, dbs=1e4, ecog=1e4, hbo=1e4, hbr=1e4),
     ylim=dict(mag=(-600., 600.), grad=(-200., 200.), eeg=(-200., 200.),
diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py
--- a/mne/io/edf/edf.py
+++ b/mne/io/edf/edf.py
@@ -38,6 +38,7 @@
     'EMG': FIFF.FIFFV_EMG_CH,
     'BIO': FIFF.FIFFV_BIO_CH,
     'RESP': FIFF.FIFFV_RESP_CH,
+    'TEMP': FIFF.FIFFV_TEMPERATURE_CH,
     'MISC': FIFF.FIFFV_MISC_CH,
     'SAO2': FIFF.FIFFV_BIO_CH,
 }


Test patch:
diff --git a/mne/io/edf/tests/test_edf.py b/mne/io/edf/tests/test_edf.py
--- a/mne/io/edf/tests/test_edf.py
+++ b/mne/io/edf/tests/test_edf.py
@@ -99,6 +99,22 @@ def test_units_params():
         _ = read_raw_edf(edf_path, units='V', preload=True)
 
 
+def test_edf_temperature(monkeypatch):
+    """Test that we can parse temperature channel type."""
+    raw = read_raw_edf(edf_path)
+    assert raw.get_channel_types()[0] == 'eeg'
+
+    def _first_chan_temp(*args, **kwargs):
+        out, orig_units = _read_edf_header(*args, **kwargs)
+        out['ch_types'][0] = 'TEMP'
+        return out, orig_units
+
+    monkeypatch.setattr(edf.edf, '_read_edf_header', _first_chan_temp)
+    raw = read_raw_edf(edf_path)
+    assert 'temperature' in raw
+    assert raw.get_channel_types()[0] == 'temperature'
+
+
 def test_subject_info(tmp_path):
     """Test exposure of original channel units."""
     raw = read_raw_edf(edf_path)