Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of using labeled data? #30

Open
dyhan316 opened this issue Jan 13, 2025 · 3 comments
Open

Example of using labeled data? #30

dyhan316 opened this issue Jan 13, 2025 · 3 comments

Comments

@dyhan316
Copy link

Thank you so much for the wonderful code!

I was wondering, do you have code examples for handling labeled data? (ex : events and such)

The questions are two-fold

  1. if the labels are session-wise (i.e. happy session, sad session... as in SEED dataset). How should I annotate this to the final saved data format? (HDF5 format)
  2. if the labels are within-session (ex : event at 10s , 15s, and so on), how should these events be loaded to the UnifiedDataset?

Best

Danny

@Baizhige
Copy link
Owner

Hi Danny,

Apologies for the delayed response.

For how to handle labeled data, you can refer to our tutorial here: How to Process Data and Export as h5Dataset.

As to label format, the label format is flexible, and EEGUnity's processing tool is primarily built on MNE-Python. I strongly recommend converting your dataset to the FIF file with annotation that stores events. The annotation can be created using the following code:
annotations = mne.annotations_from_events( events=new_events, sfreq=mne_raw.info['sfreq'], event_desc=event_desc # Mapping event codes to descriptions ) mne_raw.set_annotations(annotations) # Set new annotations to raw data
For more detailed information, please refer to the MNE-Python tutorial: MNE Annotations Documentation.
Thank you for your suggestion. We plan to release a new version in March.

Best regards,
Chengxuan

@ityebai
Copy link

ityebai commented Jan 29, 2025

你好,很感谢你的代码,我是一个初学者,对于的你的代码运行还是有点小问题,想问一下,这个项目的代码,改怎么运行,我运行了几个文件,但是都是有少文件的提示,好几个地方运行提示=缺少figshare_meng2019_CI.csv文件,我在你的项目代码里面没有找到这个文件,我想请问一下,这个文件是你项目中提供的,还是需要我们自己提供呢?还有一个就是,这个项目有前端,我想知道这个前端我们是怎么运行起来的呢,好像没有前后端分离,我目前是运行index.html进去的,进去之后在里面进行切换,不知道这样对不对。最后一个问题就是如果我们想要使用你的代码,最终需要执行哪一个py文件呢?因为这有点多,不知道最终是运行哪一个py文件,需要看到此留言,在空闲时间能帮忙解决一下困惑,万分感谢🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

@fantomg
Copy link
Collaborator

fantomg commented Jan 31, 2025

你好,很感谢你的代码,我是一个初学者,对于的你的代码运行还是有点小问题,想问一下,这个项目的代码,改怎么运行,我运行了几个文件,但是都是有少文件的提示,好几个地方运行提示=缺少figshare_meng2019_CI.csv文件,我在你的项目代码里面没有找到这个文件,我想请问一下,这个文件是你项目中提供的,还是需要我们自己提供呢?还有一个就是,这个项目有前端,我想知道这个前端我们是怎么运行起来的呢,好像没有前后端分离,我目前是运行index.html进去的,进去之后在里面进行切换,不知道这样对不对。最后一个问题就是如果我们想要使用你的代码,最终需要执行哪一个py文件呢?因为这有点多,不知道最终是运行哪一个py文件,需要看到此留言,在空闲时间能帮忙解决一下困惑,万分感谢🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

Dear ityebai,

你好!衷心感谢你对项目的关注以及认真提出的问题!以下是针对你疑问的逐项解答,希望能帮助你顺利上手:

  1. 关于 figshare_meng2019_CI.csv 文件缺失问题
    文件性质:
    该文件是示例代码中引用的数据集占位符,用于演示工具包的数据处理流程,但实际数据集并未包含在项目中(因版权或体积限制)。

解决方案:
你需要根据自身数据生成适配的 CSV 文件:

参照教程:查看项目主页readme文件中的 Tutorial1,学习如何由原始 EEG 数据(如 .edf, .fif 等)得到 CSV 格式的locator文件。

自定义路径:在代码中替换文件路径变量,指向你生成的 CSV 文件(如修改为 "your_data.csv")。

  1. 关于前端(index.html)的运行疑惑
    项目定位:
    EEGUnity 是一个 Python 工具包,核心功能通过脚本或 API 调用实现,并非网页应用。

index.html 的作用:
该文件是项目的静态文档(位于 docs/ 目录),用于说明工具包的功能和接口,而非程序入口。直接打开仅能浏览文档,无法运行核心功能。

  1. 关于执行哪个 Python 文件作为入口
    模块化设计:
    工具包没有单一的“主入口”,而是提供多个功能模块和示例脚本(位于 CI/ 目录)。

推荐步骤:

学习示例:运行 CI/ 下的示例脚本,观察数据处理流程。

查阅文档:阅读网页版文档,了解模块功能。

组合调用:根据需求编写自己的脚本,按需调用模块(如预处理 → 分析 → 可视化)。

额外建议
参考 mne-python:
若对 EEG 处理流程不熟悉,推荐学习 mne-python 官方教程,掌握基础概念(如滤波、epoching、ERP 分析等)。

调试技巧:

运行示例时若报错,请检查依赖版本(pip install -r requirements.txt)。

在 GitHub 仓库的 Issue 中搜索类似问题,或提交新 Issue 附上错误日志。

感谢你的耐心反馈!我们正在优化文档清晰度和示例代码,新版本将于近期发布,敬请期待! 🚀
如有其他问题,欢迎随时联系!祝探索愉快! 🌟

Best regards,
Wenlong

@fantomg fantomg closed this as completed Jan 31, 2025
@fantomg fantomg reopened this Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants