Algorithmcore
Range-Doppler algorithm
Also called RDA.
Focus SAR data by range compression, range cell migration correction in the range-Doppler domain and azimuth matched filtering by FFT.
- Solves
- SAR image formation
- Time
- O(M N (log(M N) + K)) worst
- Space
- O(M N) extra · data
- Where
- K = the number of taps of the interpolator; M = the number of pulses; N = the number of range samples per pulse
- Model
- Real RAM
- Properties
- deterministicnot exactlinear in dataiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- C. Wu, 1976
The range-Doppler algorithm (RDA) focuses stripmap synthetic aperture radar data with one-dimensional FFTs and one interpolation. It first compresses each pulse in range with the matched filter of the chirp. Then it takes an FFT along the track for every range bin, into the range-Doppler domain. There, all targets at one closest range follow one curve of range cell migration, so a range-varying interpolation straightens all of them together. Last, it multiplies each Doppler line by the azimuth matched filter of its range and takes the inverse FFT along the track. It is not the range-Doppler processing of pulse-Doppler radar, which estimates the range and the radial velocity of targets from a burst of pulses; the RDA forms an image.
In plain words
The raw data hold, for every pulse, a long smeared echo of every point. The first step sharpens each pulse along the range direction. The echo of one point still runs along the flight direction as a long, faint, slightly curved streak. Changing the flight direction into frequencies makes every point at one distance share the same curve, so one correction straightens them all. After that, a second sharpening along the flight direction, done with a quick transform, turns each streak into one bright spot.
The problem
The input is the raw data of pulses on a straight track at the speed , with the pulse repetition frequency PRF, and range samples per pulse at the rate . Sample is the slant range with . The pulse is a chirp with the FM rate , the carrier is with , and the beam has zero squint. A point at the along-track position and the closest range gives with . The page uses the Fourier sign of the DFT; radar books often use and so write the opposite signs. The output is the complex image on the same grid, with a peak of each target at the pulse closest to it and at the bin of , close to the SAR image formation matched filter value.
The algorithm
RDA(s, chirp, f_0, V, PRF, r_start, Δr) ▷ s[p][j]: pulse p, range bin j; returns the image- 1
for every pulse p: s_c[p] ← IDFT(DFT(s[p]) · conj(DFT(chirp))) ▷ range compression - 2
for every range bin j: S[·][j] ← DFT over p of s_c[·][j] ▷ to the range-Doppler domain - 3
for every Doppler bin k with |f_k| ≤ f_max: f ← f_k ▷ f_k wrapped to [-PRF/2, PRF/2) - 4
D ← sqrt(1 - (λ f / (2V))²) - 5
for every range bin j: R_0 ← r_start + j Δr; u ← (R_0 / D - r_start) / Δr - 6
v ← SINC-INTERP(S[k][·], u) ▷ RCMC - 7
K_a ← 2 V² f_0 D³ / (c R_0); H ← (PRF / sqrt(K_a)) e^{+i 4π f_0 R_0 D / c} - 8
I[k][j] ← v · H ▷ azimuth matched filter - 9
for every range bin j: image[·][j] ← IDFT over k of I[·][j]
Line L1 is pulse compression by fast convolution. It is circular, so the record must hold the whole chirp of every target. Line L2 moves to the range-Doppler domain. By the principle of stationary phase, Doppler frequency comes from the slow time at which the target is seen at the squint angle with sine , so its range there is . Lines L4 to L6 read the line of Doppler bin at that range, which is a range-varying shift; SINC-INTERP is an 8-tap Hann-weighted sinc interpolation. After L6, the energy of every target at is in bin of , whatever its along-track position. The azimuth phase there is plus a constant, so the factor of L7 cancels the first term, and the inverse DFT of L9 turns the linear phase that is left into a peak at . The gain of L7 makes the peak close to the brute-force matched filter value; is the azimuth FM rate at . The Doppler band of a beam with the half angle limits the loop of L3.
Example
The tests use MHz ( m), a chirp of MHz and 0.2 us sampled at MHz ( m), m/s and PRF Hz (a pulse every 1.25 m), pulses, range bins from 380 m, and a beam with . A target at m is in view for 81 pulses, and its migration at the edge of the beam is 3.16 m, about 2.5 bins. The Doppler band is Hz.
| target , amplitude | matched filter value | RDA peak / matched filter | without RCMC (L5 with ) |
|---|---|---|---|
| (0 m, 400 m), 1 | 1945 | 0.904 | 0.468 |
| (10 m, 410 m), 0.7 | 1394 | 0.904 | 0.461 |
Both peaks are at the predicted pixels (pulse 64 and bin 16 for the first). The ratio of the two peaks, each divided by its own ideal value, is 0.70, the ratio of the amplitudes. Both outputs carry the same constant phase of about degrees, close to the degrees of the stationary phase factor , which L7 does not remove. Along range, the neighbors of the peak at m are 0.29 and 0.26 of the peak; along the track they are 0.50 of the peak at m and 0.17 at m, as expected for the resolutions m and m. All numbers in this section are measurements on this simulation.
Correctness
Every step is linear in the data, so the image of a scene is the sum of the images of its points. For one point, the stationary phase approximation of the azimuth DFT gives the range-Doppler signal times a constant, with the compressed pulse . This is the key invariant: the migration curve depends on and only. With exact interpolation, L5 and L6 put the target in the bin of for every ; L7 cancels the phase that depends on except the linear term; and L9 gives a peak at of about times the number of pulses in view times the compressed pulse peak, which is the matched filter value. The result is exact only up to the stationary phase approximation, the interpolation and the coupling of range and azimuth, which this basic form ignores. The proofs are in proofs/correctness.md.
Proof: The range-Doppler algorithm is linear and, under the stationary phase approximation, focuses a point target at its position with the matched filter gainfull
We prove four facts about the RDA as written on the main page (lines L1 to L9) for the stripmap model with zero squint: a straight track at the speed , point targets, a constant speed of light , and the stop-and-go approximation. Theorem 1 is exact. Theorems 2 to 4 are statements about the continuous model under the principle of stationary phase, which is an asymptotic approximation that is good when the azimuth time-bandwidth product is large; they are not exact statements about the sampled data.
Setting. After range compression, a target of amplitude at the along-track position and the closest range gives
with the compressed pulse (peak at zero delay), the window of the beam, and the Fourier sign . Write , and .
Theorem 1 (linearity). The output of lines L1 to L9 is a linear function of the input . So the image of a sum of targets is the sum of their images.
Proof. L1, L2 and L9 are DFTs and products with a fixed sequence. L6 is a weighted sum of samples with weights that depend only on , and the geometry. L8 multiplies by a factor that does not depend on the data. A composition of linear maps is linear.
Theorem 2 (the range-Doppler signal). Under the stationary phase approximation, and treating the envelope and the window as slowly varying, the azimuth Fourier transform is
where is the value of at the stationary point.
Proof. The phase of the integrand is . Put . Then , which is zero when . Call this number ; then , so at the stationary point, and . The phase there is
because and . The second derivative is , and at the stationary point its size is . The stationary phase formula for gives the factor , and the envelope is evaluated at the range of the stationary point.
The range of the envelope depends on and only, not on . This is the invariant that lets one interpolation correct all targets at the same range.
Theorem 3 (migration correction). Assume that L6 interpolates the range-Doppler line exactly (a band-limited signal and an ideal interpolator). Then after L6 the value in the bin with at Doppler frequency is , which by Theorem 2 has the envelope value , its peak, for every .
Proof. L5 sets to the fractional bin of the range , and an exact interpolation returns the value of the line at that range. The delay argument of in Theorem 2 is then .
Without L5, that is with , the envelope is , smaller than the peak wherever the migration is a sizable part of the range resolution. This is the loss that the example measures.
Theorem 4 (azimuth compression and the peak). Under the assumptions of Theorems 2 and 3, with the DFT approximating times the integral and the pulses at , the image of the target is largest at the pulse with , and its value there is about , where is the number of pulses in the beam. For a chirp of samples of modulus 1, , so the value is times the energy of the echo, the matched filter value.
Proof. After L6 the value at Doppler bin (frequency ) is . L7 and L8 multiply by , which leaves . The inverse DFT of L9 at pulse is of this times , a sum of terms of one phase when , and of rotating phases otherwise. At , with on the beam band, close to its value at , and the spacing of the Doppler bins, the sum is about , where is the Doppler bandwidth of the beam. The target is in view for the time , which is , so the value is . The matched filter value of the target with itself is .
The constant is common to all targets, so ratios of complex amplitudes are kept. The example measures a common phase of about degrees and a peak of 0.90 of the matched filter value, the difference coming from the approximations above, the finite interpolator, and the coupling of range and azimuth that the basic RDA ignores.
Cost. L1 costs with an FFT, L2 and L9 cost , and L3 to L8 cost per Doppler bin and range bin, . The total is in the real-RAM model, with extra space for the range-Doppler array.
Complexity
Line L1 does DFTs of length , . Lines L2 and L9 do DFTs of length each, . Lines L3 to L8 run once per Doppler bin and range bin, with taps of interpolation and other work, . The total is in the real-RAM model with an FFT, and the extra space holds the range-Doppler array. With fixed, the cost is .
Properties
- Linear in the data, and shift-invariant along the track: a target moved by one pulse spacing moves its image by one pixel.
- Range-varying: L5 and L7 depend on the range bin, which is why the correction is done in the range-Doppler domain and not in the 2D frequency domain.
- The only interpolation is along range, in L6; it is the main cost besides the FFTs and the main source of error.
- The image keeps the phase of the targets up to one constant, so it can feed SAR interferometry.
Variants and improvements
- Secondary range compression (SRC). In the range-Doppler domain the range chirp has the FM rate of the range cell migration page, not . A second range filter for the difference, applied in the 2D frequency domain at one reference range or in the range-Doppler domain, restores the range focus at wide beams and high squint.
- Squint. With a nonzero Doppler centroid, the loop of L3 is centered on the centroid, and the centroid must be estimated from the data.
- Approximate RCMC. For small migrations, nearest neighbor or shorter interpolators in L6 save time with some loss.
- Doppler aliasing. When the PRF is close to the Doppler bandwidth, the frequencies of L3 must be unwrapped around the centroid.
- Autofocus. Errors of the motion leave a phase error along the track; phase gradient autofocus or map drift estimates it after L9.
When to use it
Use the RDA for stripmap data from a straight, steady track with a narrow beam and low squint, the usual case for satellites. It is simple, fast and easy to adapt to a range-varying Doppler centroid. For wide beams or high squint, the chirp scaling algorithm avoids the interpolation and includes SRC, and the omega-k algorithm is exact for the straight track. For curved tracks or very wide apertures, use backprojection. In the wide-beam test of the omega-k page (sine of the half beam angle 0.35, m), this basic RDA reaches 0.855 of the ideal peak, against 0.957 for omega-k (measurements).
Pitfalls
- Wrong RCMC sign or factor. L5 must read at , a range larger than . Reading at doubles the migration error instead of removing it.
- Unwrapped Doppler bins. DFT bin is the negative frequency . Using for all bins in L3 gives wrong and wrong filters for half of the band.
- Phase sign. With the echo phase , L7 must use . The wrong sign doubles the phase and leaves the target unfocused.
- Nearest neighbor in L6. Rounding to an integer leaves an error of up to half a bin, which lowers the peak and raises the side lobes; use a sinc interpolator with several taps.
- Targets near the end of the range window. The fast convolution of L1 is circular, so a chirp that runs past the last sample wraps around. Pad the range record by the length of the chirp, or keep targets inside the window.
- Wide beams without SRC. The basic form loses focus as the beam widens, as in the measurement above.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Shared helper of the imaging and inverse problems pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Small images and signals for the imaging and inverse problems pages.
Conventions:
- A signal is a list of numbers. An image is a list of rows, img[i][j], with
row i from the top and column j from the left.
- An n x n image covers the square [-1, 1]^2. The center of pixel (i, j) is
x_j = -1 + (2 j + 1) / n and y_i = 1 - (2 i + 1) / n, so y goes up.
- DFT: X_k = sum_j x_j exp(-2 pi i j k / n), unnormalized; the inverse has
the factor 1 / n. Index k stands for frequency k for k < n / 2 and k - n
otherwise. fftshift moves the zero frequency to position n // 2.
- Periodic convolution kernels are stored with their center at index 0
(wrapped around), so a delta kernel gives the identity and no shift.
"""
import cmath
import math
# ------------------------------------------------------------------ images
def new_image(n1, n2, value=0.0):
"""An n1 x n2 image (n1 rows, n2 columns) filled with value."""
return [[value] * n2 for _ in range(n1)]
def img_add(a, b):
"""The pixelwise sum a + b."""
return [[x + y for x, y in zip(ra, rb)] for ra, rb in zip(a, b)]
def img_scale(a, c):
"""The image c a."""
return [[c * x for x in row] for row in a]
def img_dot(a, b):
"""<a, b> = sum conj(a_ij) b_ij."""
return sum(x.conjugate() * y for ra, rb in zip(a, b) for x, y in zip(ra, rb))
def img_norm(a):
"""The Euclidean (Frobenius) norm of an image."""
return math.sqrt(sum(abs(x) ** 2 for row in a for x in row))
def flatten(img):
"""Row-major vector of an image."""
return [x for row in img for x in row]
def unflatten(v, n1, n2):
"""The n1 x n2 image of a row-major vector."""
return [list(v[i * n2:(i + 1) * n2]) for i in range(n1)]
# ------------------------------------------------------------------ DFT
def _is_pow2(n):
return n > 0 and n & (n - 1) == 0
def _fft_pow2(x):
"""Iterative radix-2 FFT, unnormalized forward transform."""
n = len(x)
a = [complex(v) for v in x]
j = 0
for i in range(1, n):
bit = n >> 1
while j & bit:
j ^= bit
bit >>= 1
j |= bit
if i < j:
a[i], a[j] = a[j], a[i]
size = 2
while size <= n:
half = size // 2
tw = [cmath.exp(-2j * math.pi * k / size) for k in range(half)]
for start in range(0, n, size):
for k in range(half):
u = a[start + k]
v = a[start + k + half] * tw[k]
a[start + k] = u + v
a[start + k + half] = u - v
size *= 2
return a
def dft(x):
"""X_k = sum_j x_j exp(-2 pi i j k / n). Radix-2 FFT when n is a power of 2."""
n = len(x)
if n == 0:
return []
if _is_pow2(n):
return _fft_pow2(x)
w = [cmath.exp(-2j * math.pi * t / n) for t in range(n)]
return [sum(x[j] * w[(j * k) % n] for j in range(n)) for k in range(n)]
def idft(xf):
"""x_j = (1/n) sum_k X_k exp(2 pi i j k / n)."""
n = len(xf)
if n == 0:
return []
y = dft([complex(v).conjugate() for v in xf])
return [v.conjugate() / n for v in y]
def _rows_then_cols(img, f):
rows = [f(row) for row in img]
cols = [f(list(col)) for col in zip(*rows)]
return [list(r) for r in zip(*cols)]
def dft2(img):
"""2D DFT: X_kl = sum_jq x_jq exp(-2 pi i (j k / n1 + q l / n2))."""
return _rows_then_cols(img, dft)
def idft2(img):
"""Inverse 2D DFT, with the factor 1 / (n1 n2)."""
return _rows_then_cols(img, idft)
def _shift1(x, s):
return list(x[s:]) + list(x[:s])
def fftshift(x):
"""Move the zero frequency to position n // 2 (1D, or both axes of an image)."""
if x and isinstance(x[0], (list, tuple)):
rows = [fftshift(r) for r in x]
return _shift1(rows, (len(rows) + 1) // 2)
return _shift1(x, (len(x) + 1) // 2)
def ifftshift(x):
"""The inverse of fftshift (1D, or both axes of an image)."""
if x and isinstance(x[0], (list, tuple)):
rows = [ifftshift(r) for r in x]
return _shift1(rows, len(rows) // 2)
return _shift1(x, len(x) // 2)
def circ_conv(x, h):
"""Periodic convolution y_i = sum_j h_j x_{(i - j) mod n}, kernel centered at index 0."""
n = len(x)
nz = [(j, hj) for j, hj in enumerate(h) if hj != 0]
return [sum(hj * x[(i - j) % n] for j, hj in nz) for i in range(n)]
def circ_conv2(img, h):
"""Periodic 2D convolution with the kernel h centered at index (0, 0)."""
n1, n2 = len(img), len(img[0])
nz = [(p, q, h[p][q]) for p in range(len(h)) for q in range(len(h[0])) if h[p][q] != 0]
out = new_image(n1, n2)
for i in range(n1):
for j in range(n2):
out[i][j] = sum(v * img[(i - p) % n1][(j - q) % n2] for p, q, v in nz)
return out
# ------------------------------------------------------------------ phantoms
def pixel_centers(n):
"""(xs, ys): xs[j] = -1 + (2 j + 1) / n and ys[i] = 1 - (2 i + 1) / n."""
xs = [-1.0 + (2 * j + 1) / n for j in range(n)]
ys = [1.0 - (2 * i + 1) / n for i in range(n)]
return xs, ys
# Rows: rho, A, B, x0, y0, phi (degrees). A is the semi-axis along the
# direction phi (counterclockwise from the x axis), B the other semi-axis.
# Geometry and densities of Shepp and Logan (1974), as reproduced in Kak and
# Slaney, Principles of Computerized Tomographic Imaging, Table 3.1. The value
# at the center (0, 0) is 2 - 0.98 = 1.02.
SHEPP_LOGAN = [
(2.0, 0.92, 0.69, 0.0, 0.0, 90.0),
(-0.98, 0.874, 0.6624, 0.0, -0.0184, 90.0),
(-0.02, 0.31, 0.11, 0.22, 0.0, 72.0),
(-0.02, 0.41, 0.16, -0.22, 0.0, 108.0),
(0.01, 0.25, 0.21, 0.0, 0.35, 90.0),
(0.01, 0.046, 0.046, 0.0, 0.1, 0.0),
(0.01, 0.046, 0.046, 0.0, -0.1, 0.0),
(0.01, 0.046, 0.023, -0.08, -0.605, 0.0),
(0.01, 0.023, 0.023, 0.0, -0.605, 0.0),
(0.01, 0.046, 0.023, 0.06, -0.605, 90.0),
]
# The same ellipses with the gray levels of Toft (1996), which give more
# contrast. The value at the center is 1 - 0.8 = 0.2.
MODIFIED_SHEPP_LOGAN = [
(rho, a, b, x0, y0, phi)
for rho, (_, a, b, x0, y0, phi) in zip(
(1.0, -0.8, -0.2, -0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1), SHEPP_LOGAN
)
]
def ellipse_value(x, y, table):
"""The phantom value at the point (x, y): the sum of rho over the ellipses that hold it."""
total = 0.0
for rho, a, b, x0, y0, phi in table:
c, s = math.cos(math.radians(phi)), math.sin(math.radians(phi))
dx, dy = x - x0, y - y0
u = dx * c + dy * s
v = -dx * s + dy * c
if (u / a) ** 2 + (v / b) ** 2 <= 1.0:
total += rho
return total
def ellipse_phantom(n, table):
"""The n x n image of an ellipse table, sampled at the pixel centers."""
xs, ys = pixel_centers(n)
return [[ellipse_value(x, y, table) for x in xs] for y in ys]
def disk_phantom(n, radius):
"""1 at pixel centers with x^2 + y^2 <= radius^2, 0 elsewhere."""
xs, ys = pixel_centers(n)
r2 = radius * radius
return [[1.0 if x * x + y * y <= r2 else 0.0 for x in xs] for y in ys]
def spikes_1d(n, positions, amplitudes):
"""A signal of length n with the given amplitudes at the given positions."""
out = [0.0] * n
for p, a in zip(positions, amplitudes):
out[p] += a
return out
# ------------------------------------------------------------------ projector
def parallel_beam_matrix(n, angles, nbins):
"""Pixel-driven discrete Radon transform of an n x n image on [-1, 1]^2.
Each pixel center (x, y) projects to s = x cos(theta) + y sin(theta). Its
value times the pixel area over the bin width is split linearly between
the two nearest bin centers. The bins cover [-sqrt(2), sqrt(2)]. Row
a * nbins + b holds angle a and bin b; column i * n + j holds pixel (i, j).
Returns the sparse rows, each a list of (column, weight) pairs.
Pixel-driven projection has a ripple: with a bin width close to the pixel
size, a disk projection is off by up to about 10 percent in some bins. A
bin of about twice the pixel size (nbins = 23 for n = 32) keeps it near
1 percent.
"""
xs, ys = pixel_centers(n)
smax = math.sqrt(2.0)
width = 2.0 * smax / nbins
scale = (2.0 / n) ** 2 / width
rows = []
for theta in angles:
c, s = math.cos(theta), math.sin(theta)
acc = [dict() for _ in range(nbins)]
for i, y in enumerate(ys):
for j, x in enumerate(xs):
t = (x * c + y * s + smax) / width - 0.5
b0 = math.floor(t)
frac = t - b0
col = i * n + j
for b, w in ((b0, 1.0 - frac), (b0 + 1, frac)):
if 0 <= b < nbins and w > 0.0:
acc[b][col] = acc[b].get(col, 0.0) + w * scale
rows.extend(sorted(d.items()) for d in acc)
return rows
def sp_matvec(rows, x):
"""y = A x for sparse rows of (column, weight) pairs."""
return [sum(w * x[c] for c, w in row) for row in rows]
def sp_rmatvec(rows, y, ncols):
"""x = A^H y for sparse rows of (column, weight) pairs and ncols columns."""
out = [0.0] * ncols
for row, yi in zip(rows, y):
if yi == 0:
continue
for c, w in row:
out[c] += w.conjugate() * yi
return out
# ------------------------------------------------------------------ noise
def gauss_noise(rng, shape, sigma):
"""Independent N(0, sigma^2) values: a list for an int shape, an image for (n1, n2)."""
if isinstance(shape, int):
return [rng.gauss(0.0, sigma) for _ in range(shape)]
n1, n2 = shape
return [[rng.gauss(0.0, sigma) for _ in range(n2)] for _ in range(n1)]
def _poisson_small(rng, lam):
"""Knuth's product method, exact for a mean lam <= 30."""
limit = math.exp(-lam)
k, p = 0, rng.random()
while p > limit:
k += 1
p *= rng.random()
return k
def poisson_sample(rng, lam):
"""An exact Poisson(lam) sample: a sum of Knuth samples with means at most 30."""
if lam < 0:
raise ValueError("negative mean")
total = 0
while lam > 30.0:
total += _poisson_small(rng, 30.0)
lam -= 30.0
if lam > 0.0:
total += _poisson_small(rng, lam)
return total
range_doppler_algorithm.py 136 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/range-doppler-algorithm/. The authors are listed in prov/76HEMZ.jsonl.
"""Range-Doppler algorithm (RDA) for stripmap SAR with zero squint.
Geometry: the radar moves along a straight line at the speed V and sends one
pulse at each slow time eta_p = (p - n_az / 2) / PRF, at the position
x_p = V eta_p. A point target at the along-track position x and the closest
range R0 has the range history R(eta) = sqrt(R0^2 + (x_p - x)^2). The radar
sees it only inside the beam: |x_p - x| / R <= beam (the sine of the half
beam angle).
Signals: complex baseband. The pulse is a linear FM chirp
p(t) = exp(i pi Kr (t - T/2)^2) for 0 <= t < T. The echo of a target of
amplitude a is a p(t - 2R/c) exp(-i 4 pi f0 R / c). The Fourier sign is
exp(-i 2 pi f t), the sign of the DFT. Range sample j of a pulse is the
two-way delay t_start + j / fs, that is the slant range r_start + j c / (2 fs).
Data layout: data[p][j], row p is a pulse (slow time), column j a range bin.
"""
import cmath
import math
from imgkit import dft, idft
C = 3.0e8
class Stripmap:
"""The parameters of a stripmap acquisition (SI units)."""
def __init__(self, f0=300e6, bandwidth=100e6, pulse_len=0.2e-6, fs=120e6,
v=100.0, prf=80.0, n_range=64, n_az=128, r_start=380.0, beam=0.125):
self.f0 = f0
self.bandwidth = bandwidth
self.pulse_len = pulse_len
self.fs = fs
self.v = v
self.prf = prf
self.n_range = n_range
self.n_az = n_az
self.r_start = r_start
self.beam = beam
self.kr = bandwidth / pulse_len
self.dr = C / (2.0 * fs)
def slant_range(self, j):
"""The slant range of range bin j (it may be fractional)."""
return self.r_start + j * self.dr
def x_pulse(self, p):
"""The along-track position of pulse p."""
return self.v * (p - self.n_az // 2) / self.prf
def doppler(self, k):
"""The Doppler frequency of DFT bin k: k PRF / n_az, wrapped to [-PRF/2, PRF/2)."""
kk = k if k < self.n_az // 2 else k - self.n_az
return kk * self.prf / self.n_az
def chirp(self, t):
"""The baseband pulse p(t)."""
if 0.0 <= t < self.pulse_len:
return cmath.exp(1j * math.pi * self.kr * (t - self.pulse_len / 2) ** 2)
return 0j
def simulate_raw(g, targets):
"""Raw echo data of point targets (x, R0, amplitude), exact hyperbolic range."""
t_start = 2.0 * g.r_start / C
data = []
for p in range(g.n_az):
xp = g.x_pulse(p)
row = [0j] * g.n_range
for (x, r0, amp) in targets:
r = math.hypot(r0, xp - x)
if abs(xp - x) > g.beam * r:
continue
tau = 2.0 * r / C
ph = amp * cmath.exp(-4j * math.pi * g.f0 * r / C)
for j in range(g.n_range):
row[j] += ph * g.chirp(t_start + j / g.fs - tau)
data.append(row)
return data
def range_compress(g, data):
"""Matched filter in range: multiply each pulse spectrum by conj(P) (circular)."""
ref = [g.chirp(j / g.fs) for j in range(g.n_range)]
h = [v.conjugate() for v in dft(ref)]
return [idft([a * b for a, b in zip(dft(row), h)]) for row in data]
def sinc_interp(row, u, taps=8):
"""Value of a sampled band-limited signal at the fractional index u (Hann-windowed sinc)."""
half = taps // 2
i0 = math.floor(u)
acc = 0j
for m in range(i0 - half + 1, i0 + half + 1):
if 0 <= m < len(row):
x = u - m
w = 1.0 if x == 0 else math.sin(math.pi * x) / (math.pi * x)
acc += row[m] * w * (0.5 + 0.5 * math.cos(math.pi * x / half))
return acc
def migration_factor(g, f):
"""D(f) = sqrt(1 - (c f / (2 V f0))^2), the cosine of the squint angle of Doppler f."""
return math.sqrt(1.0 - (C * f / (2.0 * g.v * g.f0)) ** 2)
def rda(g, data, rcmc=True):
"""Focus raw stripmap data. Returns the complex image img[p][j]."""
rc = range_compress(g, data) # @line L1
cols = [dft([rc[p][j] for p in range(g.n_az)]) for j in range(g.n_range)] # @line L2
f_max = 2.0 * g.v * g.beam * g.f0 / C # the Doppler band of the beam
out = [[0j] * g.n_az for _ in range(g.n_range)]
for k in range(g.n_az):
f = g.doppler(k) # @line L3
if abs(f) > f_max:
continue
d = migration_factor(g, f) # @line L4
line = [cols[j][k] for j in range(g.n_range)]
for j in range(g.n_range):
r0 = g.slant_range(j)
u = (r0 / d - g.r_start) / g.dr if rcmc else j # @line L5
val = sinc_interp(line, u) # @line L6
ka = 2.0 * g.v ** 2 * g.f0 * d ** 3 / (C * r0) # azimuth FM rate at f
h = (g.prf / math.sqrt(ka)) * cmath.exp(4j * math.pi * g.f0 * r0 * d / C) # @line L7
out[j][k] = val * h # @line L8
cols_img = [idft(col) for col in out] # @line L9
return [[cols_img[j][p] for j in range(g.n_range)] for p in range(g.n_az)]
def target_pixel(g, x, r0):
"""The (fractional) image position (p, j) where a target at (x, R0) focuses."""
return x * g.prf / g.v + g.n_az // 2, (r0 - g.r_start) / g.dr
test_range_doppler_algorithm.py 83 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/range-doppler-algorithm/. The authors are listed in prov/76HEMZ.jsonl.
import math
from range_doppler_algorithm import Stripmap, rda, simulate_raw, target_pixel
G = Stripmap()
TARGETS = [(0.0, 400.0, 1.0), (10.0, 410.0, 0.7)]
RAW = simulate_raw(G, TARGETS)
IMG = rda(G, RAW)
IMG_NO_RCMC = rda(G, RAW, rcmc=False)
def matched_filter(x, r0):
"""Brute force: correlate the raw data with the exact echo of a unit target at (x, r0)."""
ref = simulate_raw(G, [(x, r0, 1.0)])
return sum(a.conjugate() * b for ra, rb in zip(ref, RAW) for a, b in zip(ra, rb))
def ideal_gain(x, r0):
"""The matched filter output of a unit target on itself: chirp samples times pulses."""
ref = simulate_raw(G, [(x, r0, 1.0)])
return sum(abs(a) ** 2 for row in ref for a in row)
def local_peak(img, p0, j0, w=3):
return max((abs(img[p][j]), p, j) for p in range(p0 - w, p0 + w + 1) for j in range(j0 - w, j0 + w + 1))
def test_targets_focus_at_their_pixels() -> None:
for x, r0, _ in TARGETS:
p0, j0 = (round(v) for v in target_pixel(G, x, r0))
_, p, j = local_peak(IMG, p0, j0)
assert (p, j) == (p0, j0)
def test_peak_is_close_to_the_brute_force_matched_filter() -> None:
for x, r0, amp in TARGETS:
p0, j0 = (round(v) for v in target_pixel(G, x, r0))
brute = abs(matched_filter(x, r0))
assert abs(brute - amp * ideal_gain(x, r0)) < 0.02 * brute
got = abs(IMG[p0][j0])
assert 0.85 * brute < got < 1.05 * brute
def test_rcmc_is_needed() -> None:
p0, j0 = (round(v) for v in target_pixel(G, 0.0, 400.0))
with_rcmc = abs(IMG[p0][j0])
without = abs(IMG_NO_RCMC[p0][j0])
assert without < 0.7 * with_rcmc
def concentration(img):
total = sum(abs(v) ** 2 for row in img for v in row)
return abs(img[p0][j0]) ** 2 / total
assert concentration(IMG_NO_RCMC) < 0.5 * concentration(IMG)
def test_linear_in_the_data() -> None:
a = simulate_raw(G, [(0.0, 400.0, 1.0)])
b = simulate_raw(G, [(10.0, 410.0, 0.7)])
ia, ib = rda(G, a), rda(G, b)
for p in (60, 64, 72):
for j in (14, 16, 20):
assert abs(ia[p][j] + ib[p][j] - IMG[p][j]) < 1e-6 * abs(IMG[64][16])
def test_amplitude_ratio_is_kept() -> None:
a = abs(IMG[64][16]) / ideal_gain(0.0, 400.0)
p1, j1 = (round(v) for v in target_pixel(G, 10.0, 410.0))
b = abs(IMG[p1][j1]) / ideal_gain(10.0, 410.0)
assert abs(b / a - 0.7) < 0.05
def test_resolution_matches_c_over_2b() -> None:
"""The range impulse response falls to its first null near c / (2 B) = 1.5 m, 1.2 bins."""
row = [abs(v) for v in IMG[64]]
peak = row[16]
assert row[15] < 0.75 * peak and row[17] < 0.75 * peak
assert max(row[:13] + row[20:]) < 0.35 * peak
assert abs(G.dr * 1.2 - 3.0e8 / (2 * G.bandwidth)) < 1e-9
assert math.isclose(G.dr, 1.25)
History
Wu (1976) described a digital system to produce images from SAR data. The steps of this page, range compression, migration correction in the range-Doppler domain and azimuth compression by fast convolution, became the standard processor for spaceborne stripmap data; Cumming and Wong (2005, Chapter 6) describe it with SRC and its variants. Bamler (1992) compared it with the wavenumber domain algorithm and showed which approximations each makes. The chirp scaling algorithm (Raney et al. 1994) later removed its interpolation.
References
- Wu 1976, the digital processor with range compression and azimuth correlation (general locator; full text not seen)
- Ian G. Cumming and Frank H. Wong, Digital Processing of Synthetic Aperture Radar Data, Artech House, 2005, Chapter 6, The Range Doppler Algorithm, and Chapter 5, SAR Signal Properties
- Richard Bamler, A comparison of range-Doppler and wavenumber domain SAR focusing algorithms, IEEE Transactions on Geoscience and Remote Sensing 30(4), 1992, 706 to 713, the approximations of the range-Doppler algorithm against the wavenumber domain algorithm (general locator)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag 76HEMZ Edit this page History Report an error Markdown