Diamondback DSP package.
Project description
Description
Diamondback is a package which provides Digital Signal Processing ( DSP ) solutions, and complements AI frameworks, by defining components which filter, model, and transform data.
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 also supports applications including cancellation, identification, optimization, probabilistic modeling, rate adaptation, and serialization.
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 singleton instance which formats and writes log entries with a specified level and stream using the loguru package. 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.
RestClient instances define a client for simple REST service requests using the requests package. 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 singleton instance which encodes and decodes an instance or collection in BSON or JSON, and generates SHA3-256 codes, using the jsonpickle package. An instance may be an object or a collection, referenced by abstract or concrete types, and the instance will be correctly encoded and decoded, without custom encoding definitions.
filters
ComplexBandPassFilter instances adaptively extract or reject signals at a normalized frequency of interest, and may be employed to dynamically track magnitude and phase or demodulate signals.
ComplexExponentialFilter instances synthesize complex exponential signals at normalized frequencies of interest with contiguous phase.
ComplexFrequencyFilter instances adaptively discriminate and estimate a normalized frequency of a signal.
DerivativeFilter instances estimate discrete derivative approximations at several filter orders.
FirFilter instances realize 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 instances efficiently evaluate a Discrete Fourier Transform ( DFT ) at a normalized frequency, based on a window filter and normalized frequency.
IirFilter instances realize 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 instances estimate discrete integral approximations at several filter orders.
PidFilter instances realize discrete difference equations of Proportional Integral Derivative ( PID ) form.
PolynomialRateFilter instances approximate 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 instances approximate 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 instances define nonlinear morphological operators, which define functionality based on rank and order, including dilation, median, and erosion, and may be combined in sequences to support close and open.
WindowFilter instances realize discrete window functions useful in Fourier analysis, based on style, order, and normalization.
models
DiversityModel instances select and retain 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 instance 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 instance which uses maximum likelihood estimation, regularization, and expectation maximization to maximize posterior probability and classify an incident signal. Learns model instances of a specified order per class, where intra-class models capture mixture distributions.
transforms
ComplexTransform is a singleton instance which 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.
FourierTransform is a singleton instance which 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.
PowerSpectrumTransform is a singleton instance which converts a real or complex discrete-time signal to a real discrete-frequency signal which estimates a mean power density of the signal, based on a window filter, index, and spectrogram. A spectrogram constructs a time frequency representation.
WaveletTransform instances realize 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 is a singleton instance which converts continuous s-domain to discrete z-domain difference equations, based on a normalized frequency and application of bilinear or impulse invariant methods.
Dependencies
Diamondback depends upon external packages :
Diamondback elective documentation, test, and visualization functionality depends upon additional external packages :
Installation
Diamondback is a public repository hosted at PyPI and GitHub.
pip install diamondback or pip install git+https://github.com/larryturner/diamondback.git
Demonstration
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.
A jupyter notebook may be run on a remote server without installation with Binder, which dynamically builds and deploys a docker container from a GitHub repository, or installed from GitHub and run on a local system. Binder may not be operational, as package dependencies on that service are dated.
Remote
Local
git clone https://github.com/larryturner/diamondback.git cd diamondback pip install --requirement requirements.txt jupyter notebook .\jupyter\diamondback.ipynb
Restart the kernel, as the first cell contains common definitions, find cells which exercise components of interest, and manipulate widgets to exercise and visualize functionality.
Tests
A test solution is provided to exercise and verify components, pytest is used to execute unit and integration tests.
pytest --capture=no --verbose
Documentation
Diamondback documentation is available on GitHub pages.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for diamondback-4.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8e866f61d1f1b0bb19a4598e1c7e1b9e6d6364a863f24ac015d327bd95edf7 |
|
MD5 | 5625b3906797b04d83cadf74d8044fcf |
|
BLAKE2b-256 | 58092c971a622b477bac3d32759883110cc6e82f90474032ab9a5ec06f1671d0 |