Utilities for inspecting numeric data files and collecting metadata.
The package centres around the :class:~data_signal.Signal helper which
provides tools for estimating noise levels and assessing distributional
properties of 1‑D data.
Signal.noise_levels() implements three median–absolute–deviation based
estimators: first differences, second differences and a Haar wavelet detail
coefficient approach. The function returns absolute and relative noise levels
for each estimator.
from data_signal import Signal
# ``data`` is a 1-D sequence
sig = Signal(data)
print(sig.noise_levels())The figure below shows a noisy sine wave together with the estimated standard deviation from the first-difference method.
To determine whether a sample comes from a multimodal distribution the
Signal.multimodality method applies Hartigan's dip test and, only when the dip
test indicates possible multimodality, Silverman's critical bandwidth test.
Hartigan's test uses a bootstrap from the uniform distribution whereas the
Silverman test relies on a normal bootstrap; both return statistics and
p-values along with a boolean is_multimodal flag (Silverman's entry contains
NaNs when the test is skipped).
from data_signal import Signal
sig = Signal(data)
print(sig.multimodality(num_bootstrap=200))The example compares a unimodal normal sample with a clearly bimodal mixture;
multimodality correctly flags the latter as multimodal.
Install the project and its runtime dependencies with:
pip install .For development and running the test suite, include the optional test dependencies:
pip install .[test]Run unit tests with:
pytest