algdiff

AlgDiff is a Python class implementing all necessary tools for the design, analysis, and discretization of algebraic differentiators. An interface to Matlab is also provided.

https://github.com/aothmane-control/algebraic-differentiators

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

fir-filters linear-filtering matlab numerical-differentiation numerical-methods orthogonal-polynomials python
Last synced: 6 months ago · JSON representation ·

Repository

AlgDiff is a Python class implementing all necessary tools for the design, analysis, and discretization of algebraic differentiators. An interface to Matlab is also provided.

Basic Info
  • Host: GitHub
  • Owner: aothmane-control
  • License: bsd-3-clause
  • Language: Jupyter Notebook
  • Default Branch: master
  • Homepage:
  • Size: 162 MB
Statistics
  • Stars: 16
  • Watchers: 4
  • Forks: 3
  • Open Issues: 0
  • Releases: 13
Topics
fir-filters linear-filtering matlab numerical-differentiation numerical-methods orthogonal-polynomials python
Created over 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog License Citation

README.md

PyPI version

AlgDiff

AlgDiff: A Python class that provides all necessary tools for the design, analysis, and discretization of algebraic differentiators. An interface to Matlab is also provided. This implementation was released as part of the survey [1]. A tutorial for algebraic differentiators and this package can be found in [6].

The toolbox is licensed under the BSD-3-Clause License, which is suitable for both academic and industrial/commercial purposes.

This code has been created for research purposes at the Chair of Systems Theory and Control Engineering of Saarland University, Germany. We apply algebraic differentiators to solve different problems related to control theory and signal processing: Parameter estimation, feedback control, fault detection and fault tolerant control, model-free control ...

Table of Contents

Motivation

Estimating the derivatives of noisy signals is of paramount importance in many fields of engineering and applied mathematics. It is, however, a longstanding ill-posed and challenging problem, in the sense that a small error in measurement data can induce a significant error in the estimated derivatives.

Figure 1 shows the results of the numerical estimation of the first time derivative of a noisy signal based on an algebraic differentiator on the one hand and the simple difference quotient rule on the other. This simulation shows the excellent performance of this numerical differentiation approach. | Motivation example | |:--:| | Figure 1. Numerical differentiation of a noisy signal using a simple difference quotient on the one hand and an algebraic differentiator on the other |

On algebraic differentiators

Algebraic differentiators have been derived and discussed in the systems and control theory community. The initial works based on differential-algebraic methods have been developed by Mboup, Join, and Fliess in [2]. These numerical, non-asymptotic approximation approaches for higher-order derivatives of noisy signals are well suited for real-time embedded systems. A historical overview and a detailed discussion of these differentiators and their time-domain and frequency-domain properties are given in the survey [1].

The approximation-theoretic derivation recalled in the survey [1] permits the interpretation of the estimation process by the following three steps illustrated in the figure below stemming from [1]:

  1. Projection: At time $t$, the sough $n$-th order time derivative $y^{(n)}$ over the interval $I{T}(t)$ is projected onto the space of polynomials of degree $\mathrm{N}$. This yields the polynomial $p\mathrm{N}$ depicted in the left and middle part of Figure 2.
  2. Evaluation: The polynomial $p\mathrm{N}$ is evaluated at $t-\deltat$, which gives an estimate ${\hat{y}^{(n)}(t)=p{N}(t-\deltat)}$ for the derivative $y^{(n)}(t)$ as depicted in the central part of Figure 2. Choosing the delay to be the largest root of a special Jacobi polynomial increases the approximation order by 1 with a minimal delay. Alternatively, a delay-free estimation or even a prediction of the future derivative might be selected, at the cost of a reduced accuracy.
  3. Repetition: The first two steps are repeated at each discrete time instant $t_i$ while keeping the parameters of the differentiator constant. This yields the estimate $\hat{y}^{(n)}$ depicted in the right part of the Figure 2.

| filter_characteristics | |:--:| | Figure 2. Three-step process of the estimation of the $n$-th order derivative ${y^{(n)}:t\mapsto y^{(n)}(t)}$ of a signal $y:t\mapsto y(t)$ using algebraic differentiators (figure from [1]) |

Algebraic differentiators can be interpreted as linear time-invariant filters with a finite-duration impulse response. Figure 3 visualizes the online estimation process of the first derivative of a noisy signal. The filter window, the buffered signal, and the filter kernel can be clearly seen.

| Animation Estimation| |:--:| | Figure 3. Visualization of the online estimation of the first derivative a noisy signal using an algebraic differentiator.|

These filters can be approximated as lowpass filters with a known cutoff frequency and a stopband slope. Figure 4 presents the amplitude and phase spectra of two exemplary filters. The lowpass approximation is also shown. | filter_characteristics | |:--:| | Figure 4. Amplitude and phase spectra of two different filters and the corresponding lowpass approximation of the amplitude spectrum |

See [1], [3], [4], and [5] for more details on the parametrization of these differentiators.

GUI

Since Version 1.1 a GUI is provided. Executable files for Linux and Windows operating systems are provided and do not require the installation of additional software. The binary files of the GUIs for different operating systems can be downloaded from the latest release page. Neither Python not Matlab have to be installed to start designing algebraic differentiators, get discrete filter coefficients, and estimate derivatives. This GUI can be used to plot relevant data (impulse and step responses, amplitude and phase spectra, estimated derivatives, ...), display relevant properties of the differentiators (estimation delay, cutoff frequency, window length, discretization effects, ...), and load measured signals for the estimation of their derivatives without a single line of code. Relevant properties, signals, spectra, and discrete filter coefficients can be exported for further processing. For testing the import of measurement data, a file has been provided in the folder DataForGUI.

| GUI | |:--:| | Figure 5. GUI for the interactive design, analysis, and use of algebraic differentiators |

Prerequisites for the implementation

The code is implemented in Python 3. To use all functionalities the required packages are given in the requirements.txt file. The examples implemented in Python are written in jupyter notebooks and require the packages jupyterlatexenvs for the generation of useful documentations and matplotlib for the creation of plots. The functions in the toolbox can also be used in Matlab for which different examples are also included. Check the Matlab documentation for more details on the compatibility of your Matlab version with Python.

Installation

To use AlgDiff using pip run the following in the command line:

$ pip install AlgDiff

How to use the implementation

The contribution of this implementation is an easy to use framework for the design and discretization of algebraic differentiators to achieve desired filter characteristics, i.e., to specify the cutoff frequency and the stopband slope. The file algebraicDifferentiator.py implements the class AlgebraicDifferentiator. This class contains all necessary functions for the design, analysis, and discretization of the differentiators.

Different examples are provided as jupyter notebooks and Matlab code in the following: * A quick start in a jupyter notebook available also as an HTML file * A detailed jupyter notebook available also as an HTML file * The simultaneous elimination of a harmonic disturbance and approximation of derivatives is demonstrated in the jupyter notebook available also as an HTML file * A quick start in Matlab * A Matlab code with several examples

Troubleshooting

A list of known issues and fixes is also provided.

Documentation

A detailed documentation for all the functions is also provided in the webpage of the project.

Questions & Contact

Feel free to contact A. Othmane in case of suggestions or questions via email by amine.othmane [at] uni-saarland [dot] de.

License

BSD 3-Clause "New" or "Revised" License, see License-file.

References

M. Mboup, C. Join, and M. Fliess, "Numerical differentiation with annihilators in noisy environment", Numerical Algorithms, 50 (4), 439–467, 2009, https://doi.org/10.1007/s11075-008-9236-1

M. Mboup and S. Riachy, "Frequency-domain analysis and tuning of the algebraic differentiators," Int. J. Control , 91 (9), 2073–2081, 2018, https://doi.org/10.1080/00207179.2017.1421776

A. Othmane and J. Rudolph "AlgDiff: an open source toolbox for the design, analysis and discretisation of algebraic differentiators", at - Automatisierungstechnik https://doi.org/10.1515/auto-2023-0035 https://arxiv.org/abs/2308.04888

Owner

  • Name: Amine Othmane
  • Login: aothmane-control
  • Kind: user
  • Company: Saarland University

Citation (CITATION.cff)

cff-version: 1.0.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Othmane"
  given-names: "Amine"
  orcid: "https://orcid.org/0000-0002-8871-3472"
title: "AlgDiff: A Python package with Matlab coupling implementing all necessary tools for the design, analysis, and discretization of algebraic differentiators."
version: 2.4
date-released: 2024-04-12
url: "https://github.com/aothmane-control/Algebraic-differentiators"

GitHub Events

Total
  • Watch event: 1
  • Push event: 1
Last Year
  • Watch event: 1
  • Push event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 90 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
  • Total maintainers: 1
pypi.org: algdiff

AlgDiff is a Python class implementing all necessary tools for the design, analysis, and discretization of algebraic differentiators. An interface to Matlab is also provided.

  • Homepage: https://github.com/aothmane-control/Algebraic-differentiators
  • Documentation: https://algdiff.readthedocs.io/
  • License: Copyright 2024 Amine Othmane Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  • Latest release: 2.2.1
    published over 2 years ago
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 90 Last month
Rankings
Dependent packages count: 7.6%
Downloads: 20.5%
Average: 32.5%
Dependent repos count: 69.4%
Maintainers (1)
Last synced: 6 months ago

Dependencies

docs/requirements.txt pypi
  • mpmath >=1.3.0
  • numpy >=1.24.3
  • scipy >=1.10.1
  • sphinx ==4.3.2
  • sphinx_rtd_theme ==1.2.2
pyproject.toml pypi
  • mpmath *
  • numpy *
  • scipy *
requirements.txt pypi
  • mpmath >=1.3.0
  • numpy >=1.24.3
  • scipy >=1.10.1
  • sphinx_rtd_theme ==1.2.2
setup.py pypi
  • mpmath *
  • numpy *
  • scipy *
  • sphinx_rtd_theme *