.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/01_quick-start/01_02_spline_bases.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. or to run this example in your browser via JupyterLite or Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_01_quick-start_01_02_spline_bases.py: Spline bases ============ Plotting the spline bases of the library. .. GENERATED FROM PYTHON SOURCE LINES 13-17 Imports and Utilities --------------------- Define a helper function to visualize the spline bases. .. GENERATED FROM PYTHON SOURCE LINES 17-42 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from splineops.bases.utils import create_basis x_values = np.linspace(-3, 3, 1000) def plot_bases(names, x_values, title): plt.figure(figsize=(12, 6)) for name in names: if name == "keys": readable_name = "Keys Spline" else: name_parts = name.split("-") readable_name = f"{name_parts[0][:-1]} degree {name_parts[0][-1]}" y_values = create_basis(name).eval(x_values) plt.plot(x_values, y_values, label=readable_name) plt.title(title) plt.xlabel("x") plt.ylabel("y") plt.grid(True) plt.legend() plt.show() .. GENERATED FROM PYTHON SOURCE LINES 43-47 Plot B-Spline Bases ------------------- Plot B-spline basis functions for degree 0 to 9. .. GENERATED FROM PYTHON SOURCE LINES 47-54 .. code-block:: Python plot_bases( names=[f"bspline{i}" for i in range(10)], x_values=x_values, title="B-Spline Basis Functions: Degrees 0 to 9", ) .. image-sg:: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_001.png :alt: B-Spline Basis Functions: Degrees 0 to 9 :srcset: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 55-59 Plot OMOMS Bases ---------------- Plot OMOMS basis functions for degree 0 to 5. .. GENERATED FROM PYTHON SOURCE LINES 59-66 .. code-block:: Python plot_bases( names=[f"omoms{i}" for i in range(6)], x_values=x_values, title="OMOMS Basis Functions: Degrees 0 to 5", ) .. image-sg:: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_002.png :alt: OMOMS Basis Functions: Degrees 0 to 5 :srcset: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 67-71 Plot Keys Basis --------------- Plot the Keys basis function. .. GENERATED FROM PYTHON SOURCE LINES 71-76 .. code-block:: Python plot_bases( names=["keys"], x_values=x_values, title="Keys Basis Function", ) .. image-sg:: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_003.png :alt: Keys Basis Function :srcset: /auto_examples/01_quick-start/images/sphx_glr_01_02_spline_bases_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.281 seconds) .. _sphx_glr_download_auto_examples_01_quick-start_01_02_spline_bases.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/splineops/splineops.github.io/main?urlpath=lab/tree/notebooks_binder/auto_examples/01_quick-start/01_02_spline_bases.ipynb :alt: Launch binder :width: 150 px .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../lite/lab/index.html?path=auto_examples/01_quick-start/01_02_spline_bases.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01_02_spline_bases.ipynb <01_02_spline_bases.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01_02_spline_bases.py <01_02_spline_bases.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 01_02_spline_bases.zip <01_02_spline_bases.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_