libemd
libemd
is a library of functions for Python for computing the empirical mode
decomposition and it's variations.
libemd
is still in production, but is under active development.
Installation
pip install libemd
Usage
>>> from libemd import emd
>>> imfs = emd(x)
By default, libemd
uses the S-number stoppage criterion with an S-number
of 1. You can adjust this with the method
keyword argument.
libemd
uses the SciPy functions argrelmax
and argrelmin
for locating the
extrema in signals. You can override this with the peakfindermax
and
peakfindermin
keyword arguments, which both accept function objects that
accept a signal as their only argument and return the indices of extrema in a
numpy array.
You can also optionally specify a filter to apply to the signal before any peakfinding takes place. This filter is just used for peakfinding, and does not affect the signal during the decomposition.
Features
Algorithms
- EMD
- EEMD
- CEEMDAN
- MEMD
Stopping criteria
- Standard deviation
- S-number
- Threshold-based
Multivariate algorithms are the exception in this planned feature list, as they are still somewhat emerging.
Algorithms will, at first, be implemented in Python. On completion, algorithms
will also be implemented in Cython. Ultimately, libemd
will have a usage
analagous to the code block below, wherein the API for the Python and Cython
algorithms is identical, and they can be easily interchanged with import
statements.
try:
from libemd import cyemd as emd
except ImportError:
from libemd import emd
Tests
Tests are designed to utilise pytest. Test source code is organized in the following form:
# == Class/function testing
# -- pytest fixtures
def get_params_testA():
return {'params': [], 'ids': []}
@pytest.fixture(**get_params_testA())
def params_testA(request):
return request.get
# -- Tests
def test_A(params_testA):
"""
pytest unpacks params and param ids from fixture to use in test.
"""
pass