csaps

Cubic spline approximation (smoothing)

https://github.com/espdev/csaps

Science Score: 26.0%

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

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary

Keywords

approximation csaps cubic-splines python smooth smoothing smoothing-splines splines

Keywords from Contributors

serializer plagiarism-checker xunit-test xunit-framework actions yolov5 e2e-testing genomics embedded graph-generation
Last synced: 6 months ago · JSON representation

Repository

Cubic spline approximation (smoothing)

Basic Info
Statistics
  • Stars: 172
  • Watchers: 12
  • Forks: 31
  • Open Issues: 6
  • Releases: 14
Topics
approximation csaps cubic-splines python smooth smoothing smoothing-splines splines
Created over 8 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog License

README.md

csaps

PyPI version Supported Python versions GitHub Actions (Tests) Documentation Status Coverage Status License

csaps is a Python package for univariate, multivariate and n-dimensional grid data approximation using cubic smoothing splines. The package can be useful in practical engineering tasks for data approximation and smoothing.

Installing

Use pip for installing:

pip install -U csaps

or Poetry:

poetry add csaps

The module depends only on NumPy and SciPy. Python 3.10 or above is supported.

Simple Examples

Here is a couple of examples of smoothing data.

An univariate data smoothing:

```python import numpy as np import matplotlib.pyplot as plt

from csaps import csaps

np.random.seed(1234)

x = np.linspace(-5., 5., 25) y = np.exp(-(x/2.5)**2) + (np.random.rand(25) - 0.2) * 0.3 xs = np.linspace(x[0], x[-1], 150)

ys = csaps(x, y, xs, smooth=0.85)

plt.plot(x, y, 'o', xs, ys, '-') plt.show() ```

univariate

A surface data smoothing:

```python import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D

from csaps import csaps

np.random.seed(1234) xdata = [np.linspace(-3, 3, 41), np.linspace(-3.5, 3.5, 31)] i, j = np.meshgrid(xdata, indexing='ij') ydata = (3 * (1 - j)2. * np.exp(-(j2) - (i + 1)2) - 10 * (j / 5 - j3 - i5) * np.exp(-j2 - i2) - 1 / 3 * np.exp(-(j + 1)2 - i2)) ydata = ydata + (np.random.randn(ydata.shape) * 0.75)

ydata_s = csaps(xdata, ydata, xdata, smooth=0.988)

fig = plt.figure(figsize=(7, 4.5)) ax = fig.addsubplot(111, projection='3d') ax.setfacecolor('none') c = [s['color'] for s in plt.rcParams['axes.propcycle']] ax.plotwireframe(j, i, ydata, linewidths=0.5, color=c[0], alpha=0.5) ax.scatter(j, i, ydata, s=10, c=c[0], alpha=0.5) ax.plotsurface(j, i, ydatas, color=c[1], linewidth=0, alpha=1.0) ax.view_init(elev=9., azim=290)

plt.show() ```

surface

Documentation

More examples of usage and the full documentation can be found at https://csaps.readthedocs.io.

Development

We use Poetry to manage the project:

git clone https://github.com/espdev/csaps.git cd csaps poetry install -E docs

Also, install pre-commit hooks:

poetry run pre-commit install

Testing and Linting

We use pytest for testing and ruff/mypy for linting. Use poethepoet to run tests and linters:

poetry run poe test poetry run poe check

Algorithm and Implementation

csaps Python package is inspired by MATLAB CSAPS function that is an implementation of Fortran routine SMOOTH from PGS (originally written by Carl de Boor).

Also, the algothithm implementation in other languages:

  • csaps-rs Rust ndarray/sprs based implementation
  • csaps-cpp C++11 Eigen based implementation (incomplete)

References

C. de Boor, A Practical Guide to Splines, Springer-Verlag, 1978.

License

MIT

Owner

  • Login: espdev
  • Kind: user
  • Location: Lisbon

GitHub Events

Total
  • Release event: 3
  • Watch event: 9
  • Delete event: 19
  • Issue comment event: 5
  • Push event: 26
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Pull request event: 35
  • Fork event: 2
  • Create event: 21
Last Year
  • Release event: 3
  • Watch event: 9
  • Delete event: 19
  • Issue comment event: 5
  • Push event: 26
  • Pull request review event: 2
  • Pull request review comment event: 3
  • Pull request event: 35
  • Fork event: 2
  • Create event: 21

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 268
  • Total Committers: 4
  • Avg Commits per committer: 67.0
  • Development Distribution Score (DDS): 0.041
Past Year
  • Commits: 4
  • Committers: 2
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Eugene Prilepin e****e@g****m 257
dependabot[bot] 4****] 7
dependabot-preview[bot] 2****] 3
Shamus Husheer s****r 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 30
  • Total pull requests: 70
  • Average time to close issues: 2 months
  • Average time to close pull requests: 11 days
  • Total issue authors: 24
  • Total pull request authors: 5
  • Average comments per issue: 2.47
  • Average comments per pull request: 0.59
  • Merged pull requests: 60
  • Bot issues: 1
  • Bot pull requests: 21
Past Year
  • Issues: 0
  • Pull requests: 18
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 month
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.11
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • espdev (5)
  • shusheer (3)
  • BenMichell (1)
  • ZeroCool2u (1)
  • randomizedthinking (1)
  • Cram3r95 (1)
  • albertogomcas (1)
  • plasota (1)
  • dependabot-preview[bot] (1)
  • ryan-feeley (1)
  • welschma (1)
  • sroener (1)
  • nsankar (1)
  • aafkevandenberg (1)
  • jadeidev (1)
Pull Request Authors
  • espdev (62)
  • dependabot[bot] (22)
  • dependabot-preview[bot] (4)
  • shusheer (1)
Top Labels
Issue Labels
question (11) bug (5) help wanted (4) enhancement (3) wontfix (2) invalid (1) regression (1) performance (1) docs (1)
Pull Request Labels
dependencies (26) enhancement (3) docs (2) performance (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 36,956 last-month
  • Total dependent packages: 22
  • Total dependent repositories: 34
  • Total versions: 23
  • Total maintainers: 1
pypi.org: csaps

Cubic spline approximation (smoothing)

  • Versions: 23
  • Dependent Packages: 22
  • Dependent Repositories: 34
  • Downloads: 36,956 Last month
Rankings
Dependent packages count: 0.7%
Downloads: 2.4%
Dependent repos count: 2.5%
Average: 3.8%
Stargazers count: 5.9%
Forks count: 7.7%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/main.yaml actions
  • AndreMiras/coveralls-python-action develop composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
poetry.lock pypi
  • alabaster 0.7.13
  • babel 2.14.0
  • certifi 2023.11.17
  • charset-normalizer 3.3.2
  • colorama 0.4.6
  • contourpy 1.1.1
  • coverage 7.3.3
  • cycler 0.12.1
  • docutils 0.20.1
  • exceptiongroup 1.2.0
  • fonttools 4.46.0
  • idna 3.6
  • imagesize 1.4.1
  • importlib-metadata 7.0.0
  • importlib-resources 6.1.1
  • iniconfig 2.0.0
  • isort 5.13.2
  • jinja2 3.1.2
  • kiwisolver 1.4.5
  • m2r2 0.3.3.post2
  • markupsafe 2.1.3
  • matplotlib 3.7.4
  • mistune 0.8.4
  • mypy 1.7.1
  • mypy-extensions 1.0.0
  • numpy 1.24.4
  • numpy 1.26.2
  • numpydoc 1.6.0
  • packaging 23.2
  • pillow 10.2.0
  • platformdirs 4.1.0
  • pluggy 1.3.0
  • pygments 2.17.2
  • pyparsing 3.1.1
  • pytest 7.4.3
  • pytest-cov 4.1.0
  • python-dateutil 2.8.2
  • pytz 2023.3.post1
  • requests 2.31.0
  • ruff 0.1.8
  • scipy 1.10.1
  • scipy 1.11.4
  • setuptools 69.0.2
  • six 1.16.0
  • snowballstemmer 2.2.0
  • sphinx 7.1.2
  • sphinxcontrib-applehelp 1.0.4
  • sphinxcontrib-devhelp 1.0.2
  • sphinxcontrib-htmlhelp 2.0.1
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 1.0.3
  • sphinxcontrib-serializinghtml 1.1.5
  • tabulate 0.9.0
  • tomli 2.0.1
  • typing-extensions 4.9.0
  • urllib3 2.1.0
  • yapf 0.40.2
  • zipp 3.17.0
pyproject.toml pypi
  • isort ^5.13.2 develop
  • m2r2 ^0.3.2 develop
  • matplotlib ^3.7.4 develop
  • mypy ^1.7.1 develop
  • numpydoc ^1.6.0 develop
  • pytest ^7.4.3 develop
  • pytest-cov ^4.1.0 develop
  • ruff ^0.1.8 develop
  • setuptools ^69.0.2 develop
  • sphinx ^7.1.2 develop
  • yapf ^0.40.2 develop
  • numpy --- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: "*" python: "<3.12" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: ">=1.26.2" python: ">=3.12"
  • python >=3.8
  • scipy --- - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: "*" python: "<3.12" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess version: ">=1.11.4" python: ">=3.12"
  • typing-extensions *