Skip to main content

Diamondback DSP

Project description

https://img.shields.io/pypi/pyversions/diamondback.svg?color=steelblue https://img.shields.io/pypi/v/diamondback.svg?label=pypi&color=midnightblue https://img.shields.io/badge/admin-nox-orangered https://img.shields.io/badge/doc-sphinx-royalblue https://img.shields.io/badge/format-ruff-black https://img.shields.io/badge/lint-ruff-firebrick https://img.shields.io/badge/test-pytest-forestgreen https://img.shields.io/badge/type-mypy-royalblue https://img.shields.io/github/license/larryturner/diamondback?color=darkslategray

Description

diamondback Digital Signal Processing (DSP).

diamondback complements Artificial Intelligence (AI) frameworks, by defining components which filter, model, and transform data into forms which are useful in feature extraction and pattern recognition.

diamondback supports applications including cancellation, identification, optimization, probabilistic modeling, rate adaptation, and serialization.

Installation

diamondback is a public repository hosted at PyPI and GitHub.

pip install diamondback
pip install git+https://github.com/larryturner/diamondback.git
git clone https://github.com/larryturner/diamondback.git
cd diamondback
pip install .

Details

Data collections are consistently expressed in native types, including tuples, sets, lists, and dictionaries, with vector and matrix types expressed in numpy arrays. Complex or real types are supported as appropriate.

diamondback is defined in subpackages commons, filters, models, and transforms.

commons

  • Log formats and writes log entries with a specified level and stream using loguru. Log entries contain an ISO 8601 datetime and level. Log uses lazy initialization to coexist with loguru. Dynamic stream redirection and level specification are supported. Singleton.

  • RestClient defines a client for simple REST service requests using requests. An API and an elective dictionary of parameter strings are encoded to build a URL, elective binary or JSON data are defined in the body of a request, and a requests response containing JSON, text, or binary data is returned. Proxy, timeout, and URL definition are supported.

  • Serial encodes and decodes an instance to a Base-85 encoded serialized string with elective gzip compression, and generates SHA3-256 hash codes. Singleton.

filters

  • ComplexBandpassFilter adaptively extracts or rejects signals at a normalized frequency of interest, and may be employed to dynamically track magnitude and phase or demodulate signals.

  • ComplexExponentialFilter synthesizes a complex exponential signal at a normalized frequency of interest with contiguous phase.

  • ComplexFrequencyFilter adaptively discriminates and estimates a normalized frequency of a signal.

  • DerivativeFilter estimates discrete derivative approximations at several filter orders.

  • FirFilter realizes discrete difference equations of Finite Impulse Response (FIR) form. Instances are defined based on style, normalized frequency, order, cascade count, and complement, or forward coefficients. Root extraction, group delay, and frequency response evaluation are defined.

  • GoertzelFilter efficiently evaluates a Discrete Fourier Transform (DFT) at a normalized frequency, based on a window filter and normalized frequency.

  • IirFilter realizes discrete difference equations of Infinite Impulse Response (IIR) form. Instances are defined based on style, normalized frequency, order, cascade count, and complement, or recursive and forward coefficients. Root extraction, group delay, and frequency response evaluation are defined.

  • IntegralFilter estimates discrete integral approximations at several filter orders.

  • PidFilter realizes discrete difference equations of Proportional Integral Derivative (PID) form.

  • PolynomialRateFilter approximates a signal evaluated at an effective frequency equal to the product of the normalized frequency and a rate greater than zero, supporting decimation and interpolation through localized polynomial approximation with no group delay.

  • PolyphaseRateFilter approximates a signal evaluated at an effective frequency equal to the product of the normalized frequency and a rate greater than zero, supporting decimation and interpolation through definition and application of a polyphase filter bank, a sequence of low pass filters with a common frequency response and a fractional sample difference in group delay. An appropriate stride is determined to realize the specified effective frequency without bias and with group delay based on order.

  • RankFilter defines nonlinear morphological operators, which define behavior based on rank and order, including dilation, median, and erosion, and may be combined in sequences to support close and open.

  • WindowFilter realizes discrete window functions useful in Fourier analysis, based on style, order, and normalization.

models

  • DiversityModel selects and retains a state extracted to maximize the minimum distance between state members based on style and order. An opportunistic unsupervised learning model typically improves condition and numerical accuracy and reduces storage relative to alternative approaches including generalized linear inverse.

  • GaussianModel is a supervised learning probabilistic model which uses maximum likelihood estimation and regularization to maximize posterior probability and classify an incident signal. Learns one distribution instance per class.

  • GaussianMixtureModel is a semi-supervised learning probabilistic model which uses maximum likelihood estimation, regularization, and expectation maximization to maximize posterior probability and classify an incident signal. Learns distribution of a specified order per class, where intra-class models capture mixture distributions.

transforms

  • ComplexTransform converts a three-phase real signal to a complex signal, or a complex signal to a three-phase real signal, in equivalent and reversible representations, based on a neutral condition. Singleton.

  • FourierTransform converts a real or complex discrete-time signal to a complex discrete-frequency signal, or a complex discrete-frequency signal to a real or complex discrete-time signal, in equivalent and reversible representations, based on a window filter and inverse. Singleton.

  • PsdTransform realizes a Power Spectral Density (PSD) which converts a real or complex discrete-time signal to a real discrete-frequency signal which estimates an aggregate power spectrum of the signal, based on a window filter, index, and spectrogram. A spectrogram constructs a time frequency representation of the power spectrum. Singleton.

  • WaveletTransform realizes a temporal spatial frequency transformation through defninition and application of analysis and synthesis filters with complementary frequency responses, combined with downsampling and upsampling operations, in equivalent and reversible representations. Instances are defined based on style and order.

  • ZTransform converts continuous s-domain to discrete z-domain difference equations, based on a normalized frequency and application of bilinear or impulse invariant methods. Singleton.

Dependencies

diamondback depends upon external packages.

diamondback elective build, dependencies, docs, format, lint, notebook, tests, and typing behavior depends upon additional external packages.

diamondback dependency diagram.

https://larryturner.github.io/diamondback/dependencies.svg

Documentation

diamondback documentation is available on GitHub Pages.

Run a nox docs session to generate documentation.

nox -s docs

Notebook

A jupyter notebook defines cells to create and exercise diamondback components. The notebook serves as a tool for visualization, validation, and demonstration of diamondback capabilities.

Run a nox notebook session to exercise notebook. Restart kernel and run all cells, then exercise widgets.

nox -s notebook

Tests

A test solution is provided to exercise and verify components, pytest is used to execute unit and integration tests.

Run a nox tests session to exercise tests.

nox -s tests

License

BSD-3-Clause

Author

Larry Turner

Project details


Release history Release notifications | RSS feed

This version

6.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diamondback-6.0.2.tar.gz (38.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diamondback-6.0.2-py3-none-any.whl (55.8 kB view details)

Uploaded Python 3

File details

Details for the file diamondback-6.0.2.tar.gz.

File metadata

  • Download URL: diamondback-6.0.2.tar.gz
  • Upload date:
  • Size: 38.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for diamondback-6.0.2.tar.gz
Algorithm Hash digest
SHA256 8e24b246dccfc1ca7759d701206392f20776a4123467bf5fdc600564afd1b3e2
MD5 bb2ed5eaf5afe2902cd5ee3808ad2f51
BLAKE2b-256 04f0c74576a71f10951d6751ee733e926adc4dc1350be337701514b6cf562020

See more details on using hashes here.

File details

Details for the file diamondback-6.0.2-py3-none-any.whl.

File metadata

  • Download URL: diamondback-6.0.2-py3-none-any.whl
  • Upload date:
  • Size: 55.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for diamondback-6.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8272e7adddf431a0286e414305444adf230e6676c6038c74cdc0f3e3f164820d
MD5 0465a1e99f12b88df7859315267aee05
BLAKE2b-256 d43260c7b6def7a1c939c7f3f1800c788da2372421bfeb8070fc7896dde3b3a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page