Skip to content

Commit f01639a

Browse files
committed
docs: use Furo Sphinx theme
1 parent a50dc88 commit f01639a

9 files changed

+177
-40
lines changed

docs/_static/logo-dark-mode.png

57.1 KB
Loading

docs/_static/logo.png

43.5 KB
Loading

docs/conf.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
# -- Project information -----------------------------------------------------
2020

2121
project = 'csaps'
22-
copyright = '2017-2025, Eugene Prilepin' # noqa
2322
author = 'Eugene Prilepin'
23+
copyright = f'2017-2025, {author}' # noqa
2424

2525

2626
def _get_version():
@@ -47,7 +47,9 @@ def _get_version():
4747
'm2r2',
4848
]
4949

50-
intersphinx_mapping = {'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None)}
50+
intersphinx_mapping = {
51+
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
52+
}
5153

5254
# Extension settings
5355
plot_apply_rcparams = True
@@ -69,7 +71,7 @@ def _get_version():
6971
from mpl_toolkits.mplot3d import Axes3D
7072
from csaps import csaps
7173
72-
plt.style.use('ggplot')
74+
plt.style.use('csaps.mplstyle')
7375
7476
def univariate_data(n=25, seed=1234):
7577
np.random.seed(seed)
@@ -95,23 +97,22 @@ def univariate_data(n=25, seed=1234):
9597

9698
# The theme to use for HTML and HTML Help pages. See the documentation for
9799
# a list of builtin themes.
98-
#
99-
html_theme = 'alabaster'
100+
html_theme = 'furo'
100101

101102
# Add any paths that contain custom static files (such as style sheets) here,
102103
# relative to this directory. They are copied after the builtin static files,
103104
# so a file named "default.css" will overwrite the builtin "default.css".
104105
html_static_path = ['_static']
105106

107+
pygments_style = 'tango'
108+
pygments_dark_style = 'stata-dark'
109+
106110
html_theme_options = {
107-
'fixed_sidebar': 'true',
108-
'show_powered_by': 'false',
109-
'description': 'Cubic spline approximation (smoothing)',
110-
'github_user': 'espdev',
111-
'github_repo': 'csaps',
112-
'github_type': 'star',
113-
'extra_nav_links': {
114-
'GitHub repository': 'https://github.com/espdev/csaps',
115-
'PyPI': 'https://pypi.org/project/csaps',
116-
},
111+
'light_logo': 'logo.png',
112+
'dark_logo': 'logo-dark-mode.png',
113+
'sidebar_hide_name': True,
114+
'source_repository': 'https://github.com/espdev/csaps',
115+
'source_branch': 'master',
116+
'source_directory': 'docs/',
117+
'top_of_page_buttons': ['view'],
117118
}

docs/csaps.mplstyle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# based on Matplotlib ggplot.mplstyle
2+
# https://github.com/matplotlib/matplotlib/blob/main/lib/matplotlib/mpl-data/stylelib/ggplot.mplstyle
3+
4+
patch.linewidth: 0.5
5+
patch.facecolor: 348ABD # blue
6+
patch.edgecolor: EEEEEE
7+
patch.antialiased: True
8+
9+
font.size: 10.0
10+
11+
axes.facecolor: none
12+
axes.edgecolor: none
13+
axes.linewidth: 1
14+
axes.grid: True
15+
axes.titlesize: x-large
16+
axes.labelsize: large
17+
axes.labelcolor: 555555
18+
axes.axisbelow: True # grid/ticks are below elements (e.g., lines, text)
19+
axes.titlecolor: 555555
20+
21+
axes.prop_cycle: cycler('color', ['E24A33', '348ABD', '988ED5', '777777', 'FBC15E', '8EBA42', 'FFB5B8'])
22+
# E24A33 : red
23+
# 348ABD : blue
24+
# 988ED5 : purple
25+
# 777777 : gray
26+
# FBC15E : yellow
27+
# 8EBA42 : green
28+
# FFB5B8 : pink
29+
30+
axes3d.grid: True
31+
axes3d.xaxis.panecolor: none
32+
axes3d.yaxis.panecolor: none
33+
axes3d.zaxis.panecolor: none
34+
35+
xtick.color: 555555
36+
xtick.direction: out
37+
38+
ytick.color: 555555
39+
ytick.direction: out
40+
41+
grid.color: C9C9C9
42+
grid.linestyle: - # solid line
43+
44+
legend.facecolor: none
45+
legend.edgecolor: none
46+
legend.labelcolor: 555555
47+
48+
figure.facecolor: white
49+
figure.edgecolor: 0.50

docs/formulation.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ It is an example plot of comparison ``csaps`` and ``scipy.UnivariateSpline`` (k=
8989
plt.plot(x, y, 'o')
9090
plt.plot(xi, yi_scipy, '-', label='scipy UnivariateSpline')
9191
plt.plot(xi, yi_csaps, '-', label='csaps')
92-
plt.legend()
92+
93+
plt.legend(bbox_to_anchor=(0, 1, 1, 0), loc="lower center", ncol=2)
9394

9495

9596
.. rubric:: Footnotes

docs/index.rst

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ csaps
55

66
CSAPS -- Cubic Spline Approximation (Smoothing)
77

8+
Version:
9+
|release|
10+
811
Overview
912
--------
1013

@@ -38,27 +41,37 @@ You can install and update csaps using pip:
3841
3942
pip install -U csaps
4043
44+
or using modern packaging tools like Poetry:
45+
46+
.. code-block:: bash
47+
48+
poetry add csaps
49+
50+
4151
The module depends only on NumPy and SciPy.
4252

4353
Python 3.10 or above is supported.
4454

45-
Content
46-
-------
47-
4855
.. toctree::
49-
:maxdepth: 2
56+
:caption: User Guide
57+
:hidden:
5058

5159
formulation
5260
tutorial
5361
internals
5462
benchmarks
55-
api
5663
changelog
5764

65+
.. toctree::
66+
:caption: API
67+
:hidden:
68+
69+
api
70+
genindex
5871

59-
Indices and Tables
60-
==================
72+
.. toctree::
73+
:caption: Project Links
74+
:hidden:
6175

62-
* :ref:`genindex`
63-
* :ref:`modindex`
64-
* :ref:`search`
76+
GitHub <https://github.com/espdev/csaps>
77+
PyPI <https://pypi.org/project/csaps>

docs/tutorial.rst

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The same weights vector and the same smoothing parameter will be used for all Y
122122
ax = fig.add_subplot(111, projection='3d')
123123
ax.set_facecolor('none')
124124
ax.plot(x, y, z, '.:')
125-
ax.plot(xi, yi, zi, '-')
125+
ax.plot(xi, yi, zi, '-', linewidth=2)
126126

127127

128128
N-D grid Smoothing
@@ -225,14 +225,11 @@ The example of auto smoothing univariate data:
225225
x, y = univariate_data()
226226
xi = np.linspace(x[0], x[-1], 51)
227227

228-
smoothing_result = csaps(x, y, xi)
229-
230-
yi = smoothing_result.values
231-
smooth = smoothing_result.smooth
228+
yi, smooth = csaps(x, y, xi)
232229

233230
plt.plot(x, y, 'o')
234-
plt.plot(xi, yi, '-', label=f'smooth={smooth:.3f}')
235-
plt.legend()
231+
plt.plot(xi, yi, '-', label=f'smooth={smooth:.4f}')
232+
plt.legend(bbox_to_anchor=(0, 1, 1, 0), loc="lower center")
236233

237234
In ND-gridded data case we can use auto smoothing for all dimensions or the particular dimensions:
238235

@@ -268,9 +265,9 @@ The following example demonstartes these two boundary cases:
268265
yi_1 = csaps(x, y, xi, smooth=1)
269266

270267
plt.plot(x, y, 'o:')
271-
plt.plot(xi, yi_0, '-', label='smooth=0')
272-
plt.plot(xi, yi_1, '-', label='smooth=1')
273-
plt.legend()
268+
plt.plot(xi, yi_0, '-', label='smooth=0.0')
269+
plt.plot(xi, yi_1, '-', label='smooth=1.0')
270+
plt.legend(bbox_to_anchor=(0, 1, 1, 0), loc="lower center", ncol=2)
274271

275272

276273
Weighted Smoothing
@@ -303,7 +300,7 @@ The example of weighted smoothing univariate data:
303300
plt.plot(x, y, 'o')
304301
plt.plot(xi, yi, '-', label='unweighted')
305302
plt.plot(xi, yi_w, '-', label='weighted')
306-
plt.legend()
303+
plt.legend(bbox_to_anchor=(0, 1, 1, 0), loc="lower center", ncol=2)
307304

308305
In n-d gridded data case we can use the same weights for all dimensions or different
309306
weights for each dimension.
@@ -377,6 +374,11 @@ Let's show it on a simple example.
377374
ax3.plot(x1, y, 'o', xi1, yi1_n, '-')
378375
ax4.plot(x2, y, 'o', xi2, yi2_n, '-')
379376

377+
ax1.set_title('normalizedsmooth=False')
378+
ax2.set_title('normalizedsmooth=False')
379+
ax3.set_title('normalizedsmooth=True')
380+
ax4.set_title('normalizedsmooth=True')
381+
380382

381383
Computing Spline Without Evaluating
382384
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -408,6 +410,9 @@ The example for univariate data:
408410
ax1.plot(x, y, 'o', xi1, yi1, '.-')
409411
ax2.plot(x, y, 'o', xi2, yi2, '.-')
410412

413+
ax1.set_title('20 evaluated points')
414+
ax2.set_title('50 evaluated points')
415+
411416

412417
.. _tutorial-analysis:
413418

poetry.lock

Lines changed: 69 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ scipy = [
5454
]
5555
sphinx = {version = "^7.1.2", optional = true}
5656
docutils = {version = "^0.20.0", optional = true}
57+
furo = {version = "^2024.8.6", optional = true}
5758
numpydoc = {version = "^1.6.0", optional = true}
5859
m2r2 = {version = "^0.3.2", optional = true}
5960
matplotlib = {version = "^3.7.4", optional = true}
@@ -71,7 +72,7 @@ poethepoet = "^0.33.1"
7172

7273

7374
[tool.poetry.extras]
74-
docs = ["sphinx", "docutils", "numpydoc", "m2r2", "matplotlib"]
75+
docs = ["sphinx", "docutils", "furo", "numpydoc", "m2r2", "matplotlib"]
7576

7677

7778
[build-system]

0 commit comments

Comments
 (0)