# Filter\_Length Warning filter\_data

**URL:** <https://mne.discourse.group/t/filter-length-warning-filter-data/4417>\
**Category:** Support & Discussions\
**Created:** [February 15, 2022, 4:40pm UTC](https://mne.discourse.group/t/filter-length-warning-filter-data/4417 "2022-02-15T16:40:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flo](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@Flo](https://mne.discourse.group/u/Flo)\
**Post date:** [February 15, 2022, 4:40pm UTC](https://mne.discourse.group/t/filter-length-warning-filter-data/4417/1 "2022-02-15T16:40:49Z")

</div>

- MNE version: 0.24.0
- operating system: Windows 11

I am trying to filter raw data which consists of 4 channels.

```python
raw_data = Df[["RAW_TP9", "RAW_TP10", "RAW_AF7", "RAW_AF8"]]

    raw_data = raw_data.to_numpy()

    before_data = raw_data

    low_freq, highFreq = 0.5, 50

    s_freq = 256

    filtered_data = mne.filter.filter_data(raw_data, s_freq, low_freq, highFreq)

```

This is the output with the warning:

```python
FIR filter parameters
---------------------
Designing a one-pass, zero-phase, non-causal bandpass filter:
- Windowed time-domain design (firwin) method
- Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
- Lower passband edge: 0.50
- Lower transition bandwidth: 0.50 Hz (-6 dB cutoff frequency: 0.25 Hz)
- Upper passband edge: 50.00 Hz
- Upper transition bandwidth: 12.50 Hz (-6 dB cutoff frequency: 56.25 Hz)
- Filter length: 1691 samples (6.605 sec)

D:\..\general_filtering.py:84: RuntimeWarning: filter_length (1691) is longer than the signal (4), distortion is likely. Reduce filter length or filter a longer signal.

```

It seems as the signal\_length is set to the amount of channels instead of the length of each channel. Reading the docs, my input parameters look right tho. Any tips what might have been gone wrong?

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [February 16, 2022, 8:50am UTC](https://mne.discourse.group/t/filter-length-warning-filter-data/4417/2 "2022-02-16T08:50:23Z")

</div>

what does `raw_data.shape` say? The channels should be the first dimension, the timepoints should be the second dimension. Probably calling `raw_data = raw_data.T` would solve your problem.

---

<div class="post-metadata">

**Author:** ![Flo](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@Flo](https://mne.discourse.group/u/Flo)\
**Post date:** [February 16, 2022, 9:34am UTC](https://mne.discourse.group/t/filter-length-warning-filter-data/4417/3 "2022-02-16T09:34:27Z")

</div>

Thank you very much, am still confused why it is supposed to be that way but now it works.

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [February 16, 2022, 10:06am UTC](https://mne.discourse.group/t/filter-length-warning-filter-data/4417/4 "2022-02-16T10:06:38Z")

</div>

you have a DataFrame, with columns being the channel names. Calling the `to_numpy` method thus gives you an array that has channels in the column dimension (the **2nd** dimension), and timepoints in the first dimension. MNE functions expect the exact opposite. Using the `.T` (“transpose”) method on an array will “flip the array around” so that the input matches what MNE expects.
