evutils 0.3.0__tar.gz → 0.3.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. evutils-0.3.6/.dockerignore +15 -0
  2. {evutils-0.3.0 → evutils-0.3.6}/.github/workflows/release.yaml +7 -7
  3. evutils-0.3.6/.github/workflows/test.yaml +32 -0
  4. evutils-0.3.6/.gitignore +55 -0
  5. {evutils-0.3.0 → evutils-0.3.6}/CMakeLists.txt +0 -2
  6. evutils-0.3.6/PKG-INFO +227 -0
  7. evutils-0.3.6/README.md +162 -0
  8. evutils-0.3.6/benchmarks/README.md +102 -0
  9. evutils-0.3.6/benchmarks/conftest.py +75 -0
  10. evutils-0.3.6/benchmarks/docker/Dockerfile.openeb +57 -0
  11. evutils-0.3.6/benchmarks/readers.py +88 -0
  12. evutils-0.3.6/benchmarks/test_compare.py +39 -0
  13. evutils-0.3.6/benchmarks/test_read.py +34 -0
  14. evutils-0.3.6/benchmarks/test_write.py +31 -0
  15. evutils-0.3.6/csrc/evt2.c +124 -0
  16. evutils-0.3.6/csrc/evt21.c +140 -0
  17. evutils-0.3.6/csrc/evt3.c +557 -0
  18. evutils-0.3.6/csrc/evutils.c +10 -0
  19. evutils-0.3.6/csrc/include/evutils/evt2.h +34 -0
  20. evutils-0.3.6/csrc/include/evutils/evt21.h +34 -0
  21. {evutils-0.3.0 → evutils-0.3.6}/csrc/include/evutils/evt3.h +15 -16
  22. {evutils-0.3.0 → evutils-0.3.6}/csrc/include/evutils/evutils.h +0 -7
  23. evutils-0.3.6/csrc/include/evutils/parser.h +35 -0
  24. {evutils-0.3.0 → evutils-0.3.6}/csrc/include/evutils/types.h +18 -9
  25. {evutils-0.3.0 → evutils-0.3.6}/docs/source/_templates/autoapi/python/module.rst +9 -0
  26. evutils-0.3.6/docs/source/benchmarks/README.md +1 -0
  27. {evutils-0.3.0 → evutils-0.3.6}/docs/source/conf.py +1 -0
  28. {evutils-0.3.0 → evutils-0.3.6}/docs/source/index.rst +8 -4
  29. {evutils-0.3.0 → evutils-0.3.6}/pyproject.toml +34 -16
  30. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/__init__.py +6 -4
  31. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/io/__init__.py +2 -2
  32. evutils-0.3.6/src/evutils/io/_aedat.py +33 -0
  33. evutils-0.3.6/src/evutils/io/_aer.py +32 -0
  34. evutils-0.3.6/src/evutils/io/_bin.py +31 -0
  35. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/io/_csv.py +41 -41
  36. evutils-0.3.6/src/evutils/io/_dat.py +30 -0
  37. evutils-0.3.6/src/evutils/io/_event_reader.py +379 -0
  38. evutils-0.3.6/src/evutils/io/_event_writer.py +128 -0
  39. evutils-0.3.6/src/evutils/io/_evt.py +548 -0
  40. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/io/_hdf5.py +55 -55
  41. evutils-0.3.6/src/evutils/io/_native_evt.py +481 -0
  42. evutils-0.3.6/src/evutils/io/_npz.py +30 -0
  43. evutils-0.3.6/src/evutils/io/_source.py +276 -0
  44. evutils-0.3.6/src/evutils/io/buffer.py +98 -0
  45. evutils-0.3.0/src/evutils/io/_common.py → evutils-0.3.6/src/evutils/io/common.py +72 -81
  46. evutils-0.3.6/src/evutils/io/decoders.py +131 -0
  47. evutils-0.3.6/src/evutils/io/encoders.py +68 -0
  48. evutils-0.3.6/src/evutils/types.py +127 -0
  49. evutils-0.3.6/tests/conftest.py +73 -0
  50. evutils-0.3.6/tests/io/conftest.py +45 -0
  51. evutils-0.3.6/tests/io/test_evt.py +203 -0
  52. evutils-0.3.6/uv.lock +3667 -0
  53. evutils-0.3.0/.github/workflows/test.yaml +0 -35
  54. evutils-0.3.0/.gitignore +0 -25
  55. evutils-0.3.0/PKG-INFO +0 -154
  56. evutils-0.3.0/README.md +0 -102
  57. evutils-0.3.0/csrc/evutils.c +0 -24
  58. evutils-0.3.0/src/evutils/_native.py +0 -291
  59. evutils-0.3.0/src/evutils/io/_aedat.py +0 -17
  60. evutils-0.3.0/src/evutils/io/_bin.py +0 -15
  61. evutils-0.3.0/src/evutils/io/_dat.py +0 -14
  62. evutils-0.3.0/src/evutils/io/_npz.py +0 -14
  63. evutils-0.3.0/src/evutils/io/_raw.py +0 -588
  64. evutils-0.3.0/src/evutils/io/_reader.py +0 -428
  65. evutils-0.3.0/src/evutils/io/_txt.py +0 -16
  66. evutils-0.3.0/src/evutils/io/_writer.py +0 -162
  67. evutils-0.3.0/src/evutils/io/buffer.py +0 -76
  68. evutils-0.3.0/src/evutils/io/reader.py +0 -145
  69. evutils-0.3.0/src/evutils/io/writer.py +0 -129
  70. evutils-0.3.0/src/evutils/types.py +0 -90
  71. evutils-0.3.0/tests/io/conftest.py +0 -104
  72. evutils-0.3.0/tests/io/test_raw.py +0 -164
  73. {evutils-0.3.0 → evutils-0.3.6}/.gitmodules +0 -0
  74. {evutils-0.3.0 → evutils-0.3.6}/LICENSE +0 -0
  75. {evutils-0.3.0 → evutils-0.3.6}/docker/Dockerfile +0 -0
  76. {evutils-0.3.0 → evutils-0.3.6}/docs/Makefile +0 -0
  77. {evutils-0.3.0 → evutils-0.3.6}/docs/make.bat +0 -0
  78. {evutils-0.3.0 → evutils-0.3.6}/docs/source/_static/event_hexagon_broken.webp +0 -0
  79. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/augment/__init__.py +0 -0
  80. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/augment/_drop.py +0 -0
  81. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/chunking.py +0 -0
  82. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/dataset/__init__.py +0 -0
  83. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/processing/__init__.py +0 -0
  84. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/processing/_masking.py +0 -0
  85. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/processing/_utils.py +0 -0
  86. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/random.py +0 -0
  87. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/__init__.py +0 -0
  88. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/_frame.py +0 -0
  89. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/_histogram.py +0 -0
  90. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/_timesurface.py +0 -0
  91. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/_tore.py +0 -0
  92. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/repr/_voxel.py +0 -0
  93. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/torch/__init__.py +0 -0
  94. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/utils/__init__.py +0 -0
  95. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/utils/_checker.py +0 -0
  96. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/__init__.py +0 -0
  97. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/open3d.py +0 -0
  98. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/plot3d.py +0 -0
  99. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/reconstructor/__init__.py +0 -0
  100. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/reconstructor/_base.py +0 -0
  101. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/reconstructor/metavision.py +0 -0
  102. {evutils-0.3.0 → evutils-0.3.6}/src/evutils/vis/reconstructor/rpg.py +0 -0
  103. {evutils-0.3.0 → evutils-0.3.6}/tests/io/test_bin.py +0 -0
  104. {evutils-0.3.0 → evutils-0.3.6}/tests/io/test_csv.py +0 -0
  105. {evutils-0.3.0 → evutils-0.3.6}/tests/io/test_dat.py +0 -0
  106. {evutils-0.3.0 → evutils-0.3.6}/tests/io/test_hdf5.py +0 -0
  107. {evutils-0.3.0 → evutils-0.3.6}/tests/io/test_npz.py +0 -0
  108. {evutils-0.3.0 → evutils-0.3.6}/tests/test_random.py +0 -0
  109. {evutils-0.3.0 → evutils-0.3.6}/tests/test_types.py +0 -0
  110. {evutils-0.3.0 → evutils-0.3.6}/tests/test_vis.py +0 -0
@@ -0,0 +1,15 @@
1
+ # Keep the Docker build context small (used by benchmarks/docker/Dockerfile.openeb).
2
+ .venv
3
+ build
4
+ .git
5
+ .github
6
+ data
7
+ *.raw
8
+ .benchmarks
9
+ .pytest_cache
10
+ __pycache__
11
+ *.pyc
12
+ docs
13
+ dist
14
+ *.prof
15
+ *.svg
@@ -15,10 +15,10 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  steps:
17
17
  - name: Checkout repository
18
- uses: actions/checkout@v4
18
+ uses: actions/checkout@v7
19
19
 
20
20
  - name: Install uv
21
- uses: astral-sh/setup-uv@v5
21
+ uses: astral-sh/setup-uv@v8.2.0
22
22
  with:
23
23
  enable-cache: true
24
24
 
@@ -49,15 +49,15 @@ jobs:
49
49
  runs-on: ubuntu-latest
50
50
  steps:
51
51
  - name: Checkout repository
52
- uses: actions/checkout@v4
52
+ uses: actions/checkout@v7
53
53
 
54
54
  - name: Install uv
55
- uses: astral-sh/setup-uv@v5
55
+ uses: astral-sh/setup-uv@v8.2.0
56
56
  with:
57
57
  enable-cache: true
58
58
 
59
59
  - name: Set up Python
60
- uses: actions/setup-python@v5
60
+ uses: actions/setup-python@v6
61
61
  with:
62
62
  python-version: "3.10"
63
63
 
@@ -71,10 +71,10 @@ jobs:
71
71
  make html
72
72
 
73
73
  - name: Setup GitHub Pages
74
- uses: actions/configure-pages@v4
74
+ uses: actions/configure-pages@v6
75
75
 
76
76
  - name: Upload artifact
77
- uses: actions/upload-pages-artifact@v3
77
+ uses: actions/upload-pages-artifact@v5
78
78
  with:
79
79
  path: 'docs/build/html'
80
80
 
@@ -0,0 +1,32 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [main, feature/*, fix/*]
6
+ pull_request:
7
+ branches: [main, feature/*, fix/*]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v7
19
+ with:
20
+ submodules: recursive
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v8.2.0 # pin to a full version — see note below
24
+ with:
25
+ enable-cache: true
26
+ python-version: ${{ matrix.python }}
27
+
28
+ - name: Install the project
29
+ run: uv sync --extra dev
30
+
31
+ - name: Run tests
32
+ run: uv run pytest -s -v
@@ -0,0 +1,55 @@
1
+ # Python build artifacts
2
+ __pycache__
3
+ build
4
+ *.egg-info
5
+ *.pyd
6
+ .pytest_cache/
7
+ .coverage
8
+ htmlcov/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+
12
+ # C build artifacts
13
+ *.so
14
+ *.o
15
+ *.obj
16
+ *.dylib
17
+
18
+ # Data and models
19
+ data
20
+ models
21
+
22
+ # Venvs
23
+ .venv/
24
+ venv/
25
+ env
26
+
27
+ # Event types
28
+ *.csv
29
+ *.h5
30
+ *.raw
31
+ *.bias
32
+ *.dat
33
+ *.txt
34
+ *.tmp_index
35
+ *.svg
36
+ *.data
37
+ *.png
38
+ *.jpg
39
+
40
+ # Profiling
41
+ *.prof
42
+ *.old
43
+
44
+ *.json
45
+
46
+ # Miscellaneous
47
+ test.py
48
+ *.ipynb
49
+
50
+ # IDE and OS
51
+ .vscode
52
+ .idea
53
+ .DS_Store
54
+
55
+
@@ -12,8 +12,6 @@ endif()
12
12
 
13
13
  # --- Sources ----------------------------------------------------------------
14
14
  # Compile every .c under csrc/. CONFIGURE_DEPENDS re-globs when files are
15
- # added/removed so dropping in evt3.c / evt2.c / ... needs no edit here.
16
- # (If you prefer an explicit list for reproducibility, replace this glob.)
17
15
  file(GLOB EVUTILS_SOURCES CONFIGURE_DEPENDS
18
16
  "${CMAKE_CURRENT_SOURCE_DIR}/csrc/*.c")
19
17
 
evutils-0.3.6/PKG-INFO ADDED
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.1
2
+ Name: evutils
3
+ Version: 0.3.6
4
+ Summary: Utilities for event-based vision
5
+ Keywords: events,dvs,neuromorphic,vision,event-based
6
+ Author-Email: Jakub Mandula <jakub.mandula@pbl.ee.ethz.ch>
7
+ License: Copyright (c) 2024 Jakub Mandula
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+ Project-URL: Source Code, https://github.com/mandulaj/evutils
27
+ Project-URL: Documentation, https://mandulaj.github.io/evutils/
28
+ Project-URL: Bug Tracker, https://github.com/mandulaj/evutils/issues
29
+ Project-URL: Homepage, https://mandulaj.github.io/evutils/
30
+ Requires-Python: >=3.10
31
+ Requires-Dist: numpy>=2.0.0
32
+ Requires-Dist: opencv-python>=4.2
33
+ Provides-Extra: pandas
34
+ Requires-Dist: pandas>=2.3.3; extra == "pandas"
35
+ Provides-Extra: numba
36
+ Requires-Dist: numba>=0.57; extra == "numba"
37
+ Provides-Extra: torch
38
+ Requires-Dist: torch>=2.0; extra == "torch"
39
+ Provides-Extra: hdf5
40
+ Requires-Dist: hdf5plugin==6.0.0; extra == "hdf5"
41
+ Requires-Dist: h5py==3.16.0; extra == "hdf5"
42
+ Provides-Extra: vis
43
+ Requires-Dist: matplotlib>=3.1; extra == "vis"
44
+ Requires-Dist: scipy>=1.15.3; extra == "vis"
45
+ Requires-Dist: tqdm>=4.41; extra == "vis"
46
+ Provides-Extra: test
47
+ Requires-Dist: pytest>=9.0.2; extra == "test"
48
+ Requires-Dist: pytest-benchmark>=5.2.3; extra == "test"
49
+ Provides-Extra: compare
50
+ Requires-Dist: expelliarmus>=1.1.0; extra == "compare"
51
+ Requires-Dist: evlib; extra == "compare"
52
+ Provides-Extra: docs
53
+ Requires-Dist: sphinx>=8.0.0; extra == "docs"
54
+ Requires-Dist: sphinx-autoapi>=3.6.1; extra == "docs"
55
+ Requires-Dist: sphinx-autodoc-typehints>=3.0.1; extra == "docs"
56
+ Requires-Dist: sphinx-rtd-theme>=3.1.0; extra == "docs"
57
+ Requires-Dist: sphinx_book_theme>=1.0.0; extra == "docs"
58
+ Requires-Dist: pydata_sphinx_theme>=0.19.0; extra == "docs"
59
+ Requires-Dist: myst-parser>=4.0.0; extra == "docs"
60
+ Provides-Extra: all
61
+ Requires-Dist: evutils[hdf5,numba,pandas,torch,vis]; extra == "all"
62
+ Provides-Extra: dev
63
+ Requires-Dist: evutils[all,docs,test]; extra == "dev"
64
+ Description-Content-Type: text/markdown
65
+
66
+ # <a href="https://mandulaj.github.io/evutils"><img src="https://mandulaj.github.io/evutils/_static/event_hexagon_broken.webp" alt="evutils_logo" width="50" align="top" style="background-color: #fff0;"></a> EV-Utils
67
+ [![PyPI Version](https://img.shields.io/pypi/v/evutils)](https://pypi.org/project/evutils/)
68
+ [![Test](https://github.com/mandulaj/evutils/actions/workflows/test.yaml/badge.svg)](https://github.com/mandulaj/evutils/actions/workflows/test.yaml)
69
+
70
+ ## Overview
71
+ EV-Utils (``evutils``) is a performant collection of utilities for working with event-based vision data. Built with minimal dependencies, it relies on compiled C backed for speed while offering a clean, modular Python interface.
72
+
73
+
74
+
75
+ ### Inspirations & Related Work
76
+ This project draws inspiration from several excellent libraries in the event-based vision ecosystem and attempts to fill in their shortcomings:
77
+
78
+ * [Tonic](https://github.com/neuromorphs/tonic)
79
+ * [event_utils](https://github.com/TimoStoff/event_utils)
80
+ * [evlib](https://github.com/tallamjr/evlib)
81
+ * [expelliarmus](https://github.com/open-neuromorphic/expelliarmus)
82
+ * [openeb](https://github.com/prophesee-ai/openeb)
83
+
84
+
85
+ ## Installation
86
+ We recommend installing `evutils` using `uv`.
87
+ ### From PyPi
88
+ ```bash
89
+ uv add evutils[all]
90
+ ```
91
+
92
+ ### From Git
93
+ ```bash
94
+ git clone --recurse-submodules https://github.com/mandulaj/evutils.git
95
+ cd evutils
96
+
97
+ uv pip install -e ".[dev]"
98
+ ```
99
+
100
+ Note: You can also install specific optional dependency groups like `uv add evutils[torch,hdf5]`.
101
+
102
+ ## Architecture
103
+ The library is divided into several discrete modules. Many can be used independently without installing the full suite of dependencies:
104
+
105
+ ```
106
+ └── augment - Event augmentations
107
+ └── dataset - Wrappers for various dataset loaders
108
+ └── events - Core event handling logic
109
+ └── io - Event reading and writing interfaces
110
+ ├── reader
111
+ └── writer
112
+ └── random - Random event generation and noise injection
113
+ └── torch - PyTorch integration (requires evutils[torch])
114
+ └── types - Standard types for representing Events in NumPy arrays
115
+ └── vis - Visualization methods
116
+ ├── histogram
117
+ └── reconstructor
118
+ ```
119
+
120
+ ### Quick API overview
121
+
122
+ <!-- ### `augment`
123
+
124
+ Event augmentations
125
+
126
+ ### `dataset`
127
+
128
+ Wrappers for various dataset loaders -->
129
+
130
+ #### `io`: Reading and Writing Events
131
+
132
+ The `io` module provides methods for reading and writing events into various event formats. It provides a simple `.read()` and `.write()` interface as well as more advanced interfaces using iterators and slicing.
133
+
134
+ ```python
135
+ from evutils.io import EventReader
136
+
137
+
138
+ ev_file = EventReader("raw_file.raw", delta_t=10e3)
139
+
140
+ events = ev_file.read()
141
+
142
+ ```
143
+
144
+ #### `utils`
145
+
146
+ Various utility functions
147
+
148
+ #### `random`
149
+
150
+ Generating random events and adding noise to event recordings
151
+
152
+ #### `types`
153
+
154
+ This provides several standard types for representing Events in numpy arrays
155
+
156
+
157
+ #### `vis`
158
+
159
+ The `vis` moduels provides several methods for visualizing the events (for example as histograms), but also provides a streamlined interface for more complex visualization techneques, such as using the [E2Vid](https://github.com/uzh-rpg/rpg_e2vid) reconstructor.
160
+
161
+
162
+ ```python
163
+ from evutils.vis.reconstructor import RPG_Reconstructor
164
+
165
+ reconstructor = RPG_Reconstructor(1280, 720)
166
+
167
+ img = reconstructor.gen_frame(events)
168
+
169
+ ```
170
+
171
+ ## Running tests
172
+
173
+ Tests are managed via `pytest`. If you installed the package with the `[dev]` or `[test]` flag, you can run them via:
174
+ ```bash
175
+ uv run pytest -s
176
+ ```
177
+
178
+
179
+ ## [Benchmarks](benchmarks/README.md)
180
+
181
+ Read/write throughput benchmarks (using [pytest-benchmark](https://pytest-benchmark.readthedocs.io)) live in `benchmarks/` and are kept out of the normal test run. Run them explicitly:
182
+
183
+ ```bash
184
+ uv run pytest benchmarks/ # evutils only
185
+ uv run pytest benchmarks/ --benchmark-group-by=param:fmt # compare libraries per format
186
+ ```
187
+
188
+ The benchmarks download a real Prophesee recording on first use. Optional cross-library comparisons run automatically once the libraries are installed (`uv pip install -e ".[compare]"`); OpenEB/Metavision is compared via the Docker image in `benchmarks/docker/`. See [`benchmarks/README.md`](benchmarks/README.md) for details.
189
+
190
+ Decode/encode throughput on a 12th Gen Intel Core i7-1280P (millions of events per second, higher is better):
191
+
192
+ **Read** (full-file decode)
193
+
194
+ | Format | evutils | expelliarmus | evlib |
195
+ | ------ | ------: | -----------: | ----: |
196
+ | EVT2 | 91 | 105 | 5 |
197
+ | EVT2.1 | 72 | – | – |
198
+ | EVT3 | 53 | 41 | 5 |
199
+
200
+ **Write** (evutils; expelliarmus/evlib are read-only for these formats)
201
+
202
+ | Format | evutils |
203
+ | ------ | ------: |
204
+ | EVT2 | 146 |
205
+ | EVT2.1 | 110 |
206
+ | EVT3 | 74 |
207
+
208
+ (`–` = format not supported by that library.)
209
+
210
+
211
+ ## Acknowledgements
212
+
213
+ Thanks to all the contributors for supporting this project:
214
+
215
+ * Elia Franc
216
+ * Jakub Mandula
217
+
218
+
219
+ ## Cite
220
+ ```bibtex
221
+ @PhDThesis{2024mandula_evutils,
222
+ author = {Jakub Mandula},
223
+ title = {EV-Utils: collection of utilities for working with event-based vision data},
224
+ school = {Dept. of Information Technology and Electrical Engineering, ETH Zurich},
225
+ year = 2024
226
+ }
227
+ ```
@@ -0,0 +1,162 @@
1
+ # <a href="https://mandulaj.github.io/evutils"><img src="https://mandulaj.github.io/evutils/_static/event_hexagon_broken.webp" alt="evutils_logo" width="50" align="top" style="background-color: #fff0;"></a> EV-Utils
2
+ [![PyPI Version](https://img.shields.io/pypi/v/evutils)](https://pypi.org/project/evutils/)
3
+ [![Test](https://github.com/mandulaj/evutils/actions/workflows/test.yaml/badge.svg)](https://github.com/mandulaj/evutils/actions/workflows/test.yaml)
4
+
5
+ ## Overview
6
+ EV-Utils (``evutils``) is a performant collection of utilities for working with event-based vision data. Built with minimal dependencies, it relies on compiled C backed for speed while offering a clean, modular Python interface.
7
+
8
+
9
+
10
+ ### Inspirations & Related Work
11
+ This project draws inspiration from several excellent libraries in the event-based vision ecosystem and attempts to fill in their shortcomings:
12
+
13
+ * [Tonic](https://github.com/neuromorphs/tonic)
14
+ * [event_utils](https://github.com/TimoStoff/event_utils)
15
+ * [evlib](https://github.com/tallamjr/evlib)
16
+ * [expelliarmus](https://github.com/open-neuromorphic/expelliarmus)
17
+ * [openeb](https://github.com/prophesee-ai/openeb)
18
+
19
+
20
+ ## Installation
21
+ We recommend installing `evutils` using `uv`.
22
+ ### From PyPi
23
+ ```bash
24
+ uv add evutils[all]
25
+ ```
26
+
27
+ ### From Git
28
+ ```bash
29
+ git clone --recurse-submodules https://github.com/mandulaj/evutils.git
30
+ cd evutils
31
+
32
+ uv pip install -e ".[dev]"
33
+ ```
34
+
35
+ Note: You can also install specific optional dependency groups like `uv add evutils[torch,hdf5]`.
36
+
37
+ ## Architecture
38
+ The library is divided into several discrete modules. Many can be used independently without installing the full suite of dependencies:
39
+
40
+ ```
41
+ └── augment - Event augmentations
42
+ └── dataset - Wrappers for various dataset loaders
43
+ └── events - Core event handling logic
44
+ └── io - Event reading and writing interfaces
45
+ ├── reader
46
+ └── writer
47
+ └── random - Random event generation and noise injection
48
+ └── torch - PyTorch integration (requires evutils[torch])
49
+ └── types - Standard types for representing Events in NumPy arrays
50
+ └── vis - Visualization methods
51
+ ├── histogram
52
+ └── reconstructor
53
+ ```
54
+
55
+ ### Quick API overview
56
+
57
+ <!-- ### `augment`
58
+
59
+ Event augmentations
60
+
61
+ ### `dataset`
62
+
63
+ Wrappers for various dataset loaders -->
64
+
65
+ #### `io`: Reading and Writing Events
66
+
67
+ The `io` module provides methods for reading and writing events into various event formats. It provides a simple `.read()` and `.write()` interface as well as more advanced interfaces using iterators and slicing.
68
+
69
+ ```python
70
+ from evutils.io import EventReader
71
+
72
+
73
+ ev_file = EventReader("raw_file.raw", delta_t=10e3)
74
+
75
+ events = ev_file.read()
76
+
77
+ ```
78
+
79
+ #### `utils`
80
+
81
+ Various utility functions
82
+
83
+ #### `random`
84
+
85
+ Generating random events and adding noise to event recordings
86
+
87
+ #### `types`
88
+
89
+ This provides several standard types for representing Events in numpy arrays
90
+
91
+
92
+ #### `vis`
93
+
94
+ The `vis` moduels provides several methods for visualizing the events (for example as histograms), but also provides a streamlined interface for more complex visualization techneques, such as using the [E2Vid](https://github.com/uzh-rpg/rpg_e2vid) reconstructor.
95
+
96
+
97
+ ```python
98
+ from evutils.vis.reconstructor import RPG_Reconstructor
99
+
100
+ reconstructor = RPG_Reconstructor(1280, 720)
101
+
102
+ img = reconstructor.gen_frame(events)
103
+
104
+ ```
105
+
106
+ ## Running tests
107
+
108
+ Tests are managed via `pytest`. If you installed the package with the `[dev]` or `[test]` flag, you can run them via:
109
+ ```bash
110
+ uv run pytest -s
111
+ ```
112
+
113
+
114
+ ## [Benchmarks](benchmarks/README.md)
115
+
116
+ Read/write throughput benchmarks (using [pytest-benchmark](https://pytest-benchmark.readthedocs.io)) live in `benchmarks/` and are kept out of the normal test run. Run them explicitly:
117
+
118
+ ```bash
119
+ uv run pytest benchmarks/ # evutils only
120
+ uv run pytest benchmarks/ --benchmark-group-by=param:fmt # compare libraries per format
121
+ ```
122
+
123
+ The benchmarks download a real Prophesee recording on first use. Optional cross-library comparisons run automatically once the libraries are installed (`uv pip install -e ".[compare]"`); OpenEB/Metavision is compared via the Docker image in `benchmarks/docker/`. See [`benchmarks/README.md`](benchmarks/README.md) for details.
124
+
125
+ Decode/encode throughput on a 12th Gen Intel Core i7-1280P (millions of events per second, higher is better):
126
+
127
+ **Read** (full-file decode)
128
+
129
+ | Format | evutils | expelliarmus | evlib |
130
+ | ------ | ------: | -----------: | ----: |
131
+ | EVT2 | 91 | 105 | 5 |
132
+ | EVT2.1 | 72 | – | – |
133
+ | EVT3 | 53 | 41 | 5 |
134
+
135
+ **Write** (evutils; expelliarmus/evlib are read-only for these formats)
136
+
137
+ | Format | evutils |
138
+ | ------ | ------: |
139
+ | EVT2 | 146 |
140
+ | EVT2.1 | 110 |
141
+ | EVT3 | 74 |
142
+
143
+ (`–` = format not supported by that library.)
144
+
145
+
146
+ ## Acknowledgements
147
+
148
+ Thanks to all the contributors for supporting this project:
149
+
150
+ * Elia Franc
151
+ * Jakub Mandula
152
+
153
+
154
+ ## Cite
155
+ ```bibtex
156
+ @PhDThesis{2024mandula_evutils,
157
+ author = {Jakub Mandula},
158
+ title = {EV-Utils: collection of utilities for working with event-based vision data},
159
+ school = {Dept. of Information Technology and Electrical Engineering, ETH Zurich},
160
+ year = 2024
161
+ }
162
+ ```
@@ -0,0 +1,102 @@
1
+ # Benchmarks
2
+
3
+ Read/write throughput benchmarks for the native EVT2 / EVT2.1 / EVT3 codecs,
4
+ plus optional comparisons against other event libraries.
5
+
6
+ They are **not** part of the normal test run (`testpaths = ["tests"]`); run them
7
+ explicitly:
8
+
9
+ ```bash
10
+ pytest benchmarks/ # evutils only (+ any installed compare libs)
11
+ pytest benchmarks/test_read.py # just reads
12
+ pytest benchmarks/test_write.py # just writes
13
+ ```
14
+
15
+ Fixtures (`test_events`, `real_event_files`) are shared with the test suite from
16
+ the repo-root `conftest.py`. `real_event_files` downloads the reference
17
+ recordings to the pytest cache on first use.
18
+
19
+ ## Files
20
+
21
+ | file | what it benchmarks |
22
+ |------|--------------------|
23
+ | `test_read.py` | evutils decode throughput (evt2/evt21/evt3), asserts count vs reference |
24
+ | `test_write.py` | evutils encode throughput (payload = first 5M events of the real evt3 file) |
25
+ | `test_compare.py` | third-party readers from `readers.py` (auto-skip if not installed) |
26
+ | `readers.py` | adapter registry — one entry per external library |
27
+
28
+ ## Comparing against other libraries
29
+
30
+ Install the optional readers and run with grouping so every library lines up per
31
+ format:
32
+
33
+ ```bash
34
+ pip install evutils[compare] # expelliarmus, evlib
35
+ pytest benchmarks/ --benchmark-group-by=param:fmt --benchmark-columns=mean,ops
36
+ ```
37
+
38
+ Each library reads inside a lazy import, so an uninstalled (or broken) library
39
+ just **skips**. To add another library, append a `Reader(...)` to `readers.py`.
40
+
41
+ > tonic is intentionally not included: it has no standalone EVT reader and reads
42
+ > Prophesee data through `expelliarmus` internally, so it would just re-measure
43
+ > expelliarmus (already benchmarked).
44
+
45
+ ## OpenEB / Metavision (via Docker)
46
+
47
+ OpenEB isn't on PyPI and is painful to build locally, so there's an image that
48
+ builds it once. Both commands run **from the repo root** (the build context must
49
+ be the whole project so evutils is copied in):
50
+
51
+ ```bash
52
+ # Build the image (compiles OpenEB from source + installs evutils; slow, one-time)
53
+ docker build -t evutils-openeb -f benchmarks/docker/Dockerfile.openeb .
54
+
55
+ # Run the full suite (evutils + OpenEB), grouped per format
56
+ docker run --rm evutils-openeb
57
+ ```
58
+
59
+ The container's default command is
60
+ `pytest benchmarks/ --benchmark-group-by=param:fmt`, so you get evutils and
61
+ OpenEB side by side per format.
62
+
63
+ ### Useful variations
64
+
65
+ Persist the downloaded recording across runs (otherwise `--rm` discards the
66
+ pytest cache and it re-downloads every time):
67
+
68
+ ```bash
69
+ docker run --rm -v evutils-cache:/work/.pytest_cache evutils-openeb
70
+ ```
71
+
72
+ Run only the OpenEB comparison (skip the evutils rows):
73
+
74
+ ```bash
75
+ docker run --rm evutils-openeb \
76
+ pytest benchmarks/test_compare.py --benchmark-group-by=param:fmt -q
77
+ ```
78
+
79
+ Drop into a shell to debug the build/run:
80
+
81
+ ```bash
82
+ docker run --rm -it evutils-openeb bash
83
+ ```
84
+
85
+ Build a different OpenEB release if the default fails to build:
86
+
87
+ ```bash
88
+ docker build -t evutils-openeb --build-arg OPENEB_VERSION=5.0.0 \
89
+ -f benchmarks/docker/Dockerfile.openeb .
90
+ ```
91
+
92
+ ### Caveats
93
+
94
+ - The image targets **OpenEB 5.x on Ubuntu 22.04**; OpenEB's apt dependencies
95
+ and install layout drift between releases, so the `apt-get`/`PYTHONPATH` lines
96
+ may need tweaking. The Dockerfile imports `metavision_core` at build time, so a
97
+ broken OpenEB install fails during `docker build` rather than silently skipping
98
+ at run time.
99
+ - The first pass is slow: it compiles OpenEB (`-j$(nproc)`) and downloads the
100
+ reference recording on first run.
101
+ - A repo-root `.dockerignore` keeps the build context small (excludes `.venv`,
102
+ `build/`, `.git`, `data/`, `*.raw`, ...).