Metadata-Version: 2.4
Name: tonic
Version: 1.7.0
Summary: Neuromorphic datasets and transformations
Author-email: The Neuromorphs of Telluride <mail@lenzgregor.com>
Maintainer-email: The Neuromorphs of Telluride <mail@lenzgregor.com>
License: GPL-3.0-only
Project-URL: Source Code, https://github.com/neuromorphs/tonic
Project-URL: Documentation, https://tonic.readthedocs.org
Project-URL: Bug Tracker, https://github.com/neuromorphs/tonic/issues
Project-URL: Homepage, https://github.com/neuromorphs/tonic
Keywords: neuromorphic,datasets,spiking-neural-networks,event-camera
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy>=1.24
Requires-Dist: h5py>=3.8
Requires-Dist: importRosbag>=1.0.4
Requires-Dist: scipy>=1.10
Requires-Dist: tqdm>=4.65
Requires-Dist: typing-extensions>=4.5
Requires-Dist: librosa>=0.10
Requires-Dist: expelliarmus>=1.0
Provides-Extra: test
Requires-Dist: pytest>=7.4; extra == "test"
Requires-Dist: coverage>=7.3; extra == "test"
Requires-Dist: matplotlib>=3.7; extra == "test"
Requires-Dist: hdf5plugin>=4.1; extra == "test"
Requires-Dist: imageio>=2.31; extra == "test"
Requires-Dist: pypng>=0.20220715.0; extra == "test"
Requires-Dist: aedat>=1.0; extra == "test"
Provides-Extra: torch
Requires-Dist: torch>=2.4.1; extra == "torch"
Requires-Dist: torchvision>=0.19.1; extra == "torch"
Requires-Dist: torchaudio>=2.4.1; extra == "torch"
Provides-Extra: docs
Requires-Dist: astroid<4.0,>=3.0; extra == "docs"
Requires-Dist: sphinx<8.0,>=6.1; extra == "docs"
Requires-Dist: sphinx-book-theme; extra == "docs"
Requires-Dist: sphinx-gallery; extra == "docs"
Requires-Dist: myst_nb; extra == "docs"
Requires-Dist: ipywidgets; extra == "docs"
Requires-Dist: matplotlib; extra == "docs"
Requires-Dist: sphinx-autoapi<3.6,>=3.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: tonic[docs,test,torch]; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.9; extra == "dev"
Dynamic: license-file

![tonic](tonic-logo-padded.png)
[![PyPI](https://img.shields.io/pypi/v/tonic)](https://pypi.org/project/tonic/)
[![codecov](https://codecov.io/gh/neuromorphs/tonic/branch/develop/graph/badge.svg?token=Q0BMYGUSZQ)](https://codecov.io/gh/neuromorphs/tonic)
[![Documentation Status](https://readthedocs.org/projects/tonic/badge/?version=latest)](https://tonic.readthedocs.io/en/latest/?badge=latest)
[![contributors](https://img.shields.io/github/contributors-anon/neuromorphs/tonic)](https://github.com/neuromorphs/tonic/pulse)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/neuromorphs/tonic/main?labpath=docs%2Ftutorials)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5079802.svg)](https://doi.org/10.5281/zenodo.5079802)
[![Discord](https://img.shields.io/discord/1044548629622439977)](https://discord.gg/YSU9DGp4F2)

**This project is looking for a new maintainer. Reach out to Gregor if you're
interested!**

**Tonic** is a tool to facilitate the download, manipulation and loading of
event-based/spike-based data. It's like PyTorch Vision but for neuromorphic
data!

## Documentation

You can find the full documentation on Tonic [on this site](https://tonic.readthedocs.io/en/latest/index.html).

- [A first example](https://tonic.readthedocs.io/en/latest/getting_started/nmnist.html) to get a feeling for how Tonic works.
- [Run tutorials in your browser](https://mybinder.org/v2/gh/neuromorphs/tonic/main?labpath=docs%2Ftutorials) quick and easy.
- [List of datasets](https://tonic.readthedocs.io/en/main/datasets.html).
- [List of transformations](https://tonic.readthedocs.io/en/main/auto_examples/index.html).
- [About](https://tonic.readthedocs.io/en/latest/about/info.html) this project.
- [Release notes](https://tonic.readthedocs.io/en/latest/about/release_notes.html) on version changes.

## Install

### For users

```bash
pip install tonic
```

or (thanks to [@Tobias-Fischer](https://github.com/Tobias-Fischer))

```bash
conda install -c conda-forge tonic
```

For the latest pre-release on the develop branch that passed the tests:

```bash
pip install tonic --pre
```

### For developers

We recommend using [uv](https://docs.astral.sh/uv/) for development:

```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone the repository
git clone https://github.com/neuromorphs/tonic.git
cd tonic

# Install dependencies and tonic in editable mode
uv sync --extra dev

# Run tests
uv run pytest test/
```

This package has been tested on:

| Platform          | Python Versions  | Status                                                                                                                                      |
| ----------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Linux**         | 3.10, 3.11, 3.12 | [![](http://github-actions.40ants.com/neuromorphs/tonic/matrix.svg?only=ci.multitest.ubuntu-latest)](https://github.com/neuromorphs/tonic)  |
| **macOS (ARM64)** | 3.10, 3.11, 3.12 | [![](http://github-actions.40ants.com/neuromorphs/tonic/matrix.svg?only=ci.multitest.macos-latest)](https://github.com/neuromorphs/tonic)   |
| **Windows**       | 3.10, 3.11, 3.12 | [![](http://github-actions.40ants.com/neuromorphs/tonic/matrix.svg?only=ci.multitest.windows-latest)](https://github.com/neuromorphs/tonic) |

## Quickstart

If you're looking for a minimal example to run, this is it!

```python
import tonic
import tonic.transforms as transforms

sensor_size = tonic.datasets.NMNIST.sensor_size
transform = transforms.Compose(
    [
        transforms.Denoise(filter_time=10000),
        transforms.ToFrame(sensor_size=sensor_size, time_window=3000),
    ]
)

testset = tonic.datasets.NMNIST(save_to="./data", train=False, transform=transform)

from torch.utils.data import DataLoader

testloader = DataLoader(
    testset,
    batch_size=10,
    collate_fn=tonic.collation.PadTensors(batch_first=True),
)

frames, targets = next(iter(testloader))
```

## Discussion and questions

Have a question about how something works? Ideas for improvement? Feature request? Please get in touch on the #tonic [Discord channel](https://discord.gg/V6FHBZURkg)
or alternatively here on GitHub via the [Discussions](https://github.com/neuromorphs/tonic/discussions) page!

## Contributing

Please check out the [contributions](https://tonic.readthedocs.io/en/latest/about/contribute.html) page for details.

## Sponsoring

The development of this library is supported by

<tr><td><a href="https://synsense.ai"><img src="https://www.synsense.ai/wp-content/uploads/2022/03/logo-synsense-blue.svg" alt="SynSense" width="200px"/></a></td><td>

## Citation

If you find this package helpful, please consider citing it:

```BibTex
@software{lenz_gregor_2021_5079802,
  author       = {Lenz, Gregor and
                  Chaney, Kenneth and
                  Shrestha, Sumit Bam and
                  Oubari, Omar and
                  Picaud, Serge and
                  Zarrella, Guido},
  title        = {Tonic: event-based datasets and transformations.},
  month        = jul,
  year         = 2021,
  note         = {{Documentation available under https://tonic.readthedocs.io}},
  publisher    = {Zenodo},
  version      = {0.4.0},
  doi          = {10.5281/zenodo.5079802},
  url          = {https://doi.org/10.5281/zenodo.5079802}
}
```
