Skip to main content
`Ctrl`+`K`
scipy.signal.

# gauss_spline

scipy.signal.gauss_spline(x, n)

  Gaussian approximation to B-spline basis function of order n.

  Parameters:
    x array_like

      a knot vector

    n int

      The order of the spline. Must be non-negative, i.e., n >= 0

  Returns:
    res ndarray

      B-spline basis function values approximated by a zero-mean Gaussian function.

  Notes

  The B-spline basis function can be approximated well by a zero-mean Gaussian function with standard-deviation equal to \(\sigma=(n+1)/12\) for large n :

  \[\frac{1}{\sqrt {2\pi\sigma^2}}exp(-\frac{x^2}{2\sigma})\]

  Array API Standard Support

  `gauss_spline` has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable `SCIPY_ARRAY_API=1` and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

  Library | CPU | GPU
  --- | --- | ---
  NumPy | ✅ | n/a
  CuPy | n/a | ✅
  PyTorch | ✅ | ✅
  JAX | ✅ | ✅
  Dask | ✅ | n/a

  > See Support for the array API standard for more information.

  References

  [1]

  Bouma H., Vilanova A., Bescos J.O., ter Haar Romeny B.M., Gerritsen F.A. (2007) Fast and Accurate Gaussian Derivatives Based on B-Splines. In: Sgallari F., Murli A., Paragios N. (eds) Scale Space and Variational Methods in Computer Vision. SSVM 2007. Lecture Notes in Computer Science, vol 4485. Springer, Berlin, Heidelberg.

  Examples

  We can calculate B-Spline basis functions approximated by a Gaussian distribution:

      >>> import numpy as np
      >>> from scipy.signal import gauss_spline
      >>> knots = np.array([-1.0, 0.0, -1.0])
      >>> gauss_spline(knots, 3)
      array([0.15418033, 0.6909883, 0.15418033])  # may vary