MNE学习笔记(一):安装与测试

MNE学习笔记(一):安装与测试

参考文章:https://mp.weixin.qq.com/s/3IAIOoV7Ai4q0YNO_vxklw

环境

首先得确保电脑中已有python 3.0以上的环境,这里我安装的是Python 3.9.0

image-20210825182150867

安装

控制台输入安装代码即可完成安装:

pip install -U mne

测试

如果没有数据则可下载下面的数据:

链接: https://pan.baidu.com/s/1pL-0BHnDOlkiLGIKisJhxg 提取码: j43j

测试代码如下:

这里matplotlib的学习可以参考:https://www.jianshu.com/p/da385a35f68d这篇文章

# 引入python库
import mne
from mne.datasets import sample
import matplotlib.pyplot as plt

# 数据(fif文件)存放的地址
fname = 'D:/Data/MNE-sample-data/MEG/sample/sample_audvis_raw.fif'

# 存在文件则直接加载,否则从网上下载该数据
raw = mne.io.read_raw_fif(fname)

# 获取10-20秒内的良好的MEG数据
picks = mne.pick_types(raw.info, meg=True, exclude='bads')  # 选择良好的MEG信号,排除bads
t_idx = raw.time_as_index([10., 20.])   # 时间设置为10~20秒内的
data, times = raw[picks, t_idx[0]:t_idx[1]]
plt.plot(times, data.T)
plt.title("Sample channels")
plt.show()

# 绘制SSP矢量图
raw.plot_projs_topomap()
plt.show()

# 绘制电极位置
raw.plot_sensors()
plt.show()

结果:

image-20210826210705201 image-20210826210756822 image-20210826210828905
  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值