# who can help me solve this problem?

**URL:** <https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538>\
**Category:** Support & Discussions\
**Created:** [March 24, 2024, 1:49pm UTC](https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538 "2024-03-24T13:49:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jie](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jie](https://mne.discourse.group/u/jie)\
**Post date:** [March 24, 2024, 1:49pm UTC](https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538/1 "2024-03-24T13:49:23Z")

</div>

- MNE version: e.g. 1.3.1
- operating system: Windows 11

this is my code:  
import mne  
import numpy as np  
from scipy.signal import hilbert

print(mne. **version** )

# 加载数据集

data\_path = mne.datasets.sample.data\_path()  
raw\_fname = data\_path / ‘MEG’ / ‘sample’ / ‘sample\_audvis\_raw.fif’  
raw = mne.io.read\_raw\_fif(raw\_fname, preload=True)

# 选择感兴趣的电极和频段

picks = mne.pick\_types(raw.info, meg=True, eeg=False, exclude=‘bads’)  
raw.filter(low\_cut=8., high\_cut=12., method=‘iir’) # 正确的参数名  
epochs = mne.Epochs(raw, events=None, event\_id=None, tmin=-0.5, tmax=0.5, picks=picks, preload=True)

# 计算两个通道之间的PLV

def compute\_plv(signal1, signal2):  
# 计算信号的解析信号  
analytic\_signal1 = hilbert(signal1)  
analytic\_signal2 = hilbert(signal2)

```
# 计算瞬时相位
instant_phase1 = np.unwrap(np.angle(analytic_signal1))
instant_phase2 = np.unwrap(np.angle(analytic_signal2))

# 计算相位差
phase_diff = instant_phase1 - instant_phase2

# 计算PLV
plv = np.abs(np.mean(np.exp(1j * phase_diff)))

return plv

```

# 初始化PLV矩阵

n\_channels = len(epochs.ch\_names)  
plv\_matrix = np.zeros((n\_channels, n\_channels))

# 计算所有通道对之间的PLV

for i in range(n\_channels):  
for j in range(i + 1, n\_channels):  
# 获取通道信号  
signal1 = epochs.get\_data()[:, i, :]  
signal2 = epochs.get\_data()[:, j, :]

```
    # 计算PLV
    plv = compute_plv(signal1, signal2)

    # 存储PLV值（因为PLV是对称的，所以只存储上三角矩阵）
    plv_matrix[i, j] = plv
    plv_matrix[j, i] = plv

```

and this is the result:  
1.3.1  
Opening raw data file C:\Users\jie\mne\_data\MNE-sample-data\MEG\sample\sample\_audvis\_raw.fif…  
Read a total of 3 projection items:  
PCA-v1 (1 x 102) idle  
PCA-v2 (1 x 102) idle  
PCA-v3 (1 x 102) idle  
Range : 25800 … 192599 = 42.956 … 320.670 secs  
Ready.  
Reading 0 … 166799 = 0.000 … 277.714 secs…  
Traceback (most recent call last):  
File “D:/brain\_wave/PLV.py”, line 21, in   
raw.filter(low\_cut=8., high\_cut=12., method=‘iir’) # 正确的参数名  
TypeError: filter() got an unexpected keyword argument ‘low\_cut’

Process finished with exit code 1

so who can help me slove this problem?

---

<div class="post-metadata">

**Author:** ![jstout211](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/jstout211/32/180_2.png) [@jstout211](https://mne.discourse.group/u/jstout211)\
**Post date:** [March 24, 2024, 4:24pm UTC](https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538/2 "2024-03-24T16:24:20Z")

</div>

Filter doesn’t have keywords (low\_cut and high\_cut) – change it to `raw.filter(l_freq=8., h_freq=12.0, .....) `

```python
Signature:
raw.filter(
    l_freq,
    h_freq,

```

–Jeff

---

<div class="post-metadata">

**Author:** ![mscheltienne](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/mscheltienne/32/827_2.png) [@mscheltienne](https://mne.discourse.group/u/mscheltienne)\
**Post date:** [March 24, 2024, 4:40pm UTC](https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538/3 "2024-03-24T16:40:54Z")

</div>

Please take the time to:  
(1) browse the documentation website: [MNE — MNE 1.6.1 documentation](https://mne.tools/stable/index.html) and especially the API reference [Python API Reference — MNE 1.6.1 documentation](https://mne.tools/stable/api/python_reference.html) for explicit errors `got an unexpectted (...) argument`.  
(2) to format your code when posting a question (Ctrl + E or tool in the editor bar)

Mathieu

---

<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:** [March 25, 2024, 1:50pm UTC](https://mne.discourse.group/t/who-can-help-me-solve-this-problem/8538/4 "2024-03-25T13:50:31Z")

</div>

> [@jie](#):
>
> so who can help me slove this problem?

apart from the recommendations that @mscheltienne gave above, I would also recommend that you take the time to formulate a concise question, instead of merely supplying a code example.

Furthermore, formulating a fitting title for your question may attract more helpful answers.

Example for a good question title (picked semi-randomly from the current front page):

- [concatenate\_raws produces EDFs files with no output - #4 by cbrnr](https://mne.discourse.group/t/concatenate-raws-produces-edfs-files-with-no-output/8372/4)

→ Here, users already know the question will deal with:

- EDF files (raw)
- file IO
- concatenation of files
- …

Whereas “who can help me solve this problem” doesn’t say a lot about what you need.

Good luck!
