Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →To design an IIR filter in SciPy, choose a filter family and frequency requirements, create the filter as second-order sections (SOS), apply it with a function suited to online or offline processing, and verify its measured frequency response. For most practical digital filters, output='sos' is the safer coefficient format than a single numerator-and-denominator polynomial.
Choose a design method from your requirements
SciPy’s scipy.signal module includes filter-design functions such as iirfilter, iirdesign, and family-specific functions such as butter. The choice depends on whether you already know the filter order or instead need to meet passband and stopband limits. See the SciPy iirdesign reference and the SciPy signal-processing tutorial.
As an Amazon Associate I earn from qualifying purchases.
Set an order and cutoff
Use a family function or iirfilter when you want to specify the family, filter type, order, and critical frequency or frequencies. For example, a low-pass Butterworth design can be created with butter. In that interface, Wn is the critical frequency at which the gain reaches 1/√2 of the passband gain, approximately −3 dB; it is not necessarily the edge of a flat passband.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Specify passband and stopband targets
Use iirdesign when you have passband and stopband edges and acceptable deviations for each. This is a specification-led approach: state what the filter must preserve and what it must attenuate, then inspect whether the resulting design achieves those targets. The SciPy tutorial’s elliptic low-pass example illustrates explicit ripple constraints and a trade between order and attenuation; that example is not a universal ranking of filter families.
#1 Best Overall
- the book is suitable for undergraduate and graduate courses and provides balanced coverage of both theory and practical applications.
- Digital Signal Processing, 4/e
Make frequency units explicit
The meaning of a digital cutoff depends on whether you pass fs. Without fs, SciPy interprets Wn on a normalized scale where 1 is the Nyquist frequency (half the sampling rate). When fs is supplied, Wn uses the same frequency units as fs. This distinction is documented in the SciPy butter reference.
For example, with samples taken at 1000 Hz, a 100 Hz cutoff is expressed directly as Wn=100, fs=1000. Omitting fs would require a normalized value instead: 100 Hz divided by the 500 Hz Nyquist frequency, or 0.2. Mixing those conventions can produce a valid filter that targets the wrong frequency.
Design in second-order sections
For general-purpose digital filtering, request SOS coefficients. A single transfer-function representation (ba) expresses the filter as high-degree numerator and denominator polynomials. At high orders or in narrow bands, converting roots into those polynomials can be sensitive to floating-point precision and may produce an unstable or incorrect filter. SciPy discusses this issue in the Butterworth design reference and recommends SOS-oriented functions in its filtering reference.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
A practical Butterworth example using frequencies in hertz is:
from scipy import signal
fs = 1000.0 # samples per second
sos = signal.butter(
N=4,
Wn=100.0,
btype="lowpass",
fs=fs,
output="sos",
)
This creates a fourth-order low-pass design with a 100 Hz critical frequency. The order and cutoff here are example choices, not values that suit every signal. SciPy can also return transfer-function coefficients (ba) or zeros, poles, and gain (zpk); SOS is a robust default, not a claim that it is optimal for every performance constraint. SOS can have some additional computational cost, so validate the implementation if processing speed is critical.
Apply the filter: one pass or forward and backward
Choose the filtering function based on whether the data are processed as they arrive or are available as a complete offline record. The two approaches have different phase and boundary behavior.
Rank #3
Online or causal processing with sosfilt
sosfilt applies the sections in one pass. This is the appropriate form when preserving causal, streaming behavior matters; the filter’s phase delay remains part of the output. For continuous streams, state handling across successive blocks matters: treating each block as a fresh signal can create discontinuities at block boundaries. Consult the SciPy sosfilt reference for the function’s state interface.
Offline processing with sosfiltfilt
sosfiltfilt filters forward and then backward, cancelling phase shift in the resulting offline signal. It is not a drop-in option for real-time causal processing: it requires future samples and edge handling. Forward-backward filtering also doubles the effective filter order, changing the magnitude response as well as the phase behavior. The SOS function exposes padding type and length to manage boundaries; consult its SciPy reference when choosing those settings. For most tasks, SciPy recommends this SOS form over filtfilt because second-order sections have fewer numerical problems.
Verify the realized frequency response
A successful design call only means SciPy produced coefficients; it does not prove those coefficients meet the application’s requirements. Inspect the response with tools such as freqz or freqz_sos, then compare the actual passband and stopband behavior to the targets. The SciPy freqz reference documents response analysis.
- Check passband flatness or allowed ripple where the signal should remain.
- Check stopband attenuation where interference or unwanted components should be reduced.
- Examine transition width and filter order against the constraints of the design.
- Consider phase behavior and whether one-pass or forward-backward processing fits the use case.
- Test boundary behavior on representative records, especially when using forward-backward filtering.
Keep the design requirements, chosen coefficient representation, filtering method, and response check together in code or documentation. That makes it easier to distinguish a frequency-unit mistake from a specification mismatch or an unsuitable processing mode.
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.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors




