Event stream logging system for Spiking Neural Networks
Project description
Spimind
English | 中文
专为脉冲神经网络设计的事件流日志系统,使用TinyDB作为存储后端。
特性
- 轻量级API: 一行初始化,一行记录,一行关闭
- 事件流优先: 以
log_event为核心,而非传统的"step"概念 - 可插桩: 支持在关键节点挂载hook函数
- TinyDB存储: 结构化数据存储,支持复杂查询
安装
pip install -e .
快速开始
import spimind
# 初始化日志记录器
logger = spimind.init(project="spimind-sim")
# 记录神经元发放事件
logger.log_event(event="spike", event_time=12.3, neuron="LIF_23")
# 关闭记录器
logger.close()
使用示例
基本用法
import spimind
logger = spimind.init(project="test")
logger.log_event(event="spike", event_time=1.0, neuron="neuron_1")
logger.close()
上下文管理器
with spimind.init(project="test") as logger:
logger.log_event(event="spike", event_time=1.0, neuron="neuron_1")
Hook功能
def spike_monitor(event_data):
if event_data['event'] == 'spike':
print(f"检测到发放: {event_data['neuron']}")
logger = spimind.init(project="test")
logger.add_hook(spike_monitor)
logger.log_event(event="spike", event_time=1.0, neuron="LIF_1")
示例代码
查看 example/ 目录获取更多使用示例:
basic_usage.py- 基本使用示例hook_example.py- Hook功能示例context_manager_example.py- 上下文管理器示例
API
spimind.init()
初始化日志记录器
参数:
project(str): 项目名称run_name(str, 可选): 运行名称,默认自动生成**kwargs: 传递给后端的具体参数
logger.log_event()
记录事件
参数:
event(str): 事件类型event_time(float): 事件时间戳**kwargs: 事件相关数据
logger.add_hook()
添加事件处理hook
参数:
hook_func(callable): 处理事件的函数
logger.close()
关闭日志记录器
许可证
本项目采用 MIT 许可证。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
spimind-0.1.0.tar.gz
(8.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spimind-0.1.0.tar.gz.
File metadata
- Download URL: spimind-0.1.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
385245fa53b84da6d740c1f62a37fce7339361d5f63ff4490ed9339133e39108
|
|
| MD5 |
a4d3ab901e4c1466c53e9188296a7e7a
|
|
| BLAKE2b-256 |
f116c6c3d0701632cff10ec63764e493492c65d8b98a8e457630c138fddbfc4e
|
File details
Details for the file spimind-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spimind-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df3b55cc614e0b6eb759cc827f869aaadc9d59bac088ab5777a10546843db905
|
|
| MD5 |
85f544ac02c0f08e49885f9a0fd5fa0f
|
|
| BLAKE2b-256 |
9aa2472eebde9d4d457c914a466d1e1c1818d939e10346fcc2b94afb1cef69dd
|