5.4.12 · D1Scientific Computing (Python)

Foundations — scipy.signal — filtering, convolution, FFT-based analysis

2,118 words10 min readBack to topic

Before you can read the parent note you must be able to see what each squiggle means. This page builds them one at a time, from nothing. No symbol is used until it has a plain-words meaning and a picture.


1. The signal — a row of dots

Forget curves for a moment. A signal, in the computer, is a finite list of numbers:

Why does the topic need this? Because a real-world thing (a sound, a heartbeat, a voltage) is continuous, but a computer can only store a finite number of snapshots. Every tool in scipy.signal operates on these snapshots — so we must agree that a signal = a numbered row of dots.

Figure — scipy.signal — filtering, convolution, FFT-based analysis

Look at the figure: each stem (vertical line with a dot on top) is one sample. Its horizontal position is the index ; its height is the value . There is nothing between the stems — that empty space is the whole reason we later worry about aliasing.


2. Sampling: turning seconds into slots — , ,

The dots did not appear by magic. We took snapshots at a steady rhythm.

So slot number happens at real time seconds. In the parent's code, t = np.arange(0, 1, 1/fs) is exactly this: it builds the list of real times up to second.

Figure — scipy.signal — filtering, convolution, FFT-based analysis

The figure shows the same dots as before, but now the axis is labelled in seconds. The index view and the time view are two rulers under one row of dots.


3. The pure wave — , , frequency , and

Signals are interesting because they are built from waves. The simplest wave is a sine.

Why the topic needs waves: the whole Fourier idea (Section 5) is that any signal is a sum of these pure waves. To measure "how much 50 Hz is in here", you must first know what a 50 Hz wave is.

Figure — scipy.signal — filtering, convolution, FFT-based analysis

The figure shows a slow wave (small ) and a fast wave (big ). Count the peaks in one second — that count is the frequency in Hz.

Recall Why is

inside and not just ? Question ::: What does the do in ? Answer ::: It converts "loops per second" into "radians per second". One loop = radians, so loops take radians of angle each second. Without it, would be measured in loops-per--seconds — a mess.


4. The kernel and the star

The parent's Section 1 hits you with and . Here is what they are.

Figure — scipy.signal — filtering, convolution, FFT-based analysis

The figure is the flip-and-slide picture that Section 1 assumes you can see: the flipped kernel (mint) sits over part of the signal (lavender); the shaded overlaps are the products being summed into one output dot (coral). Move the kernel one slot right and you get the next output dot. That, repeated, is the entire .


5. The complex probe wave — , ,

This is the scariest symbol in the parent note. We disassemble it.

Recall The DFT sum in words

Question ::: Say in plain English. Answer ::: "For probe frequency : multiply every sample by the matching point of a spinning arrow, add them all up. If the signal spins in step with the probe, the terms reinforce and is big; if not, they cancel and it's small."


6. Frequency bookkeeping — , , Nyquist

Once the FFT gives you , which real frequency does each belong to?


Prerequisite map

Signal as row of dots x n

Sampling rate fs and gap dt

Kernel h n

Pure wave sin 2 pi f t

Complex probe e to the minus i

DFT and FFT

Convolution slide and add

Frequency axis fk Nyquist

Filtering FIR IIR

Convolution theorem

scipy dot signal topic

Read it top-down: the dot idea feeds everything; sampling gives you time and frequency rulers; waves give you what the FFT looks for; the kernel plus sliding gives convolution and filtering; all rivers meet at the parent topic.


Equipment checklist

Cover the right side and test yourself. If any answer surprises you, re-read its section.

What does mean, and is time in seconds?
The value in slot of the signal; is a counting index (0,1,2…), NOT seconds.
Relate and .
— faster sampling means smaller gaps.
In , what is and what is the for?
= wiggles per second (Hz); converts loops-per-second into radians-per-second.
What operation does the star in denote?
Convolution — flip , slide, multiply overlaps, sum — NOT element-wise multiply.
What does instruct you to do, and does survive?
Add terms while runs over the integers; is a throwaway counter that vanishes from the answer.
What is and what does multiplying by it do geometrically?
; multiplying rotates a number 90° in the plane.
What shape does trace, and why complex not real?
A point spinning clockwise on the unit circle; complex packs amplitude AND phase into one number.
What does measure?
The length of the complex number = how much of frequency is present.
Give , , and .
; ; .
Why can't a real signal show frequencies above ?
Not enough dots per wiggle — faster waves masquerade as slower ones (aliasing).

Connections

  • Fourier Transform — the continuous parent of the DFT sum built here.
  • Aliasing and Sampling Theorem — the full story of Section 6's Nyquist limit.
  • Linear Time-Invariant Systems — where the kernel and convolution come from.
  • numpy.fft — the tool that computes from these ingredients.
  • Digital Filter Design — what to do with once you understand it.
  • Cross-correlation and Template Matching — convolution's un-flipped cousin.
  • Hinglish version →