smooth#

smooth(data, repeats=None, kernel=None, legacy=False)[source]#

Very simple function to smooth a 1D or 2D array.

See also sc.gauss1d() for simple Gaussian smoothing.

Parameters:
  • data (arr) – 1D or 2D array to smooth

  • repeats (int) – number of times to apply smoothing (by default, scale to be 1/5th the length of data)

  • kernel (arr) – the smoothing kernel to use (default: [0.25, 0.5, 0.25])

  • legacy (bool) – if True, use the old (pre-1.3.0) method of calculation that doesn’t correct for edge effects

Example:

data = pl.randn(5,5)
smoothdata = sc.smooth(data)

New in version 1.3.0: Fix edge effects.