Skip to main content

tonic PyPI codecov Documentation Status contributors Binder DOI Discord

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.

Install

For users

pip install tonic

or (thanks to @Tobias-Fischer)

conda install -c conda-forge tonic

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

pip install tonic --pre

For developers

We recommend using uv for development:

# 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
macOS (ARM64) 3.10, 3.11, 3.12
Windows 3.10, 3.11, 3.12

Quickstart

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

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 or alternatively here on GitHub via the Discussions page!

Contributing

Please check out the contributions page for details.

Sponsoring

The development of this library is supported by

SynSense

Citation

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

@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}
}

Metadata

Release files for tonic 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tonic 1.7.0
File Size Uploaded
tonic-1.7.0.tar.gz 294.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tonic 1.7.0
File Interpreter ABI Platform
tonic-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 404.5 kB

Release files / tonic-1.7.0.tar.gz

Download URL tonic-1.7.0.tar.gz
Size 294.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca4631f4f0d29890759e0d12fda424950b80214eabac8b7f3686c81ef1320ecf
BLAKE2b-256 checksum
How to use checksums
b7f19d17b4124283e916bf0b9f6e2b04a01c12bb4b8360664a89e1ed2adb4704
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / tonic-1.7.0-py3-none-any.whl

Download URL tonic-1.7.0-py3-none-any.whl
Size 109.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b65d37f7222bb6195b96a936d03ef148ba8be7c6eea54d041e6520e5e8ab8e79
BLAKE2b-256 checksum
How to use checksums
6e6a62cd8c1d26c8204559baa057c0f2a7a1a72c7b06c06b00b8f6a39bda9bb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.4

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page