Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Here is a simple example to get started:

```python
import numpy as np
from spikify.filtering import FilterBank
from spikify.encoding.rate import poisson
from spikify.filters import FilterBank
from spikify.encoders.rate import poisson

# Generate a sinusoidal signal
time = np.linspace(0, 4 * np.pi, 200)
Expand Down
4 changes: 2 additions & 2 deletions README_PYPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Here is a simple example to get started:

```python
import numpy as np
from spikify.filtering import FilterBank
from spikify.encoding.rate import poisson
from spikify.filters import FilterBank
from spikify.encoders.rate import poisson

# Generate a sinusoidal signal
time = np.linspace(0, 4 * np.pi, 200)
Expand Down
2 changes: 1 addition & 1 deletion animation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy as np
import matplotlib.pyplot as plt
import imageio.v2 as imageio
from spikify.encoding.rate import poisson
from spikify.encoders.rate import poisson
import os

# Set style for better visualization
Expand Down
28 changes: 14 additions & 14 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ component_management:
- component_id: temporal_encoding_deconvolution_algorithms
name: TempEncDeconAlgo
paths:
- "spikify/encoding/temporal/deconvolution/**"
- "tests/encoding/temporal/deconvolution/**"
- "spikify/encoders/temporal/deconvolution/**"
- "tests/encoders/temporal/deconvolution/**"
- component_id: temporal_encoding_global_referenced_algorithms
name: TempEncGlobAlgo
paths:
- "spikify/encoding/temporal/global_referenced/**"
- "tests/encoding/temporal/global_referenced/**"
- "spikify/encoders/temporal/global_referenced/**"
- "tests/encoders/temporal/global_referenced/**"
- component_id: temporal_encoding_contrast_algorithms
name: TempEncContAlgo
paths:
- "spikify/encoding/temporal/contrast/**"
- "tests/encoding/temporal/contrast/**"
- "spikify/encoders/temporal/contrast/**"
- "tests/encoders/temporal/contrast/**"
- component_id: temporal_encoding_latency_algorithms
name: TempEncLatAlgo
paths:
- "spikify/encoding/temporal/latency/**"
- "tests/encoding/temporal/latency/**"
- "spikify/encoders/temporal/latency/**"
- "tests/encoders/temporal/latency/**"
- component_id: temporal_encoding_rate_algorithms
name: TempEncRateAlgo
paths:
- "spikify/encoding/rate/**"
- "tests/encoding/rate/**"
- "spikify/encoders/rate/**"
- "tests/encoders/rate/**"

- component_id: filtering
name: Filtering
- component_id: filters
name: Filters
paths:
- "spikify/filtering/**"
- "tests/filtering/**"
- "spikify/filters/**"
- "tests/filters/**"

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.. _encoding:

:octicon:`file-directory;0.9em;sd-mr-1 fill-primary` encoding
:octicon:`file-directory;0.9em;sd-mr-1 fill-primary` encoders
=============================================================

The ``encoding`` folder within the spikify library contains the essential components for converting raw data into spike trains, a fundamental step in spiking neural networks. This section is organized to reflect the primary structure of the encoding algorithms included in the library:
The ``encoders`` module within the spikify library contains the essential components for converting raw data into spike trains, a fundamental step in spiking neural networks. This section is organized to reflect the primary structure of the encoding algorithms included in the library:

- **Rate Coding**: Contains algorithms that convert the intensity of input signals into spike frequency.
- **Temporal Coding**: Encloses algorithms that encode data based on the precise timing of spikes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Poisson Algorithm

.. automodule:: spikify.encoding.rate.poisson_algorithm
.. automodule:: spikify.encoders.rate.poisson_algorithm
:members: poisson
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Moving Window

.. automodule:: spikify.encoding.temporal.contrast.moving_window_algorithm
.. automodule:: spikify.encoders.temporal.contrast.moving_window_algorithm
:members: moving_window
:undoc-members:
:show-inheritance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Step Forward

.. automodule:: spikify.encoding.temporal.contrast.step_forward_algorithm
.. automodule:: spikify.encoders.temporal.contrast.step_forward_algorithm
:members: step_forward
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Threshold Based Representation

.. automodule:: spikify.encoding.temporal.contrast.threshold_based_algorithm
.. automodule:: spikify.encoders.temporal.contrast.threshold_based_algorithm
:members: threshold_based_representation
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Zero Cross Step Forward

.. automodule:: spikify.encoding.temporal.contrast.zero_cross_step_forward_algorithm
.. automodule:: spikify.encoders.temporal.contrast.zero_cross_step_forward_algorithm
:members: tzero_cross_step_forward
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Bens Spiker

.. automodule:: spikify.encoding.temporal.deconvolution.bens_spiker_algorithm
.. automodule:: spikify.encoders.temporal.deconvolution.bens_spiker_algorithm
:members: bens_spiker
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Hough Spiker

.. automodule:: spikify.encoding.temporal.deconvolution.hough_spiker_algorithm
.. automodule:: spikify.encoders.temporal.deconvolution.hough_spiker_algorithm
:members: hough_spiker
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Modified Hough Spiker

.. automodule:: spikify.encoding.temporal.deconvolution.modified_hough_spiker_algorithm
.. automodule:: spikify.encoders.temporal.deconvolution.modified_hough_spiker_algorithm
:members: modified_hough_spiker
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Phase Encoding

.. automodule:: spikify.encoding.temporal.global_referenced.phase_encoding_algorithm
.. automodule:: spikify.encoders.temporal.global_referenced.phase_encoding_algorithm
:members: phase_encoding
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Time to First Spike

.. automodule:: spikify.encoding.temporal.global_referenced.time_to_first_spike_algorithm
.. automodule:: spikify.encoders.temporal.global_referenced.time_to_first_spike_algorithm
:members: time_to_first_spike
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: Burst Coding

.. automodule:: spikify.encoding.temporal.latency.burst_coding_algorithm
.. automodule:: spikify.encoders.temporal.latency.burst_coding_algorithm
:members: burst_coding
:undoc-members:
:show-inheritance:
12 changes: 0 additions & 12 deletions docs/api/python/filtering/index.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. title:: FilterBank

.. autoclass:: spikify.filtering.filterbank.FilterBank
.. autoclass:: spikify.filters.filterbank.FilterBank
:members:
:undoc-members:
:show-inheritance:
12 changes: 12 additions & 0 deletions docs/api/python/filters/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _filtering:

:octicon:`file-directory;0.9em;sd-mr-1 fill-primary` filters
=================================================================

The ``filters`` module in the **spikify** library is designed to provide advanced filtering techniques inspired by biological systems. These filters enhance the quality of spike trains by pre-processing the raw data before encoding.


.. toctree::
:maxdepth: 1

filterbank
4 changes: 2 additions & 2 deletions docs/api/python/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Below, you will find links to the specific modules within the Python API:
.. toctree::
:maxdepth: 1

filtering/index
encoding/index
filters/index
encoders/index
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ Contents
:caption: Fundamentals
:maxdepth: 1

spikify/filtering/index
spikify/encoding/index
spikify/filters/index
spikify/encoders/index

.. toctree::
:caption: Development
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ It's recommended to install spikify in a virtual environment to avoid conflicts

python -m venv spikify-env
source spikify-env/bin/activate # On Windows use `spikify-env\Scripts\activate`
pip install spikify
pip install innuce-spikify

Getting code from source
------------------------
Expand Down
File renamed without changes.
25 changes: 0 additions & 25 deletions docs/spikify/filtering/index.rst

This file was deleted.

18 changes: 18 additions & 0 deletions docs/spikify/filters/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _filtering_desc:

Filtering
=========

Preprocessing tools for conditioning time-varying signals before spike encoding.
Frequency decomposition techniques inspired by biological sensory systems break down input signals into multiple frequency channels to improve spike train quality and encoding performance.

Filter Types
------------

- **Gammatone**: Bandpass filterbank approximating the frequency selectivity of the basilar membrane. Suitable for audio and speech signals where cochlear-like decomposition is required.
- **Butterworth**: IIR filterbank with a maximally flat passband response. Suitable for general-purpose signal conditioning and noise attenuation prior to encoding.

Each filter can be configured with parameters such as center frequency, bandwidth, and order. All filters are
implemented as filter banks, decomposing the input signal into multiple frequency channels simultaneously.

For implementation details and usage examples, refer to the :ref:`FilterBank <filterbank_class>` documentation.
4 changes: 2 additions & 2 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Before encoding, you may want to filter the signal to focus on specific frequenc

.. code-block:: python

from spikify.filtering import FilterBank
from spikify.filters import FilterBank

filter = FilterBank(fs=50, channels=5, f_min=0.5, f_max=5, order=4, filter_type='butterworth')

Expand All @@ -39,7 +39,7 @@ Now, let's encode the sinusoidal signal into spikes using the `poisson` method.

.. code-block:: python

from spikify.encoding.rate import poisson
from spikify.encoders.rate import poisson

# Set parameters for encoding
np.random.seed(0) # For reproducibility
Expand Down
10 changes: 5 additions & 5 deletions examples/wisdm/encode.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
from pathlib import Path
import numpy as np
from spikify.encoding.rate import poisson_rate
from spikify.encoding.temporal.latency import burst_encoding
from spikify.encoding.temporal.contrast import (
from spikify.encoders.rate import poisson_rate
from spikify.encoders.temporal.latency import burst_encoding
from spikify.encoders.temporal.contrast import (
moving_window,
step_forward,
threshold_based_representation,
zero_cross_step_forward,
)
from spikify.encoding.temporal.global_referenced import phase_encoding, time_to_first_spike
from spikify.encoding.temporal.deconvolution import bens_spiker, hough_spiker, modified_hough_spiker
from spikify.encoders.temporal.global_referenced import phase_encoding, time_to_first_spike
from spikify.encoders.temporal.deconvolution import bens_spiker, hough_spiker, modified_hough_spiker
from datasets import load_dataset

REPO_ID = "neuromorphic-polito/siddha"
Expand Down
1 change: 1 addition & 0 deletions spikify/encoders/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Encoders package."""
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def poisson(signal: np.ndarray, interval_length: int, seed: int = 0) -> np.ndarr
.. code-block:: python

import numpy as np
from spikify.encoding.rate import poisson
from spikify.encoders.rate import poisson
signal = np.array([0.2, 0.5, 0.8, 1.0])
np.random.seed(0)
interval_length = 2
Expand All @@ -41,7 +41,7 @@ def poisson(signal: np.ndarray, interval_length: int, seed: int = 0) -> np.ndarr
:hide:

>>> import numpy as np
>>> from spikify.encoding.rate import poisson
>>> from spikify.encoders.rate import poisson
>>> # Example with numpy array
>>> signal = np.array([0.2, 0.5, 0.8, 1.0])
>>> interval_length = 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def moving_window(
.. code-block:: python

import numpy as np
from spikify.encoding.temporal.contrast import moving_window
from spikify.encoders.temporal.contrast import moving_window
signal = np.array([0.1, 0.3, 0.2, 0.5, 0.8, 1.0])
window_length = 3
threshold = 0.2
Expand All @@ -36,7 +36,7 @@ def moving_window(
:hide:

>>> import numpy as np
>>> from spikify.encoding.temporal.contrast import moving_window
>>> from spikify.encoders.temporal.contrast import moving_window
>>> signal = np.array([0.1, 0.3, 0.2, 0.5, 0.8, 1.0])
>>> window_length = 3
>>> threshold = 0.2
Expand Down
Loading
Loading