Skip to content

Commit 16b7522

Browse files
authored
Merge pull request #56 from espdev/update-docs
Update docs for normalizedsmooth option
2 parents a2318cb + 00508c1 commit 16b7522

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed

csaps/_shortcut.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ def csaps(xdata: Union[UnivariateDataType, NdGridDataType],
150150
If True, the smooth parameter is normalized such that results are invariant to xdata range
151151
and less sensitive to nonuniformity of weights and xdata clumping
152152
153+
.. versionadded:: 1.1.0
154+
153155
Returns
154156
-------
155157

csaps/_sspndg.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ class NdGridCubicSmoothingSpline(ISmoothingSpline[
197197
If True, the smooth parameter is normalized such that results are invariant to xdata range
198198
and less sensitive to nonuniformity of weights and xdata clumping
199199
200+
.. versionadded:: 1.1.0
201+
200202
"""
201203

202204
__module__ = 'csaps'

csaps/_sspumv.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ class CubicSmoothingSpline(ISmoothingSpline[
118118
normalizedsmooth : [*Optional*] bool
119119
If True, the smooth parameter is normalized such that results are invariant to xdata range
120120
and less sensitive to nonuniformity of weights and xdata clumping
121+
122+
.. versionadded:: 1.1.0
123+
121124
"""
122125

123126
__module__ = 'csaps'

docs/tutorial.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,40 @@ For example, the following code will raise ``ValueError`` without ``axis`` param
344344
``axis`` parameter is ignored in ND-gridded data cases.
345345

346346

347+
.. _tutorial-normalizedsmooth:
348+
349+
Smooth normalization
350+
~~~~~~~~~~~~~~~~~~~~
351+
352+
.. versionadded:: 1.1.0
353+
354+
We can use ``normalizedsmooth`` option to normalize smooth parameter.
355+
If ``normalizedsmooth`` is True, the smooth parameter is normalized such that results are invariant to xdata range
356+
and less sensitive to nonuniformity of weights and xdata clumping.
357+
358+
Let's show it on a simple example.
359+
360+
.. plot::
361+
362+
x1, y = univariate_data(seed=1327)
363+
x2 = x1 * 10
364+
365+
xi1 = np.linspace(x1[0], x1[-1], 150)
366+
xi2 = np.linspace(x2[0], x2[-1], 150)
367+
368+
yi1 = csaps(x1, y, xi1, smooth=0.8)
369+
yi2 = csaps(x2, y, xi2, smooth=0.8)
370+
371+
yi1_n = csaps(x1, y, xi1, smooth=0.8, normalizedsmooth=True)
372+
yi2_n = csaps(x2, y, xi2, smooth=0.8, normalizedsmooth=True)
373+
374+
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, figsize=(8, 6))
375+
ax1.plot(x1, y, 'o', xi1, yi1, '-')
376+
ax2.plot(x2, y, 'o', xi2, yi2, '-')
377+
ax3.plot(x1, y, 'o', xi1, yi1_n, '-')
378+
ax4.plot(x2, y, 'o', xi2, yi2_n, '-')
379+
380+
347381
Computing Spline Without Evaluating
348382
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349383

0 commit comments

Comments
 (0)