tonic 1.4.4.dev42__tar.gz → 1.4.4.dev44__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.
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/ChangeLog +2 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/PKG-INFO +1 -1
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/to_frame.py +21 -15
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/slicers.py +28 -5
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/transforms.py +32 -8
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/PKG-INFO +1 -1
- tonic-1.4.4.dev44/tonic.egg-info/pbr.json +1 -0
- tonic-1.4.4.dev42/tonic.egg-info/pbr.json +0 -1
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/.binder/requirements.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/.coveragerc +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/.github/workflows/ci-pipeline.yml +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/.pre-commit-config.yaml +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/.readthedocs.yml +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/AUTHORS +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/LICENSE.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/MANIFEST.in +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/README.md +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/Makefile +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/event-cameras/eventstream.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/event-cameras/framestream.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/event-cameras/receptive-fields.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/event-cameras/sampling-theorems.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/snn/neuron-models.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/snn/surrogates.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/tonic-logo-black-bg.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/tonic-logo-black.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/tonic-logo-white.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_static/tonic_favicon.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_templates/class_dataset.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/_templates/class_transform.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/about/about.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/about/info.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/about/prototype.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/about/release_notes.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/conf.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/datasets.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/README.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/README.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/plot_tobinarep.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/plot_toframe.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/plot_toimage.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/plot_totimesurface.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/representations/plot_tovoxelgrid.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/README.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_centercrop.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_crop_time.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_decimation.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_denoise.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_downsample.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_event.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_event_by_area.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_event_by_time.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_pixel.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_event_downsampling.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_merge_polarities.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_random_crop.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_random_flip_lr.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_random_flip_ud.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_random_time_reversal.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_refractory_period.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_spatial_jitter.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_time_jitter.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_uniform_noise.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_involved/communication_channels.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_involved/contribute.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_involved/getting_involved.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_started/getting_started.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_started/install.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/getting_started/nmnist.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/how-tos/how-tos.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/how-tos/loading-raw-events.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/how-tos/visualizing-data.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/how-tos/wrapping_own_data.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/index.md +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/make.bat +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/reading_material/design_choices.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/reading_material/intro-event-cameras.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/reading_material/intro-snns.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/reading_material/reading_material.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/reading_material/training-snns.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/requirements.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/transformations.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/Aug_DiskCachDataset.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/audio_transforms_tutorial.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/batching.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/davis_data.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/fast_dataloading.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/large_datasets.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/slicing.ipynb +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/tutorials/tutorials.rst +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/requirements.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/setup.cfg +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/setup.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/dataset_utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/prototype_dataset_utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/requirements.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_audio_augmentations.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_audio_transforms.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_aug_caching.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_caching.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_chained_transforms.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_data/sample.aedat4 +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_data/sample_aedat_header.aedat +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_data/sample_ncars.dat +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_data/sample_nmnist.bin +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_data/sample_stmnist.mat +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_datasets.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_dsec.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_io.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_prototype_datasets.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_representations.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_sliced_dataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_slicers.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_tonic_utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/test_transforms.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/torch_requirements.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/test/utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/audio_augmentations.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/audio_transforms.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/cached_dataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/collation.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/dataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/asl_dvs.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/cifar10dvs.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/davisdataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/dsec.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/dvs_lips.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/dvsgesture.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/ebssa.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/hsd.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/mvsec.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/ncaltech101.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/nmnist.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/pokerdvs.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/s_mnist.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/threeET_eyetracking.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/tum_vie.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/datasets/visual_place_recognition.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/download_utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/crop.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/decimate.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/denoise.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/drop_event.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/drop_pixel.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/event_downsampling.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/refractory_period.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/spatial_jitter.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/time_jitter.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/time_skew.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/to_averaged_timesurface.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/to_bina_rep.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/to_timesurface.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/to_voxel_grid.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/functional/uniform_noise.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/io.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/README.md +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/ncars.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/nmnist.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/prophesee.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/stmnist.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/utils/__init__.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/utils/_dataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/datasets/utils/_utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/prototype/slicers.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/sliced_dataset.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic/utils.py +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic-logo-padded.png +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/SOURCES.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/dependency_links.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/not-zip-safe +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/requires.txt +0 -0
- {tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/tonic.egg-info/top_level.txt +0 -0
|
@@ -9,14 +9,16 @@ from tonic.slicers import (
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def to_frame_numpy(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
events,
|
|
13
|
+
sensor_size,
|
|
14
|
+
time_window=None,
|
|
15
|
+
event_count=None,
|
|
16
|
+
n_time_bins=None,
|
|
17
|
+
n_event_bins=None,
|
|
18
|
+
overlap=0.0,
|
|
19
|
+
include_incomplete=False,
|
|
20
|
+
start_time=None,
|
|
21
|
+
end_time=None,
|
|
20
22
|
):
|
|
21
23
|
"""Accumulate events to frames by slicing along constant time (time_window), constant number of
|
|
22
24
|
events (event_count) or constant number of frames (n_time_bins / n_event_bins).
|
|
@@ -37,11 +39,11 @@ def to_frame_numpy(
|
|
|
37
39
|
assert "x" and "t" and "p" in events.dtype.names
|
|
38
40
|
|
|
39
41
|
if (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
not sum(
|
|
43
|
+
param is not None
|
|
44
|
+
for param in [time_window, event_count, n_time_bins, n_event_bins]
|
|
45
|
+
)
|
|
46
|
+
== 1
|
|
45
47
|
):
|
|
46
48
|
raise ValueError(
|
|
47
49
|
"Please assign a value to exactly one of the parameters time_window,"
|
|
@@ -67,7 +69,12 @@ def to_frame_numpy(
|
|
|
67
69
|
|
|
68
70
|
if time_window:
|
|
69
71
|
event_slices = slice_events_by_time(
|
|
70
|
-
events,
|
|
72
|
+
events,
|
|
73
|
+
time_window,
|
|
74
|
+
overlap=overlap,
|
|
75
|
+
include_incomplete=include_incomplete,
|
|
76
|
+
start_time=start_time,
|
|
77
|
+
end_time=end_time,
|
|
71
78
|
)
|
|
72
79
|
elif event_count:
|
|
73
80
|
event_slices = slice_events_by_count(
|
|
@@ -93,4 +100,3 @@ def to_frame_numpy(
|
|
|
93
100
|
for i, event_slice in enumerate(event_slices):
|
|
94
101
|
np.add.at(frames, (i, event_slice["p"].astype(int), event_slice["x"]), 1)
|
|
95
102
|
return frames
|
|
96
|
-
|
|
@@ -66,15 +66,28 @@ class SliceByTime:
|
|
|
66
66
|
time_window (int): time for window length (same unit as event timestamps)
|
|
67
67
|
overlap (int): overlap (same unit as event timestamps)
|
|
68
68
|
include_incomplete (bool): include the last incomplete slice that has shorter time
|
|
69
|
+
start_time (int): optional start time that is used for slicing, otherwise the first event time is used
|
|
70
|
+
end_time (int): optional end time that is used for slicing, otherwise the last event time is used
|
|
71
|
+
reset_time (bool): subtract the time_window from each slice. For example, if you have 4 events with
|
|
72
|
+
timestamps [0, 150, 299, 300], a time_window of 100, and reset_time as True, you will
|
|
73
|
+
get back 4 slices with timestamps [0], [50], [99], [0]. This is useful when you use
|
|
74
|
+
start_time / end_time arguments for the ToFrame transform.
|
|
69
75
|
"""
|
|
70
76
|
|
|
71
77
|
time_window: float
|
|
72
78
|
overlap: float = 0.0
|
|
73
79
|
include_incomplete: bool = False
|
|
80
|
+
start_time: float = None
|
|
81
|
+
end_time: float = None
|
|
82
|
+
reset_time: bool = False
|
|
74
83
|
|
|
75
84
|
def slice(self, data: np.ndarray, targets: int) -> List[np.ndarray]:
|
|
76
85
|
metadata = self.get_slice_metadata(data, targets)
|
|
77
|
-
|
|
86
|
+
slices, targets = self.slice_with_metadata(data, targets, metadata)
|
|
87
|
+
if self.reset_time:
|
|
88
|
+
for i, slice in enumerate(slices):
|
|
89
|
+
slice["t"] = slice["t"] - i * self.time_window
|
|
90
|
+
return slices, targets
|
|
78
91
|
|
|
79
92
|
def get_slice_metadata(
|
|
80
93
|
self, data: np.ndarray, targets: int
|
|
@@ -83,13 +96,17 @@ class SliceByTime:
|
|
|
83
96
|
stride = self.time_window - self.overlap
|
|
84
97
|
assert stride > 0
|
|
85
98
|
|
|
99
|
+
start_time = t[0] if self.start_time is None else self.start_time
|
|
100
|
+
end_time = t[-1] if self.end_time is None else self.end_time
|
|
101
|
+
duration = end_time - start_time
|
|
102
|
+
|
|
86
103
|
if self.include_incomplete:
|
|
87
|
-
n_slices = int(np.ceil((
|
|
104
|
+
n_slices = int(np.ceil((duration - self.time_window) / stride) + 1)
|
|
88
105
|
else:
|
|
89
|
-
n_slices = int(np.floor((
|
|
106
|
+
n_slices = int(np.floor((duration - self.time_window) / stride) + 1)
|
|
90
107
|
n_slices = max(n_slices, 1) # for strides larger than recording time
|
|
91
108
|
|
|
92
|
-
window_start_times = np.arange(n_slices) * stride +
|
|
109
|
+
window_start_times = np.arange(n_slices) * stride + start_time
|
|
93
110
|
window_end_times = window_start_times + self.time_window
|
|
94
111
|
indices_start = np.searchsorted(t, window_start_times)[:n_slices]
|
|
95
112
|
indices_end = np.searchsorted(t, window_end_times)[:n_slices]
|
|
@@ -293,9 +310,15 @@ def slice_events_by_time(
|
|
|
293
310
|
time_window: int,
|
|
294
311
|
overlap: int = 0,
|
|
295
312
|
include_incomplete: bool = False,
|
|
313
|
+
start_time=None,
|
|
314
|
+
end_time=None,
|
|
296
315
|
):
|
|
297
316
|
return SliceByTime(
|
|
298
|
-
time_window=time_window,
|
|
317
|
+
time_window=time_window,
|
|
318
|
+
overlap=overlap,
|
|
319
|
+
include_incomplete=include_incomplete,
|
|
320
|
+
start_time=start_time,
|
|
321
|
+
end_time=end_time,
|
|
299
322
|
).slice(events, None)[0]
|
|
300
323
|
|
|
301
324
|
|
|
@@ -61,7 +61,7 @@ class CenterCrop:
|
|
|
61
61
|
if type(self.size) == int:
|
|
62
62
|
self.size = [self.size, self.size]
|
|
63
63
|
offsets = (self.sensor_size[0] - self.size[0]) // 2, (
|
|
64
|
-
|
|
64
|
+
self.sensor_size[1] - self.size[1]
|
|
65
65
|
) // 2
|
|
66
66
|
offset_idx = [max(offset, 0) for offset in offsets]
|
|
67
67
|
cropped_events = events[
|
|
@@ -69,7 +69,7 @@ class CenterCrop:
|
|
|
69
69
|
& (events["x"] < (offset_idx[0] + self.size[0]))
|
|
70
70
|
& (offset_idx[1] <= events["y"])
|
|
71
71
|
& (events["y"] < (offset_idx[1] + self.size[1]))
|
|
72
|
-
|
|
72
|
+
]
|
|
73
73
|
cropped_events["x"] -= offsets[0]
|
|
74
74
|
cropped_events["y"] -= offsets[1]
|
|
75
75
|
return cropped_events
|
|
@@ -229,7 +229,7 @@ class DropPixel:
|
|
|
229
229
|
|
|
230
230
|
def __call__(self, events):
|
|
231
231
|
if len(events) == 0:
|
|
232
|
-
return events
|
|
232
|
+
return events # return empty array
|
|
233
233
|
|
|
234
234
|
if events.dtype.names is not None:
|
|
235
235
|
# assert "x", "y", "p" in events.dtype.names
|
|
@@ -788,10 +788,10 @@ class NumpyAsType:
|
|
|
788
788
|
|
|
789
789
|
def __call__(self, events):
|
|
790
790
|
source_is_structured_array = (
|
|
791
|
-
|
|
791
|
+
hasattr(events.dtype, "names") and events.dtype.names != None
|
|
792
792
|
)
|
|
793
793
|
target_is_structured_array = (
|
|
794
|
-
|
|
794
|
+
hasattr(self.dtype, "names") and self.dtype.names != None
|
|
795
795
|
)
|
|
796
796
|
if source_is_structured_array and not target_is_structured_array:
|
|
797
797
|
return np.lib.recfunctions.structured_to_unstructured(events, self.dtype)
|
|
@@ -880,6 +880,10 @@ class ToFrame:
|
|
|
880
880
|
overlap is defined by the fraction of a bin between 0 and 1.
|
|
881
881
|
include_incomplete (bool): If True, includes overhang slice when time_window or event_count is specified.
|
|
882
882
|
Not valid for bin_count methods.
|
|
883
|
+
start_time (float): Optional start time if some empty frames are expected in the beginning. If omitted, the
|
|
884
|
+
start time is the timestamp of the first event for that sample.
|
|
885
|
+
end_time (float): Optional end time if some empty frames are expected in the end. If omitted, the end time
|
|
886
|
+
is the timestamp of the last event for that sample.
|
|
883
887
|
|
|
884
888
|
Example:
|
|
885
889
|
>>> from tonic.transforms import ToFrame
|
|
@@ -895,17 +899,35 @@ class ToFrame:
|
|
|
895
899
|
n_event_bins: Optional[int] = None
|
|
896
900
|
overlap: float = 0
|
|
897
901
|
include_incomplete: bool = False
|
|
902
|
+
start_time: Optional[float] = None
|
|
903
|
+
end_time: Optional[float] = None
|
|
898
904
|
|
|
899
905
|
def __call__(self, events):
|
|
900
906
|
|
|
901
907
|
# if events are empty, return a frame in the expected format
|
|
902
908
|
if len(events) == 0:
|
|
903
909
|
if self.time_window is not None or self.event_count is not None:
|
|
904
|
-
return np.zeros(
|
|
910
|
+
return np.zeros(
|
|
911
|
+
(1, self.sensor_size[2], self.sensor_size[0], self.sensor_size[1])
|
|
912
|
+
)
|
|
905
913
|
elif self.n_event_bins is not None:
|
|
906
|
-
return np.zeros(
|
|
914
|
+
return np.zeros(
|
|
915
|
+
(
|
|
916
|
+
self.n_event_bins,
|
|
917
|
+
self.sensor_size[2],
|
|
918
|
+
self.sensor_size[0],
|
|
919
|
+
self.sensor_size[1],
|
|
920
|
+
)
|
|
921
|
+
)
|
|
907
922
|
elif self.n_time_bins is not None:
|
|
908
|
-
return np.zeros(
|
|
923
|
+
return np.zeros(
|
|
924
|
+
(
|
|
925
|
+
self.n_time_bins,
|
|
926
|
+
self.sensor_size[2],
|
|
927
|
+
self.sensor_size[0],
|
|
928
|
+
self.sensor_size[1],
|
|
929
|
+
)
|
|
930
|
+
)
|
|
909
931
|
else:
|
|
910
932
|
raise ValueError("No slicing method specified.")
|
|
911
933
|
|
|
@@ -919,6 +941,8 @@ class ToFrame:
|
|
|
919
941
|
n_event_bins=self.n_event_bins,
|
|
920
942
|
overlap=self.overlap,
|
|
921
943
|
include_incomplete=self.include_incomplete,
|
|
944
|
+
start_time=self.start_time,
|
|
945
|
+
end_time=self.end_time,
|
|
922
946
|
)
|
|
923
947
|
|
|
924
948
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "f3ccb72", "is_release": false}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "6cc95a2", "is_release": false}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_event_by_area.py
RENAMED
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_drop_event_by_time.py
RENAMED
|
File without changes
|
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_event_downsampling.py
RENAMED
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_merge_polarities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_random_time_reversal.py
RENAMED
|
File without changes
|
{tonic-1.4.4.dev42 → tonic-1.4.4.dev44}/docs/gallery/transformations/plot_refractory_period.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|