# FIR filter order

**URL:** <https://mne.discourse.group/t/fir-filter-order/4436>\
**Category:** Support & Discussions\
**Tags:** fnirs, frequency-filter\
**Created:** [February 18, 2022, 3:21pm UTC](https://mne.discourse.group/t/fir-filter-order/4436 "2022-02-18T15:21:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nolwenn](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@Nolwenn](https://mne.discourse.group/u/Nolwenn)\
**Post date:** [February 18, 2022, 3:21pm UTC](https://mne.discourse.group/t/fir-filter-order/4436/1 "2022-02-18T15:21:17Z")

</div>

Hi,  
I’m working on Windows 10 with Python 3.9 and MNE 0.24.1. I’m working on fNIRS signals and trying to filter it using a Bandpass FIR filter order 1000 with the following cut off frequency [0.01, 0.09]. I don’t know how to specify the filter order. Here is a part of my code :

```python
OD=mne.preprocessing.nirs.optical_density(rawData)
Conc=mne.preprocessing.nirs.beer_lambert_law(OD,ppf=6)
FilteredData=Conc.copy().filter(0.01, 0.09, l_trans_bandwidth=0.005,h_trans_bandwidth=0.005, method='fir')

```

Thanks !  
Nolwenn

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [February 21, 2022, 3:21pm UTC](https://mne.discourse.group/t/fir-filter-order/4436/2 "2022-02-21T15:21:51Z")

</div>

You want the `filter_length` parameter:

[https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.filter](https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.filter)

---

<div class="post-metadata">

**Author:** ![Nolwenn](https://avatars.discourse-cdn.com/v4/letter/n/82dd89/32.png) [@Nolwenn](https://mne.discourse.group/u/Nolwenn)\
**Post date:** [June 13, 2022, 8:28am UTC](https://mne.discourse.group/t/fir-filter-order/4436/3 "2022-06-13T08:28:55Z")

</div>

> [@Nolwenn](#):
>
> rking on Windows 10 with Python 3.9 and MNE 0.24.1. I’m working on fNIRS signals and trying to filter it using a Bandpass FIR filter order 1000 with the following cut off frequency [0.01, 0.09]. I don’t know how to specify the filter order. Here is a part of my code :

Thanks for your answer, I’ve looked at the filter\_length parameter but I don’t know how to use it. To have a 1000th order filter what specification should I use for the filter\_length parameter ?

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [June 13, 2022, 2:41pm UTC](https://mne.discourse.group/t/fir-filter-order/4436/4 "2022-06-13T14:41:10Z")

</div>

Quoting [Filter order vs number of taps vs number of coefficients - Signal Processing Stack Exchange](https://dsp.stackexchange.com/questions/8685/filter-order-vs-number-of-taps-vs-number-of-coefficients) :

> The order of an FIR filter is filter length minus 1

So if you want an order-1000 FIR filter, you want `filter_length=1001` (int)
