# Cannot plot raw data

**URL:** https://mne.discourse.group/t/cannot-plot-raw-data/8557
**Category:** Support & Discussions
**Created:** [March 25, 2024, 6:56pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557 "2024-03-25T18:56:30Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![AnaM](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AnaM](https://mne.discourse.group/u/AnaM)
#### Post date: [March 25, 2024, 6:56pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557/1 "2024-03-25T18:56:30Z")

</div>

- MNE version: 1.6.1
- operating system: macOS 12 (running in VSCode)

I’m trying to plot my continuous EEG data. Here’s my code:

```python
import mne

file_path = 'file_path/filename.gdf'

raw = mne.io.read_raw_gdf(file_path, preload=True)

print(raw.info)

raw.filter(1, 50, fir_design="firwin")

print(f"lowpass filter:{raw.info['lowpass']}")

raw.plot()

```

I get the following error:

```python
Traceback (most recent call last):
    raw.plot()
  File "...MNE-Python/1.6.1_0/.mne-python/lib/python3.11/site-packages/mne/io/base.py", line 1808, in plot
    return plot_raw(
           ^^^^^^^^^
  File "<decorator-gen-157>", line 12, in plot_raw
  File "...MNE-Python/1.6.1_0/.mne-python/lib/python3.11/site-packages/mne/viz/raw.py", line 258, in plot_raw
    decim, picks_data = _handle_decim(info, decim, lowpass)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...MNE-Python/1.6.1_0/.mne-python/lib/python3.11/site-packages/mne/viz/utils.py", line 1987, in _handle_decim
    decim = max(int(info["sfreq"] / (lp * 3) + 1e-6), 1)
                    ~~~~~~~~~~~~~~^~~~~~~~~~
ZeroDivisionError: float division by zero

```

My sampling frequency is 512.0 Hz (from raw.info).  
I noticed that the lowpass filter doesn’t update after raw.filter() (it remains zero), even though highpass filter is updated to 1. I also get the following message when loading my data:

```python
<ipython-input-2-f238b083ba6e>:4: RuntimeWarning: Channels contain different highpass filters. Highest filter setting will be stored.
  raw = mne.io.read_raw_gdf(file_path, preload=True)
<ipython-input-2-f238b083ba6e>:4: RuntimeWarning: Channels contain different lowpass filters. Lowest filter setting will be stored.
  raw = mne.io.read_raw_gdf(file_path, preload=True)

```

Before filtering, both high and lowpass are 0, and raw.plot() creates the same error. And I get the same error after removing all but eeg channels.

Appreciate any help! 🙂

---

<div class="post-metadata">

### Author: ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)
#### Post date: [March 25, 2024, 7:56pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557/2 "2024-03-25T19:56:14Z")

</div>

This is weird. Even before filtering, the lowpass should be set to the Nyquist frequency. Can you show the output of `raw.info` before and after filtering?

---

<div class="post-metadata">

### Author: ![AnaM](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AnaM](https://mne.discourse.group/u/AnaM)
#### Post date: [March 25, 2024, 8:09pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557/3 "2024-03-25T20:09:58Z")

</div>

Sure! Here’s before:

```python
<Info | 8 non-empty values
 bads: []
 ch_names: FP1, FPZ, FP2, F7, F3, FZ, F4, F8, FC5, FC1, FC2, FC6, M1, T7, ...
 chs: 67 EEG, 1 Stimulus
 custom_ref_applied: False
 highpass: 0.0 Hz
 lowpass: 0.0 Hz
 meas_date: 2024-02-28 19:14:52 UTC
 nchan: 68
 projs: []
 sfreq: 512.0 Hz
 subject_info: 4 items (dict)
>

```

Here’s after:

```python
<Info | 8 non-empty values
 bads: []
 ch_names: FP1, FPZ, FP2, F7, F3, FZ, F4, F8, FC5, FC1, FC2, FC6, M1, T7, ...
 chs: 67 EEG, 1 Stimulus
 custom_ref_applied: False
 highpass: 1.0 Hz
 lowpass: 0.0 Hz
 meas_date: 2024-02-28 19:14:52 UTC
 nchan: 68
 projs: []
 sfreq: 512.0 Hz
 subject_info: 4 items (dict)
>

```

And here’s the filter output if that helps: Filtering raw data in 1 contiguous segment  
Setting up band-pass filter from 1 - 50 Hz

```python
FIR filter parameters
---------------------
Designing a one-pass, zero-phase, non-causal bandpass filter:
<ipython-input-4-4639bfb5ae1d>:4: RuntimeWarning: Channels contain different highpass filters. Highest filter setting will be stored.
  raw = mne.io.read_raw_gdf(file_path, preload=True)
<ipython-input-4-4639bfb5ae1d>:4: RuntimeWarning: Channels contain different lowpass filters. Lowest filter setting will be stored.
  raw = mne.io.read_raw_gdf(file_path, preload=True)
- Windowed time-domain design (firwin) method
- Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
- Lower passband edge: 1.00
- Lower transition bandwidth: 1.00 Hz (-6 dB cutoff frequency: 0.50 Hz)
- Upper passband edge: 50.00 Hz
- Upper transition bandwidth: 12.50 Hz (-6 dB cutoff frequency: 56.25 Hz)
- Filter length: 1691 samples (3.303 s)

```

---

<div class="post-metadata">

### Author: ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)
#### Post date: [March 25, 2024, 8:56pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557/4 "2024-03-25T20:56:35Z")

</div>

This looks like a bug in our GDF reader. Could you open an issue and also share the file with us?

---

<div class="post-metadata">

### Author: ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)
#### Post date: [March 26, 2024, 6:25pm UTC](https://mne.discourse.group/t/cannot-plot-raw-data/8557/5 "2024-03-26T18:25:09Z")

</div>

The issue is being tracked here:

> <https://github.com/mne-tools/mne-python/issues/12517>
>
> The lowpass filter in raw.info is not set correctly when uploading raw gdf file …and doesn't update after filtering. I noticed it while trying to plot continuous data and getting a ZeroDivision error.
> gdf file: \[\[2024-02-28\_13\_14\_s01\_s01\_r01.gdf\]\](https://drive.google.com/file/d/1SRg32A2cDTTpLOGwCvwuv8\_\_eTeTLOHa/view?usp=share\_link)
> Code to replicate:
> \`\`\`
> import mne
> 
> file\_path = '2024-02-28\_13\_14\_s01\_s01\_r01.gdf'
> raw = mne.io.read\_raw\_gdf(file\_path, preload=True)
> print(raw.info)
> \#raw.plot()
> 
> raw.filter(1, 50, fir\_design="firwin")
> print(raw.info)
> raw.plot()
> 
> \`\`\`
> Error:
> \`\`\`
> Traceback (most recent call last):
> File "...eegplot\_test.py", line 11, in \<module\>
> raw.plot()
> File "...MNE-Python/1.6.1\_0/.mne-python/lib/python3.11/site-packages/mne/io/base.py", line 1808, in plot
> return plot\_raw(
> ^^^^^^^^^
> File "\<decorator-gen-157\>", line 12, in plot\_raw
> File "...MNE-Python/1.6.1\_0/.mne-python/lib/python3.11/site-packages/mne/viz/raw.py", line 258, in plot\_raw
> decim, picks\_data = \_handle\_decim(info, decim, lowpass)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "...MNE-Python/1.6.1\_0/.mne-python/lib/python3.11/site-packages/mne/viz/utils.py", line 1987, in \_handle\_decim
> decim = max(int(info\["sfreq"\] / (lp \* 3) + 1e-6), 1)
> ~~~~~~~~~~~~~~^~~~~~~~~~
> ZeroDivisionError: float division by zero
> \`\`\`
> raw.info before filtering:
> \`\`\`
> \<Info | 8 non-empty values
> bads: \[\]
> ch\_names: FP1, FPZ, FP2, F7, F3, FZ, F4, F8, FC5, FC1, FC2, FC6, M1, T7, ...
> chs: 67 EEG, 1 Stimulus
> custom\_ref\_applied: False
> highpass: 1.0 Hz
> lowpass: 0.0 Hz
> meas\_date: 2024-02-28 19:14:52 UTC
> nchan: 68
> projs: \[\]
> sfreq: 512.0 Hz
> subject\_info: 4 items (dict)
> \>
> \`\`\`
> raw.info after filtering:
> \`\`\`
> \<Info | 8 non-empty values
> bads: \[\]
> ch\_names: FP1, FPZ, FP2, F7, F3, FZ, F4, F8, FC5, FC1, FC2, FC6, M1, T7, ...
> chs: 67 EEG, 1 Stimulus
> custom\_ref\_applied: False
> highpass: 1.0 Hz
> lowpass: 0.0 Hz
> meas\_date: 2024-02-28 19:14:52 UTC
> nchan: 68
> projs: \[\]
> sfreq: 512.0 Hz
> subject\_info: 4 items (dict)
> \>
> \`\`\`
> Other information: 
> MNE version: 1.6.1
> Operating system: macOS 12
