ezmsg-sigproc 1.7.1__tar.gz → 2.13.1__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.
- ezmsg_sigproc-2.13.1/.github/workflows/docs.yml +66 -0
- ezmsg_sigproc-2.13.1/.github/workflows/python-publish.yml +29 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/.github/workflows/python-tests.yml +4 -10
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/.gitignore +5 -1
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/.pre-commit-config.yaml +1 -2
- ezmsg_sigproc-2.13.1/PKG-INFO +60 -0
- ezmsg_sigproc-2.13.1/README.md +42 -0
- ezmsg_sigproc-2.13.1/docs/Makefile +20 -0
- ezmsg_sigproc-2.13.1/docs/make.bat +35 -0
- ezmsg_sigproc-2.13.1/docs/source/_templates/autosummary/module.rst +64 -0
- ezmsg_sigproc-2.13.1/docs/source/api/index.rst +11 -0
- ezmsg_sigproc-2.13.1/docs/source/conf.py +128 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/HybridBuffer.md +87 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/explanations/array_api.rst +156 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/explanations/sigproc.rst +365 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/adaptive.rst +4 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/checkpoint.rst +4 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/composite.rst +6 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/content-signalprocessing.rst +13 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/processor.rst +8 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/standalone.rst +4 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/stateful.rst +8 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/how-tos/signalprocessing/unit.rst +41 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/img/HybridBufferBasic.svg +4 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/img/HybridBufferOverflow.svg +4 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/sigproc/architecture.rst +41 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/sigproc/base.rst +19 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/sigproc/content-sigproc.rst +25 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/sigproc/processors.rst +149 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/sigproc/units.rst +29 -0
- ezmsg_sigproc-2.13.1/docs/source/guides/tutorials/signalprocessing.rst +596 -0
- ezmsg_sigproc-2.13.1/docs/source/index.md +20 -0
- ezmsg_sigproc-2.13.1/pyproject.toml +88 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/__version__.py +16 -3
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/activation.py +78 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/adaptive_lattice_notch.py +212 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/affinetransform.py +534 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/aggregate.py +276 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/bandpower.py +80 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/base.py +149 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/butterworthfilter.py +34 -38
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/butterworthzerophase.py +305 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/cheby.py +23 -17
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/combfilter.py +160 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/coordinatespaces.py +159 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/decimate.py +15 -10
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/denormalize.py +78 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/detrend.py +28 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/diff.py +82 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/downsample.py +111 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/ewma.py +217 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/extract_axis.py +39 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/fbcca.py +307 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/filter.py +305 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/filterbank.py +292 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/filterbankdesign.py +129 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/fir_hilbert.py +336 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/fir_pmc.py +209 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/firfilter.py +117 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/gaussiansmoothing.py +89 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/kaiser.py +106 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/linear.py +120 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/abs.py +35 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/add.py +120 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/clip.py +48 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/difference.py +143 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/invert.py +28 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/log.py +57 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/pow.py +43 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/math/scale.py +39 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/merge.py +358 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/messages.py +1 -2
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/quantize.py +69 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/resample.py +278 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/rollingscaler.py +240 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/sampler.py +278 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/scaler.py +196 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/signalinjector.py +70 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/singlebandpow.py +116 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/slicer.py +138 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/spectrogram.py +90 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/spectrum.py +277 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/transpose.py +134 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/asio.py +25 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/axisarray_buffer.py +365 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/buffer.py +449 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/message.py +17 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/profile.py +23 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/sparse.py +115 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/util/typeresolution.py +17 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/wavelets.py +187 -0
- ezmsg_sigproc-2.13.1/src/ezmsg/sigproc/window.py +328 -0
- ezmsg_sigproc-2.13.1/tests/conftest.py +4 -0
- ezmsg_sigproc-2.13.1/tests/helpers/__init__.py +0 -0
- ezmsg_sigproc-2.13.1/tests/helpers/synth.py +281 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/tests/helpers/util.py +85 -18
- ezmsg_sigproc-2.13.1/tests/integration/bytewax/test_spectrum_bytewax.py +68 -0
- ezmsg_sigproc-2.13.1/tests/integration/bytewax/test_window_bytewax.py +59 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_add_system.py +148 -0
- ezmsg_sigproc-1.7.1/tests/test_butterworth.py → ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_butterworth_system.py +12 -22
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_butterworthzerophase_system.py +79 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_coordinatespaces_system.py +226 -0
- ezmsg_sigproc-1.7.1/tests/test_decimate.py → ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_decimate_system.py +6 -9
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_difference_system.py +203 -0
- ezmsg_sigproc-1.7.1/tests/test_downsample.py → ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_downsample_system.py +19 -84
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/integration/ezmsg}/test_filter_system.py +10 -21
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_fir_hilbert_system.py +48 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_fir_pmc_system.py +51 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_rollingscaler_system.py +48 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_sampler_system.py +97 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_scaler_system.py +77 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_spectrum_system.py +103 -0
- ezmsg_sigproc-2.13.1/tests/integration/ezmsg/test_window_system.py +185 -0
- ezmsg_sigproc-2.13.1/tests/test_profile.py +39 -0
- ezmsg_sigproc-2.13.1/tests/unit/buffer/test_axisarray_buffer.py +583 -0
- ezmsg_sigproc-2.13.1/tests/unit/buffer/test_buffer.py +443 -0
- ezmsg_sigproc-2.13.1/tests/unit/buffer/test_buffer_overflow.py +192 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_activation.py +11 -11
- ezmsg_sigproc-2.13.1/tests/unit/test_adaptive_lattice_notch.py +147 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_affine_transform.py +783 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_aggregate.py +380 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_bandpower.py +20 -9
- ezmsg_sigproc-2.13.1/tests/unit/test_base.py +1100 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_butter.py +112 -28
- ezmsg_sigproc-2.13.1/tests/unit/test_butterworthzerophase.py +545 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_combfilter.py +317 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_coordinatespaces.py +272 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_denormalize.py +232 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_diff.py +127 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_downsample.py +70 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_ewma.py +162 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_extract_axis.py +63 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_fbcca.py +708 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_filter.py +18 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_filterbank.py +8 -23
- ezmsg_sigproc-2.13.1/tests/unit/test_filterbankdesign.py +651 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_fir_hilbert.py +263 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_fir_pmc.py +93 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_firfilter.py +285 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_gaussian_smoothing_filter.py +247 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_kaiser.py +420 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_linear.py +307 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_math.py +102 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_math_add.py +247 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_math_difference.py +278 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_merge.py +369 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_quantize.py +84 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_resample.py +138 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_rollingscaler.py +147 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_sampler.py +78 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_scaler.py +236 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_singlebandpow.py +180 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_slicer.py +22 -30
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_spectrogram.py +11 -15
- ezmsg_sigproc-2.13.1/tests/unit/test_spectrum.py +163 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_transpose.py +61 -0
- ezmsg_sigproc-2.13.1/tests/unit/test_util.py +87 -0
- {ezmsg_sigproc-1.7.1/tests → ezmsg_sigproc-2.13.1/tests/unit}/test_wavelets.py +14 -25
- ezmsg_sigproc-2.13.1/tests/unit/test_window.py +238 -0
- ezmsg_sigproc-1.7.1/.github/workflows/python-publish-ezmsg-sigproc.yml +0 -30
- ezmsg_sigproc-1.7.1/PKG-INFO +0 -60
- ezmsg_sigproc-1.7.1/README.md +0 -39
- ezmsg_sigproc-1.7.1/pyproject.toml +0 -51
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/activation.py +0 -87
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/affinetransform.py +0 -233
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/aggregate.py +0 -183
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/bandpower.py +0 -76
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/base.py +0 -42
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/downsample.py +0 -120
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/filter.py +0 -199
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/filterbank.py +0 -281
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/abs.py +0 -34
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/clip.py +0 -40
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/difference.py +0 -69
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/invert.py +0 -35
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/log.py +0 -52
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/math/scale.py +0 -40
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/sampler.py +0 -326
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/scaler.py +0 -290
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/signalinjector.py +0 -72
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/slicer.py +0 -166
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/spectrogram.py +0 -95
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/spectrum.py +0 -263
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/synth.py +0 -621
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/util/profile.py +0 -131
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/util/sparse.py +0 -29
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/wavelets.py +0 -195
- ezmsg_sigproc-1.7.1/src/ezmsg/sigproc/window.py +0 -322
- ezmsg_sigproc-1.7.1/tests/conftest.py +0 -4
- ezmsg_sigproc-1.7.1/tests/test_affine_transform.py +0 -136
- ezmsg_sigproc-1.7.1/tests/test_aggregate.py +0 -137
- ezmsg_sigproc-1.7.1/tests/test_math.py +0 -90
- ezmsg_sigproc-1.7.1/tests/test_sampler.py +0 -190
- ezmsg_sigproc-1.7.1/tests/test_scaler.py +0 -150
- ezmsg_sigproc-1.7.1/tests/test_spectrum.py +0 -270
- ezmsg_sigproc-1.7.1/tests/test_synth.py +0 -384
- ezmsg_sigproc-1.7.1/tests/test_window.py +0 -466
- ezmsg_sigproc-1.7.1/uv.lock +0 -609
- ezmsg_sigproc-1.7.1/LICENSE.txt → ezmsg_sigproc-2.13.1/LICENSE +0 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/__init__.py +0 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/ewmfilter.py +1 -1
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/math/__init__.py +0 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/spectral.py +3 -3
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/src/ezmsg/sigproc/util/__init__.py +0 -0
- {ezmsg_sigproc-1.7.1/tests/helpers → ezmsg_sigproc-2.13.1/tests}/__init__.py +0 -0
- {ezmsg_sigproc-1.7.1 → ezmsg_sigproc-2.13.1}/tests/resources/xform.csv +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
- dev
|
|
11
|
+
release:
|
|
12
|
+
types: [published]
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
pages: write
|
|
18
|
+
id-token: write
|
|
19
|
+
|
|
20
|
+
# Allow only one concurrent deployment
|
|
21
|
+
concurrency:
|
|
22
|
+
group: "pages"
|
|
23
|
+
cancel-in-progress: false
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
build:
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
with:
|
|
31
|
+
fetch-depth: 0 # Needed for hatch-vcs to determine version
|
|
32
|
+
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@v6
|
|
35
|
+
with:
|
|
36
|
+
enable-cache: true
|
|
37
|
+
python-version: "3.12"
|
|
38
|
+
|
|
39
|
+
- name: Install the project
|
|
40
|
+
run: uv sync --only-group docs
|
|
41
|
+
|
|
42
|
+
- name: Build documentation
|
|
43
|
+
run: |
|
|
44
|
+
cd docs
|
|
45
|
+
uv run make html
|
|
46
|
+
|
|
47
|
+
- name: Add .nojekyll file
|
|
48
|
+
run: touch docs/build/html/.nojekyll
|
|
49
|
+
|
|
50
|
+
- name: Upload artifact
|
|
51
|
+
uses: actions/upload-pages-artifact@v3
|
|
52
|
+
with:
|
|
53
|
+
path: 'docs/build/html'
|
|
54
|
+
|
|
55
|
+
deploy:
|
|
56
|
+
# Only deploy when a release is published
|
|
57
|
+
if: github.event_name == 'release'
|
|
58
|
+
environment:
|
|
59
|
+
name: github-pages
|
|
60
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
needs: build
|
|
63
|
+
steps:
|
|
64
|
+
- name: Deploy to GitHub Pages
|
|
65
|
+
id: deployment
|
|
66
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: build and upload release to PyPI
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: "release"
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v6
|
|
24
|
+
|
|
25
|
+
- name: Build Package
|
|
26
|
+
run: uv build
|
|
27
|
+
|
|
28
|
+
- name: Publish package distributions to PyPI
|
|
29
|
+
run: uv publish
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
build:
|
|
14
14
|
strategy:
|
|
15
15
|
matrix:
|
|
16
|
-
python-version: ["3.10", "3.11", "3.12"]
|
|
16
|
+
python-version: ["3.10.15", "3.11", "3.12", "3.13"]
|
|
17
17
|
os:
|
|
18
18
|
- "ubuntu-latest"
|
|
19
19
|
- "windows-latest"
|
|
@@ -23,17 +23,11 @@ jobs:
|
|
|
23
23
|
steps:
|
|
24
24
|
- uses: actions/checkout@v4
|
|
25
25
|
|
|
26
|
-
- name: Install uv
|
|
27
|
-
uses: astral-sh/setup-uv@
|
|
28
|
-
with:
|
|
29
|
-
enable-cache: true
|
|
30
|
-
cache-dependency-glob: "uv.lock"
|
|
31
|
-
|
|
32
|
-
- name: Set up Python ${{ matrix.python-version }}
|
|
33
|
-
run: uv python install ${{ matrix.python-version }}
|
|
26
|
+
- name: Install the latest version of uv
|
|
27
|
+
uses: astral-sh/setup-uv@v6
|
|
34
28
|
|
|
35
29
|
- name: Install the project
|
|
36
|
-
run: uv sync --
|
|
30
|
+
run: uv sync --python ${{ matrix.python-version }}
|
|
37
31
|
|
|
38
32
|
- name: Lint
|
|
39
33
|
run:
|
|
@@ -70,8 +70,10 @@ instance/
|
|
|
70
70
|
|
|
71
71
|
# Sphinx documentation
|
|
72
72
|
docs/_build/
|
|
73
|
+
docs/build/
|
|
73
74
|
docs/source/_build
|
|
74
75
|
docs/source/generated
|
|
76
|
+
docs/source/api/generated
|
|
75
77
|
|
|
76
78
|
# PyBuilder
|
|
77
79
|
.pybuilder/
|
|
@@ -142,4 +144,6 @@ cython_debug/
|
|
|
142
144
|
# JetBrains
|
|
143
145
|
.idea/
|
|
144
146
|
|
|
145
|
-
src/ezmsg/sigproc/__version__.py
|
|
147
|
+
src/ezmsg/sigproc/__version__.py
|
|
148
|
+
uv.lock
|
|
149
|
+
*.local.json
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ezmsg-sigproc
|
|
3
|
+
Version: 2.13.1
|
|
4
|
+
Summary: Timeseries signal processing implementations in ezmsg
|
|
5
|
+
Author-email: Griffin Milsap <griffin.milsap@gmail.com>, Preston Peranich <pperanich@gmail.com>, Chadwick Boulay <chadwick.boulay@gmail.com>, Kyle McGraw <kmcgraw@blackrockneuro.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10.15
|
|
9
|
+
Requires-Dist: array-api-compat>=1.11.1
|
|
10
|
+
Requires-Dist: ezmsg-baseproc>=1.1.0
|
|
11
|
+
Requires-Dist: ezmsg>=3.6.0
|
|
12
|
+
Requires-Dist: numba>=0.61.0
|
|
13
|
+
Requires-Dist: numpy>=1.26.0
|
|
14
|
+
Requires-Dist: pywavelets>=1.6.0
|
|
15
|
+
Requires-Dist: scipy>=1.13.1
|
|
16
|
+
Requires-Dist: sparse>=0.15.4
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# ezmsg-sigproc
|
|
20
|
+
|
|
21
|
+
Signal processing primitives for the [ezmsg](https://www.ezmsg.org) message-passing framework.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
* **Filtering** - Chebyshev, comb filters, and more
|
|
26
|
+
* **Spectral analysis** - Spectrogram, spectrum, and wavelet transforms
|
|
27
|
+
* **Resampling** - Downsample, decimate, and resample operations
|
|
28
|
+
* **Windowing** - Sliding windows and buffering utilities
|
|
29
|
+
* **Math operations** - Arithmetic, log, abs, difference, and more
|
|
30
|
+
* **Signal generation** - Synthetic signal generators
|
|
31
|
+
|
|
32
|
+
All modules use `AxisArray` as the primary data structure for passing signals between components.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
Install from PyPI:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install ezmsg-sigproc
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or install from GitHub for the latest development version:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
Full documentation is available at [ezmsg.org](https://www.ezmsg.org).
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
We use [`uv`](https://docs.astral.sh/uv/) for development.
|
|
55
|
+
|
|
56
|
+
1. Fork and clone the repository
|
|
57
|
+
2. `uv sync` to create a virtual environment and install dependencies
|
|
58
|
+
3. `uv run pre-commit install` to set up linting and formatting hooks
|
|
59
|
+
4. `uv run pytest tests` to run the test suite
|
|
60
|
+
5. Submit a PR against the `dev` branch
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ezmsg-sigproc
|
|
2
|
+
|
|
3
|
+
Signal processing primitives for the [ezmsg](https://www.ezmsg.org) message-passing framework.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
* **Filtering** - Chebyshev, comb filters, and more
|
|
8
|
+
* **Spectral analysis** - Spectrogram, spectrum, and wavelet transforms
|
|
9
|
+
* **Resampling** - Downsample, decimate, and resample operations
|
|
10
|
+
* **Windowing** - Sliding windows and buffering utilities
|
|
11
|
+
* **Math operations** - Arithmetic, log, abs, difference, and more
|
|
12
|
+
* **Signal generation** - Synthetic signal generators
|
|
13
|
+
|
|
14
|
+
All modules use `AxisArray` as the primary data structure for passing signals between components.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
Install from PyPI:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install ezmsg-sigproc
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or install from GitHub for the latest development version:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install git+https://github.com/ezmsg-org/ezmsg-sigproc.git@dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
Full documentation is available at [ezmsg.org](https://www.ezmsg.org).
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
We use [`uv`](https://docs.astral.sh/uv/) for development.
|
|
37
|
+
|
|
38
|
+
1. Fork and clone the repository
|
|
39
|
+
2. `uv sync` to create a virtual environment and install dependencies
|
|
40
|
+
3. `uv run pre-commit install` to set up linting and formatting hooks
|
|
41
|
+
4. `uv run pytest tests` to run the test suite
|
|
42
|
+
5. Submit a PR against the `dev` branch
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = source
|
|
9
|
+
BUILDDIR = build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=source
|
|
11
|
+
set BUILDDIR=build
|
|
12
|
+
|
|
13
|
+
if "%1" == "" goto help
|
|
14
|
+
|
|
15
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
16
|
+
if errorlevel 9009 (
|
|
17
|
+
echo.
|
|
18
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
19
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
20
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
21
|
+
echo.may add the Sphinx directory to PATH.
|
|
22
|
+
echo.
|
|
23
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
24
|
+
echo.http://sphinx-doc.org/
|
|
25
|
+
exit /b 1
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{{ fullname | escape | underline}}
|
|
2
|
+
|
|
3
|
+
.. automodule:: {{ fullname }}
|
|
4
|
+
|
|
5
|
+
{% block attributes %}
|
|
6
|
+
{% if attributes %}
|
|
7
|
+
.. rubric:: Module Attributes
|
|
8
|
+
|
|
9
|
+
.. autosummary::
|
|
10
|
+
:toctree:
|
|
11
|
+
{% for item in attributes %}
|
|
12
|
+
{{ item }}
|
|
13
|
+
{%- endfor %}
|
|
14
|
+
{% endif %}
|
|
15
|
+
{% endblock %}
|
|
16
|
+
|
|
17
|
+
{% block functions %}
|
|
18
|
+
{% if functions %}
|
|
19
|
+
.. rubric:: Functions
|
|
20
|
+
|
|
21
|
+
{% for item in functions %}
|
|
22
|
+
.. autofunction:: {{ item }}
|
|
23
|
+
{%- endfor %}
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% endblock %}
|
|
26
|
+
|
|
27
|
+
{% block classes %}
|
|
28
|
+
{% if classes %}
|
|
29
|
+
.. rubric:: Classes
|
|
30
|
+
|
|
31
|
+
{% for item in classes %}
|
|
32
|
+
.. autoclass:: {{ item }}
|
|
33
|
+
:members:
|
|
34
|
+
:undoc-members:
|
|
35
|
+
:show-inheritance:
|
|
36
|
+
:special-members: __init__
|
|
37
|
+
{%- endfor %}
|
|
38
|
+
{% endif %}
|
|
39
|
+
{% endblock %}
|
|
40
|
+
|
|
41
|
+
{% block exceptions %}
|
|
42
|
+
{% if exceptions %}
|
|
43
|
+
.. rubric:: Exceptions
|
|
44
|
+
|
|
45
|
+
{% for item in exceptions %}
|
|
46
|
+
.. autoexception:: {{ item }}
|
|
47
|
+
:members:
|
|
48
|
+
:show-inheritance:
|
|
49
|
+
{%- endfor %}
|
|
50
|
+
{% endif %}
|
|
51
|
+
{% endblock %}
|
|
52
|
+
|
|
53
|
+
{% block modules %}
|
|
54
|
+
{% if modules %}
|
|
55
|
+
.. rubric:: Modules
|
|
56
|
+
|
|
57
|
+
.. autosummary::
|
|
58
|
+
:toctree:
|
|
59
|
+
:recursive:
|
|
60
|
+
{% for item in modules %}
|
|
61
|
+
{{ item }}
|
|
62
|
+
{%- endfor %}
|
|
63
|
+
{% endif %}
|
|
64
|
+
{% endblock %}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
# Add the source directory to the path
|
|
7
|
+
sys.path.insert(0, os.path.abspath("../../src"))
|
|
8
|
+
|
|
9
|
+
# -- Project information --------------------------
|
|
10
|
+
|
|
11
|
+
project = "ezmsg.sigproc"
|
|
12
|
+
copyright = "2024, ezmsg Contributors"
|
|
13
|
+
author = "ezmsg Contributors"
|
|
14
|
+
|
|
15
|
+
# The version is managed by hatch-vcs and stored in __version__.py
|
|
16
|
+
try:
|
|
17
|
+
from ezmsg.sigproc.__version__ import version as release
|
|
18
|
+
except ImportError:
|
|
19
|
+
release = "unknown"
|
|
20
|
+
|
|
21
|
+
# For display purposes, extract the base version without git commit info
|
|
22
|
+
version = release.split("+")[0] if release != "unknown" else release
|
|
23
|
+
|
|
24
|
+
# -- General configuration --------------------------
|
|
25
|
+
|
|
26
|
+
extensions = [
|
|
27
|
+
"sphinx.ext.autodoc",
|
|
28
|
+
"sphinx.ext.autosummary",
|
|
29
|
+
"sphinx.ext.napoleon",
|
|
30
|
+
"sphinx.ext.intersphinx",
|
|
31
|
+
"sphinx.ext.viewcode",
|
|
32
|
+
"sphinx.ext.duration",
|
|
33
|
+
# "sphinx_autodoc_typehints", # Disabled due to compatibility issue
|
|
34
|
+
"sphinx_copybutton",
|
|
35
|
+
"myst_parser", # For markdown files
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
templates_path = ["_templates"]
|
|
39
|
+
source_suffix = {
|
|
40
|
+
".rst": "restructuredtext",
|
|
41
|
+
".md": "markdown",
|
|
42
|
+
}
|
|
43
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
44
|
+
|
|
45
|
+
# The toctree master document
|
|
46
|
+
master_doc = "index"
|
|
47
|
+
|
|
48
|
+
# -- Autodoc configuration ------------------------------
|
|
49
|
+
|
|
50
|
+
# Auto-generate API docs
|
|
51
|
+
autosummary_generate = True
|
|
52
|
+
autosummary_imported_members = False
|
|
53
|
+
autodoc_typehints = "description"
|
|
54
|
+
autodoc_member_order = "bysource"
|
|
55
|
+
autodoc_typehints_format = "short"
|
|
56
|
+
python_use_unqualified_type_names = True
|
|
57
|
+
autodoc_default_options = {
|
|
58
|
+
"members": True,
|
|
59
|
+
"member-order": "bysource",
|
|
60
|
+
"special-members": "__init__",
|
|
61
|
+
"undoc-members": True,
|
|
62
|
+
"show-inheritance": True,
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# Don't show the full module path in the docs
|
|
66
|
+
add_module_names = False
|
|
67
|
+
|
|
68
|
+
# -- Intersphinx configuration --------------------------
|
|
69
|
+
|
|
70
|
+
intersphinx_mapping = {
|
|
71
|
+
"python": ("https://docs.python.org/3/", None),
|
|
72
|
+
"numpy": ("https://numpy.org/doc/stable/", None),
|
|
73
|
+
"scipy": ("https://scipy.org/doc/scipy/", None),
|
|
74
|
+
"ezmsg": ("https://www.ezmsg.org/ezmsg/", None),
|
|
75
|
+
"ezmsg.baseproc": ("https://www.ezmsg.org/ezmsg-baseproc/", None),
|
|
76
|
+
"ezmsg.learn": ("https://www.ezmsg.org/ezmsg-learn/", None),
|
|
77
|
+
"ezmsg.event": ("https://www.ezmsg.org/ezmsg-event/", None),
|
|
78
|
+
"ezmsg.lsl": ("https://www.ezmsg.org/ezmsg-lsl/", None),
|
|
79
|
+
"ezmsg.blackrock": ("https://www.ezmsg.org/ezmsg-blackrock/", None),
|
|
80
|
+
}
|
|
81
|
+
intersphinx_disabled_domains = ["std"]
|
|
82
|
+
|
|
83
|
+
# -- Options for HTML output -----------------------------
|
|
84
|
+
|
|
85
|
+
html_theme = "pydata_sphinx_theme"
|
|
86
|
+
html_static_path = ["_static"]
|
|
87
|
+
|
|
88
|
+
# Set the base URL for the documentation
|
|
89
|
+
html_baseurl = "https://www.ezmsg.org/ezmsg-sigproc/"
|
|
90
|
+
|
|
91
|
+
html_theme_options = {
|
|
92
|
+
"logo": {
|
|
93
|
+
"text": f"ezmsg.sigproc {version}",
|
|
94
|
+
"link": "https://ezmsg.org", # Link back to main site
|
|
95
|
+
},
|
|
96
|
+
"header_links_before_dropdown": 4,
|
|
97
|
+
"navbar_start": ["navbar-logo"],
|
|
98
|
+
"navbar_end": ["theme-switcher", "navbar-icon-links"],
|
|
99
|
+
"icon_links": [
|
|
100
|
+
{
|
|
101
|
+
"name": "GitHub",
|
|
102
|
+
"url": "https://github.com/ezmsg-org/ezmsg-sigproc",
|
|
103
|
+
"icon": "fa-brands fa-github",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "ezmsg.org",
|
|
107
|
+
"url": "https://www.ezmsg.org",
|
|
108
|
+
"icon": "fa-solid fa-house",
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# Timestamp is inserted at every page bottom in this strftime format.
|
|
114
|
+
html_last_updated_fmt = "%Y-%m-%d"
|
|
115
|
+
|
|
116
|
+
# -- Options for linkcode -----------------------------
|
|
117
|
+
|
|
118
|
+
branch = "main"
|
|
119
|
+
code_url = f"https://github.com/ezmsg-org/ezmsg-sigproc/blob/{branch}/"
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def linkcode_resolve(domain, info):
|
|
123
|
+
if domain != "py":
|
|
124
|
+
return None
|
|
125
|
+
if not info["module"]:
|
|
126
|
+
return None
|
|
127
|
+
filename = info["module"].replace(".", "/")
|
|
128
|
+
return f"{code_url}src/{filename}.py"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## HybridBuffer
|
|
2
|
+
|
|
3
|
+
The HybridBuffer is a stateful, FIFO buffer that combines a deque for fast appends with a contiguous circular buffer for efficient, advancing reads. The synchronization between the deque and the circular buffer can be immediate, upon threshold reaching, or on demand, allowing for flexible data management strategies.
|
|
4
|
+
|
|
5
|
+
This buffer is designed to be agnostic to the array library used (e.g., NumPy, CuPy, PyTorch) via the Python Array API standard.
|
|
6
|
+
|
|
7
|
+
### Basic Reading and Writing Behaviour
|
|
8
|
+
|
|
9
|
+
The following diagram illustrates the states of the HybridBuffer across data writes and reads when `update_strategy="on_demand"`:
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
**Figure 1**
|
|
14
|
+
|
|
15
|
+
A. In the initial state, the buffer is empty, with no data in either the deque or the circular buffer.
|
|
16
|
+
* deq_len=0; available=0, tell=0
|
|
17
|
+
|
|
18
|
+
B. After we `write()` 4 samples, the deque contains the new data, but the circular buffer is still empty.
|
|
19
|
+
* deq_len=4; available=4, tell=0
|
|
20
|
+
|
|
21
|
+
C. After we `write()` 4 more samples, the deque now has 2 messages, each with 4 samples, and the circular buffer remains untouched.
|
|
22
|
+
* deq_len=8; available=8, tell=0
|
|
23
|
+
|
|
24
|
+
D. Panels D-F depict a single call to `read(4)` which is implemented as calls to other methods. If we don't have 4 unread samples in the circular buffer, but we do have >= 4 samples 'available' (i.e., including the deque), then a `flush()` is performed: the entirety of the data in the deque are copied to the circular buffer and the deque is cleared.
|
|
25
|
+
* deq_len=0; available=8, tell=0
|
|
26
|
+
* TODO: Currently `flush()` copies the data twice, once from the deque to a contiguous array, and then from that contiguous array to the circular buffer. This should be optimized to copy directly from the deque to the circular buffer.
|
|
27
|
+
|
|
28
|
+
E. Next we `peek(4)` which returns the first 4 samples from the circular buffer; the return value may be a view on the data if the data are contiguous in the circular buffer, or a copy if the data are not contiguous. Note that the tail (read pointer) does not advance with `peek()`.
|
|
29
|
+
* deq_len=0; available=8, tell=0
|
|
30
|
+
|
|
31
|
+
F. Finally, we `seek(4)` to advance the tail.
|
|
32
|
+
* deq_len=0; available=4, tell=4
|
|
33
|
+
|
|
34
|
+
G. We `write()` 4 more samples, which are appended to the deque, leaving the circular buffer unchanged from the previous step.
|
|
35
|
+
* deq_len=4; available=8, tell=4
|
|
36
|
+
|
|
37
|
+
H. We then `read(4)` again. This time, a `flush()` is not triggered because we have enough unread samples in the circular buffer, but `peek(4)` and `seek(4)` are still called. The read pointer advances by 4, leaving 0 unread samples in the circular buffer and 4 in the deque.
|
|
38
|
+
* deq_len=4; available=0, tell=8
|
|
39
|
+
|
|
40
|
+
Note: `peek(n)` and `seek(n)`, where `n` > `n_available` will raise an error. However, `peek(None)` will return all available samples without error, and `seek(None)` will advance the tail to the end of the available data.
|
|
41
|
+
|
|
42
|
+
### Overflow Behaviour
|
|
43
|
+
|
|
44
|
+
The criteria to trigger an overflow are as follows:
|
|
45
|
+
* the deque has more data than there is space in the circular buffer, where space is the combination of previously read samples and unwritten samples in the circular buffer.
|
|
46
|
+
* the caller triggers a flush either manually (`flush()`) or by requesting (via `read`, `peek`, or `seek`) more samples than are available in the circular buffer but not more than the total size of the available samples in the buffer + available samples in the deque.
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
**Figure 2**
|
|
51
|
+
|
|
52
|
+
A. We start with a circular buffer that has been running for a while (it has wrapped around several times). At this particular moment, we have more data in the deque (12) than we have room in the buffer (8). The remaining figures describe what happens when `flush()` is called with different overflow strategies. The samples are labeled to make it easier to follow the flow of data.
|
|
53
|
+
* deq_len=12; available=20, tell=1
|
|
54
|
+
|
|
55
|
+
B. "warn-overwrite": If the overflow_strategy is set to 'warn-overwrite', the HybridBuffer will log a warning and overwrite the oldest data in the circular buffer with the new data from the deque. Here, samples 'a-d' are lost.
|
|
56
|
+
* deq_len=0; available=16, tell=0
|
|
57
|
+
|
|
58
|
+
C. "drop": As much as possible of the data from the deque are copied into the circular buffer, but remaining data are dropped. In this case, samples 'q-t' are lost.
|
|
59
|
+
* deq_len=0; available=16, tell=0
|
|
60
|
+
|
|
61
|
+
D. "grow": The HybridBuffer will attempt to grow the circular buffer to the lesser of double its current size or the size required to accommodate all read + unread + deque data. If the buffer cannot grow (e.g., due to memory constraints; default max_size is 1GB), it will raise an error.
|
|
62
|
+
* deq_len=0; available=20, tell=8
|
|
63
|
+
|
|
64
|
+
Additionally, one can configure the HybridBuffer overflow_strategy to 'raise', which will raise an error if there is insufficient space (empty or read samples) in the buffer to perform the flush.
|
|
65
|
+
|
|
66
|
+
There are a few mitigations to defer flushing to help prevent overflows:
|
|
67
|
+
|
|
68
|
+
* If the requested number of samples to read, peek, or seek is less than the number of unread samples in the circular buffer, then no flush is performed.
|
|
69
|
+
* Helper methods `peek_at(k, allow_flush=False)` (False is default), and `peek_last()` will retrieve the target sample from the buffer-OR-deque without flushing.
|
|
70
|
+
* Be cautious relying on repeated calls to `peek_at(k, allow_flush=False)` as it scans over the items in the deque which can be slow.
|
|
71
|
+
* When calling `read(n)`, if a flush is necessary, and it will cause an overflow, and the overflow could be prevented with a pre-emptive read up to `n`, then it will do the read in 2 parts. First it will call `peek(n_unread_in_buffer)` and `seek(n_unread_in_buffer)` to read the unread samples in the circular buffer. Second, it will call `peek(n_remaining)` and `seek(n_remaining)` to trigger a flush -- which should no longer cause an overflow -- then read the remaining requested samples and stitch them together.
|
|
72
|
+
|
|
73
|
+
### Advanced Pointer Manipulation
|
|
74
|
+
|
|
75
|
+
The previous section describes how `read`, `peek`, `seek`, and `peek_at` function in normal use cases. It is also possible to call `seek` with a negative value, which will attempt to move the tail pointer backwards over previously-read (or previously sought-over) data by that many samples. `seek` returns the number of samples that were actually moved, which may be less than the requested value if there was insufficient room. Negative seeks can only rewind into previously read data, and positive seeks can only advance into unread data, possibly including data that gets flushed from the deque.
|
|
76
|
+
|
|
77
|
+
## HybridAxisBuffer
|
|
78
|
+
|
|
79
|
+
The `HybridAxisBuffer` carries the semantics of the `HybridBuffer` but it is designed to handle either a `LinearAxis` or a `CoordinateAxis`. Its `write` method expects an axis object and its `peek` and `read` methods return an axis, not just the data.
|
|
80
|
+
|
|
81
|
+
For a `LinearAxis`, the `HybridAxisBuffer` simply maintains the `gain`, the `offset`, and the 'number of samples available'. Since this does not store actual data, it has no capacity. If this object is intended to be synchronized with another `HybridBuffer`-using object that does have a capacity, then the other object should be manipulated first and then the number of samples actually moved should be used to call the `HybridAxisBuffer`'s methods, otherwise these objects will be out of sync.
|
|
82
|
+
|
|
83
|
+
For a `CoordinateAxis`, the `HybridAxisBuffer` maintains the `data` in a `HybridBuffer` and thus behaves like a `HybridBuffer` with respect to the capacity. The returned `CoordinateAxis` object might have its `.data` field as a view on the data in the buffer, so it should not be modified in place.
|
|
84
|
+
|
|
85
|
+
## HybridAxisArrayBuffer
|
|
86
|
+
|
|
87
|
+
This is a convenience class that combines the `HybridAxisBuffer` and `HybridBuffer` into a single object that can be used to manage both axis and data in a single object. This class is particularly useful when you need to manage both the axis information and the data samples together, as is the case for an `AxisArray` object. Its `write` method expects an `AxisArary` object and its `peek` and `read` methods return an `AxisArray` object. Note that the return object's `.data` field might be a view on the data in the buffer so it should not be modified in place. Similarly so for the `CoordinateAxis` data.
|