What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
There is no single SciPy smoothing function for every dataset. For regularly sampled one-dimensional data, start with scipy.signal.savgol_filter when you want to retain local polynomial shape or calculate derivatives. For images and other multidimensional arrays, consider scipy.ndimage.gaussian_filter for scale-based blurring. For a curve that should balance closeness to observations with smoothness, use a smoothing spline from scipy.interpolate. The right choice depends on data geometry, the intended result, and how you want the method to behave at the edges.
Choose by data shape and goal
Smoothing can mean filtering measured values to reduce variation, fitting a curve that approximates noisy observations, or interpolating between known values. These are different operations: an interpolator generally passes through the supplied points, while a smoothing fit can trade exact agreement for a smoother result. SciPy’s interpolation tutorial distinguishes approaches by data structure and the smoothness you need: SciPy interpolation tutorial.
| Data and goal | Candidate | Key consideration |
|---|---|---|
| Regular one-dimensional samples; retain local shape or calculate derivatives | scipy.signal.savgol_filter |
Choose a window length and polynomial order; account for the filtered axis and edge mode. |
| Image or other multidimensional array; smooth at a chosen scale | scipy.ndimage.gaussian_filter |
Set a Gaussian standard deviation for each axis as needed, and select boundary handling deliberately. |
| One-dimensional observations; fit a smooth curve rather than apply a local moving filter | Smoothing spline in scipy.interpolate |
Choose how closely the fit should follow the observations; some routines offer generalized cross-validation. |
| Structured, unstructured, or scattered multidimensional data | An interpolation or fitting routine suited to the geometry | Decide whether the result should pass through samples or approximate them smoothly. |
These are selection criteria, not a ranking: the cited documentation does not establish a universal speed or accuracy winner. See the interpolation tutorial and the references for signal processing and scipy.signal.
Use Savitzky–Golay for one-dimensional local smoothing
savgol_filter fits a polynomial over a moving window and filters along one axis. For higher-rank input, set axis to the dimension containing the sequence; the other dimensions are handled as separate sequences. Its window_length is the number of samples in the window, and polyorder is the fitted polynomial degree. The order must be smaller than the window length.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
from scipy.signal import savgol_filter
smoothed = savgol_filter(values, window_length= nine, polyorder=2)
Replace nine with an integer, for example 9, to run this example. A larger window uses more neighboring samples in each fit; a higher polynomial order allows a more flexible local shape. Select them based on the scale of meaningful features and noise, then inspect whether the filtered result retains features you need. API details and valid parameter constraints are in the savgol_filter reference.
Derivatives and edges
The default deriv=0 returns the smoothed values. A positive deriv requests a derivative; set delta to the sample spacing if you want derivatives expressed in the corresponding physical units rather than per sample index. In the default mode='interp', the window length cannot exceed the number of values along the filtered axis. Other boundary modes change how edge samples are treated, so check edge behavior when endpoints inform your analysis. The API reference documents modes and derivative parameters.
Rank #2
Use a Gaussian filter for multidimensional arrays
scipy.ndimage.gaussian_filter smooths arrays using a Gaussian kernel and supports multidimensional input. Its sigma parameter is the standard deviation of that kernel. Supply a value per axis when dimensions have different scales or should be smoothed by different amounts; an isotropic choice is not automatically appropriate if axis units or sampling differ.
from scipy.ndimage import gaussian_filter
blurred = gaussian_filter(image, sigma=(1.2, 1.2), mode="reflect")
This example applies the same sigma to the two array axes and explicitly sets the boundary mode. Adjust the values to match the scale of detail you intend to suppress. With the default order=0, the operation is ordinary Gaussian smoothing; positive order values request Gaussian derivatives. Kernel support can be controlled with truncate or, where supported by the installed version, radius. Consult the gaussian_filter reference for parameter details.
Make boundary behavior explicit
The API’s default boundary mode is reflect, which extends values beyond the array edge by reflecting them. Other modes imply different assumptions about what lies outside the observed array. If values near an edge are important, choose a mode that fits the situation and compare the resulting edge behavior rather than treating boundary handling as incidental.
Fit a smoothing spline when you want a smooth curve
A smoothing spline is a fitting method, not a moving local filter: it constructs a curve that balances agreement with the observations against smoothness. SciPy’s scipy.interpolate facilities include one-dimensional smoothing splines, generalized cross-validation, knot-selection approaches, least-squares spline fitting, and two-dimensional smoothing surfaces. Select according to the geometry of the data and whether the curve should approximate observations or pass exactly through them. The SciPy interpolation tutorial describes these families and their trade-offs.
For make_smoothing_spline, the smoothness parameter controls the fit-versus-smoothness balance; generalized cross-validation can be used when that parameter is not supplied. Check the installed SciPy version’s documentation for the current function signature and behavior before building a workflow around a particular option.
Check sampling assumptions and numerical precision
Sampling geometry can rule out an otherwise attractive method. In its signal-processing tutorial, SciPy describes B-spline algorithms that assume equally spaced samples and mirror-symmetric boundary conditions. Those assumptions should not be silently applied to irregularly spaced observations; see the signal-processing tutorial.
Best Value
scipy.ndimage.spline_filter is a spline prefilter used in spline-interpolation workflows, not a generic noise-removal smoother. Its intermediate arrays use the output dtype, so limited-precision output can reduce accuracy. For precision-sensitive processing, use a sufficiently high-precision output type and follow the intended interpolation workflow; see the spline_filter reference and ndimage documentation.
A practical selection checklist
- Identify the geometry: Is the input a regularly sampled sequence, a multidimensional array, or scattered observations?
- Define the output: Do you want less local variation, scale-based blur, a fitted smooth curve, or values interpolated between samples?
- Set meaningful scales: Choose window length and polynomial degree for Savitzky–Golay, per-axis sigma for Gaussian filtering, or a fit-smoothness strategy for splines.
- Inspect edges: Make the boundary assumption explicit, especially when endpoint or border values affect conclusions.
- Verify version details: SciPy documentation signatures can vary by release; confirm options against the release installed in your environment.
No single method is best independent of these choices. The SciPy APIs cited here specify behavior and parameters, but they do not provide benchmark results establishing one approach as universally faster or more accurate.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




