Metadata-Version: 2.1
Name: evutils
Version: 0.3.11
Summary: Utilities for event-based vision
Keywords: events,dvs,neuromorphic,vision,event-based
Author-Email: Jakub Mandula <jakub.mandula@pbl.ee.ethz.ch>
License: Copyright (c) 2024 Jakub Mandula
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Project-URL: Source Code, https://github.com/mandulaj/evutils
Project-URL: Documentation, https://mandulaj.github.io/evutils/
Project-URL: Bug Tracker, https://github.com/mandulaj/evutils/issues
Project-URL: Homepage, https://mandulaj.github.io/evutils/
Requires-Python: >=3.10
Requires-Dist: numpy>=2.0.0
Requires-Dist: opencv-python>=4.2
Requires-Dist: numba>=0.57
Provides-Extra: pandas
Requires-Dist: pandas>=2.3.3; extra == "pandas"
Provides-Extra: torch
Requires-Dist: torch>=2.0; extra == "torch"
Provides-Extra: hdf5
Requires-Dist: hdf5plugin==6.0.0; extra == "hdf5"
Requires-Dist: h5py>=3.16.0; extra == "hdf5"
Provides-Extra: vis
Requires-Dist: matplotlib>=3.1; extra == "vis"
Requires-Dist: open3d>=0.19.0; python_version < "3.13" and extra == "vis"
Requires-Dist: scipy>=1.15.3; extra == "vis"
Requires-Dist: tqdm>=4.41; extra == "vis"
Provides-Extra: test
Requires-Dist: pytest>=9.0.2; extra == "test"
Requires-Dist: pytest-benchmark>=5.2.3; extra == "test"
Provides-Extra: compare
Requires-Dist: expelliarmus>=1.1.0; extra == "compare"
Requires-Dist: evlib>=0.12.0; python_version >= "3.11" and extra == "compare"
Requires-Dist: evlib>=0.8.0; python_version < "3.11" and extra == "compare"
Provides-Extra: docs
Requires-Dist: sphinx>=8.0.0; extra == "docs"
Requires-Dist: sphinx-autoapi>=3.6.1; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints>=3.0.1; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=3.1.0; extra == "docs"
Requires-Dist: sphinx_book_theme>=1.0.0; extra == "docs"
Requires-Dist: pydata_sphinx_theme>=0.19.0; extra == "docs"
Requires-Dist: myst-parser>=4.0.0; extra == "docs"
Provides-Extra: all
Requires-Dist: evutils[hdf5,pandas,torch,vis]; extra == "all"
Provides-Extra: dev
Requires-Dist: evutils[all,docs,test]; extra == "dev"
Description-Content-Type: text/markdown

# <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
[![PyPI Version](https://img.shields.io/pypi/v/evutils)](https://pypi.org/project/evutils/)
[![Test](https://github.com/mandulaj/evutils/actions/workflows/test.yaml/badge.svg)](https://github.com/mandulaj/evutils/actions/workflows/test.yaml)

## Overview
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.



### Inspirations & Related Work 
This project draws inspiration from several excellent libraries in the event-based vision ecosystem and attempts to fill in their shortcomings:

* [Tonic](https://github.com/neuromorphs/tonic)
* [event_utils](https://github.com/TimoStoff/event_utils)
* [evlib](https://github.com/tallamjr/evlib)
* [expelliarmus](https://github.com/open-neuromorphic/expelliarmus)
* [openeb](https://github.com/prophesee-ai/openeb)


## Installation
We recommend installing `evutils` using `uv`. 
### From PyPi
```bash
uv add evutils # Basic library
uv add evutils[all] # All groups (pandas, numba, torch, hdf5, etc..)
uv add evutils[dev] # Dev group
```

### From Git
```bash
git clone --recurse-submodules https://github.com/mandulaj/evutils.git
cd evutils

uv pip install -e ".[dev]"
```

Note: You can also install specific optional dependency groups like `uv add evutils[torch,hdf5]`.

## Architecture
The library is divided into several discrete modules. Many can be used independently without installing the full suite of dependencies:

```
└── augment     - Event augmentations
└── dataset     - Wrappers for various dataset loaders
└── events      - Core event handling logic
└── io          - Event reading and writing interfaces
    ├── reader 
    └── writer
└── random      - Random event generation and noise injection
└── torch       - PyTorch integration (requires evutils[torch])
└── types       - Standard types for representing Events in NumPy arrays
└── vis         - Visualization methods
    ├── histogram
    └── reconstructor
```

### Quick API overview 

<!-- ### `augment`

Event augmentations

### `dataset`

Wrappers for various dataset loaders -->

#### `io`: Reading and Writing Events

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.

```python
from evutils.io import EventReader


ev_file = EventReader("raw_file.raw", delta_t=10e3)

events = ev_file.read()

```

#### `utils`

Various utility functions

#### `random`

Generating random events and adding noise to event recordings

#### `types`

This provides several standard types for representing Events in numpy arrays


#### `vis`

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.


```python
from evutils.vis.reconstructor import RPG_Reconstructor

reconstructor = RPG_Reconstructor(1280, 720)

img = reconstructor.gen_frame(events)

```

## Running tests

Tests are managed via `pytest`. If you installed the package with the `[dev]` or `[test]` flag, you can run them via:
```bash
uv run pytest -s
```


## [Benchmarks](benchmarks/README.md)

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:

```bash
uv run pytest benchmarks/                                   # evutils only
uv run pytest benchmarks/ --benchmark-group-by=param:fmt    # compare libraries per format
```

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.


## Acknowledgements

Thanks to all the contributors for supporting this project:

* Elia Franc
* Jakub Mandula


## Cite
```bibtex
@PhDThesis{2024mandula_evutils,
  author        = {Jakub Mandula},
  title         = {EV-Utils: collection of utilities for working with event-based vision data},
  school        = {Dept. of Information Technology and Electrical Engineering, ETH Zurich},
  year          = 2024
}
```