Derivative-based regularization smoothing for 1D signals on uniform and non-uniform grids
Project description
powersmooth
Python implementation of powersmooth (https://de.mathworks.com/matlabcentral/fileexchange/48799-powersmooth), invented by B. M. Friedrich.
This package provides derivative-based regularization smoothing for one-dimensional signals on uniform and non-uniform grids.
Mathematical Formulation
Given data points $ (x_i, y_i) $, the smoothed signal $ u $ is computed as the minimizer of
$$ \min_u ; | M (u - y) |2^2 ;+; \sum{k} w_k | D_k u |_2^2 $$
where:
- $ M $ is a diagonal mask matrix controlling data fidelity
- $ D_k $ is a finite-difference approximation of the $ k $-th derivative
- $ w_k \ge 0 $ are regularization weights
This allows explicit penalization of first, second, or third derivatives.
The method works on:
- Non-uniform grids
- Uniform grids
- Upsampled grids with masked original data points
Installation
From PyPI
pip install powersmooth
From GitHub
git clone https://github.com/Coolix99/powersmooth.git
cd powersmooth
pip install .
For development (editable install):
pip install -e .
Quick Example
import numpy as np
from powersmooth import powersmooth_general
# Generate noisy data
x = np.linspace(0, 10, 50)
y = np.sin(x) + 0.3 * np.random.randn(len(x))
# Penalize second derivative (curvature)
weights = {2: 1e-2}
y_smooth = powersmooth_general(x, y, weights)
Requirements
- Python ≥ 3.9
- NumPy
- SciPy
License
MIT 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powersmooth-0.1.1.tar.gz.
File metadata
- Download URL: powersmooth-0.1.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f7fe25f72a3e9a5b8a30e7681fa01669feeae3e9ec5be5e65c84395399a12b6
|
|
| MD5 |
5bb07692c5a75b5652d4af6b70010361
|
|
| BLAKE2b-256 |
3405223facaa19e7e7069e0ac38dcc38410e06fbf112e0d15fc1a0e19c3b2905
|
File details
Details for the file powersmooth-0.1.1-py3-none-any.whl.
File metadata
- Download URL: powersmooth-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8a0022aec6786e65dc43c40ed99c5bb8e37568053c2291179e190e84e20b76a
|
|
| MD5 |
fb6eb5a3248259133721449ef6ce39d9
|
|
| BLAKE2b-256 |
7457f8f38ff3a574fd2a2727d2ffc40c6b188fc1eab8389681cac9871bda49f3
|