Algorithmadvanced
Omega-k algorithm
Also called wavenumber domain algorithm, range migration algorithm.
Focus SAR data exactly in the 2D frequency domain by a reference function multiply and a Stolt change of variables.
- 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 Stolt 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
- Ciro Cafforio, Claudio Prati, Fabio Rocca, 1991
The omega-k algorithm, also called the wavenumber domain algorithm or the range migration algorithm, focuses synthetic aperture radar data from a straight track with a constant speed in the two-dimensional frequency domain. The name "range migration algorithm" means this algorithm; it should not be confused with range cell migration, the effect that every SAR focusing method must correct. After a 2D FFT, the phase of a point target is , where is the range wavenumber and the along-track wavenumber. A multiply by a reference function focuses the targets at one reference range exactly. The Stolt change of variables, an interpolation in range frequency, then makes the remaining phase linear for every range, and one 2D inverse FFT focuses the whole scene. It is the radar form of Stolt migration of seismic data, and for its geometry it makes no approximation beyond the stationary phase step.
In plain words
Each point on the ground leaves a curved, smeared trace in the radar data. Instead of tracing those curves one by one, the omega-k method looks at the data as a sum of waves. In that view, the blur of a point has a simple formula that depends only on the distance to the point. A first multiply removes the blur exactly for points at one chosen distance. For the other points, a stretch of the frequency axis, the same for every point, finishes the job. After the stretch, one inverse transform gives a sharp image of every point at once.
The problem
The input is the raw data of pulses on a straight track at the speed and the pulse rate PRF, with range samples at the rate from the two-way time , that is from the range with bins of . The pulse is a chirp of bandwidth , the carrier is , and the squint is zero. A target at gives with . The page uses the Fourier sign of the DFT; radar books often use and the opposite signs. For the range frequency and the Doppler frequency , write and . The output is the complex image on the grid, as for SAR image formation.
The algorithm
OMEGA-K(s, P, f_0, V, PRF, r_ref) ▷ s[p][j]: raw pulse p, range sample j; P = DFT(chirp)- 1
S ← 2D DFT of s ▷ range f_r (index q) and Doppler f_a (index k) - 2
S[k][q] ← S[k][q] · conj(P[q]) · e^{-i 2π f_r t_start} ▷ range compression, absolute time - 3
S[k][q] ← S[k][q] · G e^{+i r_ref sqrt(K² - k_x²)} ▷ reference function multiply - 4
T[k][q'] ← S[k][·] read at f_r = sqrt((f_0 + f_r')² + (c f_a / (2V))²) - f_0 ▷ Stolt mapping - 5
T[k][q'] ← T[k][q'] · e^{-i 2π f_r' · 2 (r_ref - r_start) / c} ▷ put r_ref at its bin - 6
I ← 2D IDFT of T - 7
image[p][j] ← I[p][j] · e^{+i 4π f_0 (r_start + j Δr - r_ref) / c} ▷ restore the carrier phase
Line L1 is a 2D FFT. Line L2 is pulse compression by the matched filter, and the factor refers the range phase to the time of transmission, so the phase of a target becomes . By stationary phase in , the 2D spectrum of the target is times a slowly varying amplitude. Line L3 multiplies by the conjugate phase of the reference range, with the gain of the azimuth compression. What is left is , which is still not linear in . Line L4 is the Stolt mapping: it defines a new range frequency by and reads the old spectrum at the matching by sinc interpolation, for . Now the phase is , linear in both frequencies. Line L5 adds the shift that makes the inverse DFT of L6 put each target at the bin of its and the pulse of its . Line L7 removes the constant that is left at each range.
Example
The tests use the geometry of the range-Doppler algorithm: MHz, MHz, us, MHz (bins of 1.25 m), m/s, PRF Hz, , from 380 m, a beam with the sine of the half angle 0.125, and in the middle of the window. Three targets with complex amplitudes give, at their predicted pixels:
| target , amplitude | peak / matched filter | phase of peak / amplitude |
|---|---|---|
| (0 m, 400 m), 1 | 0.924 | degrees |
| (10 m, 410 m), | 0.911 | degrees |
| (-12.5 m, 425 m), | 0.906 | degrees |
The common phase of about degrees is the of the azimuth stationary phase, so the ratios of complex amplitudes are kept, within 0.06 in the tests. With a wide beam (sine of the half angle 0.35, PRF Hz, , window from 80 m) and m, a target at m reaches 0.957 of its ideal peak. With L4 skipped, that is with the reference multiply alone, it reaches only 0.213, while a target at is focused the same with or without L4. In the same wide case the basic range-Doppler algorithm reaches 0.855. These values are measurements on these simulations.
Correctness
The algorithm is linear. In the 2D frequency domain, by stationary phase in the slow time, a target has the phase ; this is the only approximation, and it uses no expansion of the square root in range frequency or Doppler, unlike the range-Doppler algorithm. The reference multiply leaves , and the Stolt mapping makes the new range wavenumber, so the phase becomes linear in both new frequencies for every at once. An inverse DFT of a linear phase is a peak at the right place. So the algorithm is exact for a straight track at a constant speed, up to the stationary phase step and the interpolation of L4. The proofs are in proofs/correctness.md.
Proof: After the reference multiply and the Stolt mapping, the phase of every target is linear in both frequencies, so one inverse DFT focuses all rangesfull
We prove three facts about the omega-k algorithm as written on the main page (lines L1 to L7), for a straight track at the constant speed , zero squint, point targets and the stop-and-go approximation. Theorem 1 is exact. Theorem 2 rests on the principle of stationary phase in the slow time, an asymptotic approximation; it uses no other approximation. Theorem 3 is exact given Theorem 2 and an exact interpolation in L4.
Setting. A target of amplitude at gives the raw signal with , where is the absolute two-way time and the baseband pulse with spectrum . The Fourier sign is . For the range frequency and the Doppler frequency put and , and assume on the band.
Theorem 1 (linearity). The output of L1 to L7 is linear in the data.
Proof. L1 and L6 are DFTs; L2, L3, L5 and L7 are products with fixed functions; L4 is a weighted sum of samples with weights fixed by the geometry.
Theorem 2 (the 2D spectrum). After L2, the range Fourier transform of the target at is , and under stationary phase in its Fourier transform in is
with a positive amplitude that varies slowly and does not depend on .
Proof. The range Fourier transform of is . The DFT of the record measures time from , so it gives , and the factor of L2 restores . With and the carrier, the phase is , and turns into . In , the phase is that of the range-Doppler proof with replaced by . With , , so the stationary point has : the sine of the squint angle is . The value there is , because at that point, and , and the term remains. The second derivative is negative, which gives and an amplitude that depends on , , only.
Theorem 3 (focus of every range). Assume Theorem 2 and an exact interpolation in L4. After L3 to L5, the spectrum of the target, as a function of the new range frequency with and of , is
with slowly varying. So the 2D inverse DFT of L6 has its peak at the range bin and at the pulse of , and after L7 the phase of the peak is plus the phase of , the same for every target.
Proof. L3 multiplies by , which leaves . L4 evaluates the spectrum at the for which ; squaring, , which is the formula of L4. So the phase becomes . L5 adds , so the linear term becomes . A linear phase over a band has an inverse DFT that peaks at the delay ; here the delays are , which is bin at the sample rate , and in slow time. At that bin, L7 multiplies by , which cancels the constant phase.
No step used an expansion of , so the result holds for wide beams and for any , which is the sense in which the algorithm is exact for its geometry. The errors that remain are those of the stationary phase step, the band edges where the Stolt mapping reads outside the recorded band, and the interpolation of L4. The example measures a common phase near degrees, in line with the factor .
Cost. L1 and L6 cost with an FFT, L2, L3, L5 and L7 cost , and L4 costs per output sample, so the total is in the real-RAM model, with extra space.
Complexity
Lines L1 and L6 are 2D FFTs of samples, . Lines L2, L3, L5 and L7 cost per sample. Line L4 costs per output sample with a -tap interpolator. The total is in the real-RAM model, with extra space.
Properties
- Linear in the data.
- Exact for the hyperbolic range history of a straight track at constant speed, including wide beams, high squint and long apertures, up to stationary phase and interpolation.
- Range-invariant: every operation is in the 2D frequency domain, so it cannot follow a speed or a geometry that changes with range, such as the curved orbit of a satellite. Variants handle that approximately.
- The only interpolation is the 1D Stolt mapping along range frequency.
Variants and improvements
- Approximate Stolt mapping. Replace L4 by a phase multiply that is exact at the reference range and a range-varying correction later, which gives an algorithm close to the chirp scaling algorithm.
- Spotlight data. For dechirped spotlight data the same mapping applies after the deramp; Carrara, Goodman and Majewski call it the range migration algorithm. The polar format algorithm uses a polar instead of a Stolt resampling.
- Seismic and ultrasonic imaging. With the exploding reflector model, the same mapping is Stolt migration, and in ultrasound it is the frequency domain form of the synthetic aperture focusing technique.
- Satellite orbits. An effective speed that changes with range is handled by range blocks or by extra correction terms.
When to use it
Use omega-k for straight-track data with wide beams, high squint or long apertures, where the approximations of the range-Doppler algorithm fail, as in low-frequency and airborne systems with wide beams. It needs an interpolation, which the chirp scaling algorithm avoids, but it makes fewer approximations. For curved tracks or a speed that varies, use backprojection.
Pitfalls
- Missing time reference. Without the factor in L2, the phase is relative to the start of the record, not to the transmission, and L3 no longer matches.
- Interpolating in the wrong order. The spectrum must be in increasing frequency order (after an fftshift) before L4 reads it at fractional positions; the wrapped DFT order puts the band edges next to each other.
- Reading outside the band. For large the Stolt mapping asks for frequencies above the band; L4 must restrict to and leave the rest zero.
- Targets near the ends of the range window. The 2D FFT is circular, so a chirp that runs past the last sample wraps. In the tests a target at 385 m, near the start of the window, measured only 0.75 of its ideal peak.
- The carrier phase. Without L7, the phase of each target varies with ; the modulus is right, but interferometry fails.
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
omega_k_algorithm.py 161 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/omega-k-algorithm/. The authors are listed in prov/R4DMS8.jsonl.
"""Omega-k (wavenumber domain) algorithm 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.
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 is the two-way delay
t_start + j / fs, that is the slant range r_start + j c / (2 fs).
In the two-dimensional frequency domain, with K = 4 pi (f0 + fr) / c and
kx = 2 pi f_eta / V, a target has the phase -R0 sqrt(K^2 - kx^2) - kx x
(stationary phase). The Stolt mapping makes this phase linear in the new
range frequency, so one 2D inverse DFT focuses every range at once.
Data layout: data[p][j], row p a pulse, column j a range bin.
"""
import cmath
import math
from imgkit import dft, fftshift, 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):
return self.r_start + j * self.dr
def x_pulse(self, p):
return self.v * (p - self.n_az // 2) / self.prf
def doppler(self, k):
"""The Doppler frequency of azimuth DFT bin k, 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 range_freq(self, q):
"""The baseband range frequency of range DFT bin q, wrapped to [-fs/2, fs/2)."""
qq = q if q < self.n_range // 2 else q - self.n_range
return qq * self.fs / self.n_range
def chirp(self, 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 sinc_interp(seq, u, taps=8):
"""Value of a sampled band-limited sequence 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(seq):
x = u - m
w = 1.0 if x == 0 else math.sin(math.pi * x) / (math.pi * x)
acc += seq[m] * w * (0.5 + 0.5 * math.cos(math.pi * x / half))
return acc
def omega_k(g, data, r_ref=None, stolt=True):
"""Focus raw stripmap data. Returns the complex image img[p][j].
With stolt=False the Stolt interpolation is skipped, so only the
reference range r_ref is focused exactly (the bulk compression alone).
"""
if r_ref is None:
r_ref = g.slant_range(g.n_range / 2)
n, m = g.n_range, g.n_az
t_start = 2.0 * g.r_start / C
ref = [g.chirp(j / g.fs) for j in range(n)]
pconj = [v.conjugate() for v in dft(ref)]
rows = []
for p in range(m):
spec = dft(data[p]) # @line L1
rows.append([spec[q] * pconj[q] * cmath.exp(-2j * math.pi * g.range_freq(q) * t_start)
for q in range(n)]) # @line L2
cols = [dft([rows[p][q] for p in range(m)]) for q in range(n)] # @line L1
f_max = 2.0 * g.v * g.beam * g.f0 / C
half_band = g.bandwidth / 2.0
out = [[0j] * n for _ in range(m)]
for k in range(m):
fa = g.doppler(k)
if abs(fa) > f_max:
continue
kx = 2.0 * math.pi * fa / g.v
d3 = (1.0 - (C * fa / (2.0 * g.v * g.f0)) ** 2) ** 1.5
gain = g.prf * math.sqrt(C * r_ref / (2.0 * g.v ** 2 * g.f0 * d3))
line = []
for q in range(n):
kk = 4.0 * math.pi * (g.f0 + g.range_freq(q)) / C
ky = math.sqrt(max(kk * kk - kx * kx, 0.0))
line.append(cols[q][k] * gain * cmath.exp(1j * r_ref * ky)) # @line L3
shifted = fftshift(line) # increasing frequency, zero at index n // 2
for q in range(n):
fr2 = g.range_freq(q)
if abs(fr2) > half_band:
continue
if stolt:
fr = math.sqrt((g.f0 + fr2) ** 2 + (C * fa / (2.0 * g.v)) ** 2) - g.f0 # @line L4
else:
fr = fr2
val = sinc_interp(shifted, fr * n / g.fs + n // 2) # @line L4
delay = 2.0 * (r_ref - g.r_start) / C
out[k][q] = val * cmath.exp(-2j * math.pi * fr2 * delay) # @line L5
rows2 = [idft(out[k]) for k in range(m)] # @line L6
cols2 = [idft([rows2[k][j] for k in range(m)]) for j in range(n)] # @line L6
img = [[0j] * n for _ in range(m)]
for j in range(n):
fix = cmath.exp(4j * math.pi * g.f0 * (g.slant_range(j) - r_ref) / C) # @line L7
for p in range(m):
img[p][j] = cols2[j][p] * fix
return img
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_omega_k_algorithm.py 80 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/omega-k-algorithm/. The authors are listed in prov/R4DMS8.jsonl.
from omega_k_algorithm import Stripmap, omega_k, simulate_raw, target_pixel
G = Stripmap()
TARGETS = [(0.0, 400.0, 1.0), (10.0, 410.0, 0.6j), (-12.5, 425.0, -0.5)]
RAW = simulate_raw(G, TARGETS)
IMG = omega_k(G, RAW)
WIDE = Stripmap(beam=0.35, prf=200.0, n_az=256, r_start=80.0)
def matched_filter(g, raw, 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(g, x, r0):
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 pixel(g, x, r0):
return tuple(round(v) for v in target_pixel(g, x, r0))
def test_targets_focus_at_their_pixels() -> None:
for x, r0, _ in TARGETS:
p0, j0 = pixel(G, x, r0)
assert local_peak(IMG, p0, j0)[1:] == (p0, j0)
def test_peak_is_close_to_the_brute_force_matched_filter() -> None:
for x, r0, amp in TARGETS:
p0, j0 = pixel(G, x, r0)
brute = abs(matched_filter(G, RAW, x, r0))
assert abs(brute - abs(amp) * ideal_gain(G, x, r0)) < 0.03 * brute
assert 0.85 * brute < abs(IMG[p0][j0]) < 1.05 * brute
def test_complex_amplitudes_are_kept() -> None:
"""The image keeps the ratio of the complex reflectivities, phase included."""
ref_val = IMG[64][16] / ideal_gain(G, 0.0, 400.0)
for x, r0, amp in TARGETS[1:]:
p0, j0 = pixel(G, x, r0)
ratio = (IMG[p0][j0] / ideal_gain(G, x, r0)) / ref_val
assert abs(ratio - amp) < 0.06
def test_stolt_mapping_focuses_far_from_the_reference_range() -> None:
"""Wide beam: bulk compression alone defocuses a target 24 m from r_ref; Stolt fixes it."""
raw = simulate_raw(WIDE, [(0.0, 96.0, 1.0)])
ideal = ideal_gain(WIDE, 0.0, 96.0)
p0, j0 = pixel(WIDE, 0.0, 96.0)
full = omega_k(WIDE, raw, r_ref=120.0)
bulk = omega_k(WIDE, raw, r_ref=120.0, stolt=False)
assert local_peak(full, p0, j0)[1:] == (p0, j0)
assert abs(full[p0][j0]) > 0.9 * ideal
assert local_peak(bulk, p0, j0)[0] < 0.4 * ideal
def test_bulk_compression_alone_is_exact_at_the_reference_range() -> None:
raw = simulate_raw(WIDE, [(0.0, 120.0, 1.0)])
p0, j0 = pixel(WIDE, 0.0, 120.0)
full = omega_k(WIDE, raw, r_ref=120.0)
bulk = omega_k(WIDE, raw, r_ref=120.0, stolt=False)
assert abs(full[p0][j0] - bulk[p0][j0]) < 0.05 * abs(full[p0][j0])
def test_linear_in_the_data() -> None:
a = omega_k(G, simulate_raw(G, TARGETS[:1]))
b = omega_k(G, simulate_raw(G, TARGETS[1:]))
for p in (58, 64, 72):
for j in (12, 16, 24):
assert abs(a[p][j] + b[p][j] - IMG[p][j]) < 1e-6 * abs(IMG[64][16])
History
Stolt (1978) introduced migration by Fourier transform for seismic data, a change of variables from temporal frequency to vertical wavenumber. Cafforio, Prati and Rocca (1991) showed that SAR focusing is a migration problem of the same kind and derived the wavenumber domain algorithm from it. Bamler (1992) compared it with the range-Doppler algorithm and showed that it is free of the approximations of the latter for a straight track. Carrara, Goodman and Majewski (1995) described its spotlight form as the range migration algorithm. Cumming and Wong (2005, Chapter 8) call it the omega-K algorithm.
References
- Ciro Cafforio, Claudio Prati and Fabio Rocca, SAR data focusing using seismic migration techniques, IEEE Transactions on Aerospace and Electronic Systems 27(2), 1991, 194 to 207, the SAR record as a zero-offset seismic section and its focusing by the Stolt mapping (general locator)
- R. H. Stolt, Migration by Fourier transform, Geophysics 43(1), 1978, 23 to 48, the change of variables from temporal frequency to vertical wavenumber (general locator)
- Ian G. Cumming and Frank H. Wong, Digital Processing of Synthetic Aperture Radar Data, Artech House, 2005, Chapter 8, The Omega-K Algorithm
- 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 wavenumber domain algorithm as the reference without approximation for a straight track (general locator)
- Walter G. Carrara, Ron S. Goodman and Ronald M. Majewski, Spotlight Synthetic Aperture Radar: Signal Processing Algorithms, Artech House, 1995, the range migration algorithm for spotlight data (general locator)
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 R4DMS8 Edit this page History Report an error Markdown