实战指南:利用MNE-Python高效绘制fNIRS脑地形图

mne绘制脑地形图 只有各个通道的脑电数据以及通道名称,借助mne绘制脑地形图 生成mne的raw对象 创建events和epochs对象 给epochs设置通道名 epochs.set_montage(‘standard_1020’),1020即10-20,详情见官方文档,设置好就可画了。这是api里提供的方法,自己挑选 生成evokeds对象 nave = len(epochs.get_data()) epochs.get_data().shape evoked_data = np.mean(epochs.get_da 阅读详情

1. fNIRS脑地形图绘制入门指南

第一次接触fNIRS脑地形图绘制时,我被那些彩色的大脑图像深深吸引。你可能也在文献中见过这些酷炫的图形——它们用不同颜色展示大脑各区域的血氧变化,直观呈现神经活动模式。但当我真正开始动手实践时,才发现从原始数据到最终图像需要跨越不少技术障碍。

MNE-Python作为神经科学领域的瑞士军刀,为fNIRS数据处理提供了完整解决方案。它支持从原始信号读取、预处理到可视化全流程,特别适合处理光学拓扑成像数据。我最初使用MATLAB处理fNIRS数据,后来发现MNE的Python接口更加灵活高效,尤其是其内置的脑地形图绘制功能,只需几行代码就能生成专业级图像。

在实际项目中,我经常遇到SNIRF格式数据读取异常的问题。比如上周处理一组运动想象实验数据时,系统突然报错"TypeError: iteration over a 0-d array",原因是探头标签信息丢失。这时就需要手动补全源极(Sources)和检测器(Detectors)的标签信息:

sources = ['S1','S2','S3','S4','S5','S6','S7','S8']
detectors = ['D1','D2','D3','D4','D5','D6','D7','D8']

2. 数据预处理关键步骤

数据预处理是保证结果可靠性的基石。我的经验是,原始fNIRS信号就像刚挖出的矿石,需要经过多道工序才能显现价值。光学密度(OD)转换是首要环节,通过比尔-朗伯定律将原始光强信号转化为血氧动力学参数:

raw_haemo = mne.preprocessing.nirs.beer_lambert_law(raw_od)

运动伪迹校正曾让我头疼不已。有次实验被试头部微动导致信号漂移,我试过多种方法后发现样条插值效果最佳。MNE提供了便捷的移动标准差检测方法:

# 检测运动伪迹
m
使用自定义数据绘制脑地形矩阵图 最近做数据处理,想画点自己想要的图,但是找遍了各种库,都没有一个函数可以实现我想要的效果,所以关机时刻还得靠自己啊,自己动手丰衣足食,记录一下实现过程,方便以后查阅。 阅读详情

相关推荐

python下用cartopy绘制地形晕染(shading)图

使用python绘制地形高程阴影图/晕染图/shading

yangshun_cug 1531

使用mne库绘制地形图

使用mne库绘制地形图

m0_62353117的博客 1742

Python中MNE库的脑电地形图绘制

脑电地形图在进行和“源”相关的分析时很有用,可以直观的看出各个电极的激活情况以及其随时间的变化。在标准的脑电数据中都是有电极的坐标位置的,会用EEGLab的可能对这块比较熟悉了,实际MNE库中也有相关的定义和实现,可以导入外部的电极数据,或者使用一些标准的位置信息如:10-20电极分布。 电极的坐标以及坐标系: 脑电电极的分布可以根据实际情况设计不同的位置,以标准的1020为例。 https://www.diytdcs.com/2012/07/1020-system-electrode-distanc

zhoudapeng01的专栏 1万+

tcmalloc(高并发内存池)简化版讲解-项目

高清发不上去,私我发高清,项目完整代码@我。

2201_75352618的博客 912

地质工程师必备:Dips软件从数据导入到主结构面分析的完整流程解析

本文详细解析了地质工程师使用Dips软件进行主结构面分析的完整流程。从数据准备与导入、结构面分组与扇形区划分,到主结构面计算与工程解读,系统阐述了如何将野外节理数据转化为控制岩体稳定性的关键信息。重点介绍了利用等值线图识别优势组、计算统计主值及其置信椭圆,并强调了地质判断与工程应用结合的重要性。

table的专栏 347

SimpleITK图像基础(一)——3D Resampling

文章目录前言基于SimpleITK进行实现 前言 进入深度学习网络之前需要进行统一数据集,这个时候需要对这些数据集进行重新采样,即假设各向同性体素并重新定向它们,以便可以读取所有图像的像素矩阵。 在将方位变换成一致时,可以用DICOMOrientImageFilter过滤器,可以将 DesiredCoordinateOrientation设置为你想要变换的方位,它将计算出所需的置换顺序并根据需要执行翻转以接近所需方向。 基于SimpleITK进行实现 workflow如下: step 1:首先运行DICOM

YYY_77的博客 2021

基于ASP.NET+SQLServer的美妆网站的设计与实现

通过本次ASP.NET MVC美妆商城项目的开发,我们实现了一个功能完善、性能稳定的在线购物平台。该项目不仅提升了用户的购物体验,也为商家提供了一个高效的商品管理和销售渠道。未来,我们将持续优化系统功能,提升用户体验,以适应不断变化的市场需求。

毕业设计大牛哥 1507

基于强化学习的工业SCR脱硝系统控制算法设计与实现

本文提出了一种基于强化学习的工业SCR脱硝系统智能控制方法。针对SCR系统存在的非线性、大滞后和多变量耦合等控制难点,研究采用混合建模方法构建了精度在5%以内的系统模型,并设计了专门的强化学习环境。该方法通过定义合理的动作空间和状态空间,结合物理约束设计损失函数,利用深度强化学习算法优化氨喷射控制策略。相比传统PID控制,该智能控制器能更好地适应烟气参数波动,实现NOx排放的稳定控制,为工业环保设施提供了更优的自动化解决方案。

huanghm88的专栏 1461

Win10平台下QT6.9.0 OpenCV 4.10.0从入门到精通

我最近开发一个视觉项目,我们从0开始记录在windows 10下 用QT6.9+OpenCV 4.10.0搞定整个项目的开发过程。以抛砖引玉,大家共同进步。

fds111111的博客 1718

[Dify实战] OA 公文排版助手:自动格式化、编号、生成摘要-带配套资源

摘要: Dify 公文排版助手通过自动化解决公文处理中的格式混乱、编号错漏等问题。支持标题层级自动编号、摘要生成、要素补全等功能,输出标准化Markdown格式。核心流程包括输入原文、智能识别、自动排版与要素输出,适用于通知、纪要等场景。实施需统一模板规则,规范输入格式,并通过试跑优化纠错率与处理效率。关键价值在于减少人工返工,提升排版一致性,未来可对接OA系统实现全流程自动化。

技术小甜甜:传播可落地技术,帮助个人和企业降低解决真实场景问题的成本 476

高空抛物监控系统:基于YOLOv8的轨迹追踪与可视化系统

本文详细介绍了一种基于YOLOv8深度学习模型的高空抛物监控系统,该系统能够实时检测并追踪高层建筑抛掷物的运动轨迹。文章包含完整的系统设计思路、算法实现细节、数据集构建方法以及基于PyQt5的可视化界面开发过程。我们提供了完整的Python实现代码,并讨论了系统的性能优化策略和实际部署考量。此外,我们还推荐了几个公开可用的高空抛物数据集,并详细分析了系统的应用前景和技术挑战。

YOLO 449

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

上一篇: DomoAI 实景视频转动画:从入门到精通的完整指南
下一篇: 求解器参数背后的数学原理:为什么这个设置能加速你的优化?
愤怒美智
博客等级 码龄10年 42粉丝 2297原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址