Algorithmcore
Semblance velocity analysis
Also called velocity spectrum, semblance.
Scan trial stacking velocities over a common-midpoint gather, measure the semblance (normalized stack energy) along each hyperbola in a time window, and pick the velocities of the peaks.
- Time
- O(n k m w) worst · average · best
- Space
- O(n k) extra
- Where
- k = the number of trial velocities; m = the number of traces in the gather; n = the number of scanned zero-offset times; w = the number of samples in the window
- Model
- Real RAM
- Properties
- deterministicscale invariant
- Evidence
- Proof sketchCode in 1 languages
- Origin
- N. S. Neidell, M. Turhan Taner, 1971
Semblance velocity analysis finds the stacking velocity of the reflections in a common-midpoint gather. For each zero-offset time and each trial velocity it reads the traces along the hyperbola of normal moveout and measures how alike they are with the semblance, a number between 0 and 1. The table of semblance over time and velocity is the velocity spectrum. Its peaks give the velocities that flatten the reflections, which common-midpoint stacking needs, and which the Dix formula converts to interval velocities.
In plain words
A reflection in a gather lies on a curve whose bend depends on the speed of sound in the rock. Guess a speed, follow the curve that this speed predicts, and look at the traces along it. If the guess is right, the traces show the same wiggle at the same time, and adding them gives a big result. If the guess is wrong, the wiggles do not line up and partly cancel. Semblance turns this into a score from 0 to 1: the energy of the sum, divided by what the sum would have if all traces agreed perfectly. Try many speeds at many times and draw the scores as a map. Bright spots on the map mark the reflections and their speeds.
The problem
Input: a gather of traces with offsets and sample interval ; a list of trial velocities ; a half window in samples; the times to scan. Output: the velocity spectrum , and for each time of interest the velocity of the largest peak. For one window and one velocity, with ,
where runs over the samples of the window centered at .
The algorithm
VELOCITY-SPECTRUM(d, x, Δt, v_1..v_k, W, times)- 1
for each zero-offset index j in times do - 2
row_j ← [SEMBLANCE(d, x, Δt, j, v_ℓ, W) for ℓ ← 1 to k] SEMBLANCE(d, x, Δt, j, v, W)- 3
A ← 0; B ← 0 - 4
for τ ← j - W to j + W do - 5
a_i ← d_i at time sqrt((τ Δt)² + x_i² / v²) for every trace i ▷ linear interpolation - 6
A ← A + (Σ_i a_i)²; B ← B + Σ_i a_i² - 7
return A / (m B), or 0 if B = 0 - 8
return the rows; pick the v_ℓ with the largest value in each row
The window smooths the measure over a few samples, about half a period of the wavelet, so that a zero crossing of the wavelet does not make the score jump. The scan does not change the data: it is a search over a grid of velocities, one stack per pair. The pick is a separate step, done by a person or an automatic picker, and it can follow the strongest peak or a smooth velocity trend.
Example
A hand example. One window holds two time samples and three traces: at the first time and at the second. Then , , and . The first row alone gives , because its traces agree. A window where only one of three traces is live gives .
A gather with two reflections. Take 16 traces at offsets 0 to 1500 m every 100 m, ms, and two reflections with a 25 Hz Ricker wavelet: amplitude 1 at s with m/s, and amplitude at s with m/s. Add Gaussian noise with (seed 6). Scan from 1500 to 3100 m/s in steps of 50 m/s with :
| (m/s) | 1700 | 1800 | 1900 | 2000 | 2300 | 2500 | 2600 | 2700 | 2900 |
|---|---|---|---|---|---|---|---|---|---|
| at 0.4 s | 0.049 | 0.101 | 0.683 | 0.108 | 0.098 | 0.055 | 0.051 | 0.153 | 0.084 |
| at 0.9 s | 0.072 | 0.146 | 0.064 | 0.074 | 0.140 | 0.460 | 0.764 | 0.518 | 0.207 |
The peaks are at 1900 and 2600 m/s, the true values. The noise level is the floor of the spectrum. The peak at 0.9 s is wider in velocity, because the moveout of a deep, fast reflection changes slowly with : the velocity resolution falls with depth. Without noise the peaks are 0.877 and 0.993; the first is lower because the stretch of the shallow event at far offsets makes the traces differ next to the peak.
Correctness
By the Cauchy-Schwarz inequality, at each time, so , with exactly when all traces agree at every time of the window after the moveout with . One live trace gives , and for independent noise of equal variance the expected numerator over the expected denominator is . does not change when all traces are scaled by the same factor. These are theorems about the measure. That the peak of is at the best stacking velocity is a heuristic: it holds when the event is a hyperbola with that velocity, the noise is weaker than the event, and no other event crosses the window. The proofs are in proofs/correctness.md.
Proof: Semblance lies between 0 and 1, equals 1 exactly when the moveout-corrected traces agree in the window, equals 1/N for one live trace, and has expected numerator over expected denominator 1/N for independent noisefull
Setting. A gather has traces with offsets . For a zero-offset index , a trial velocity and a half window , lines L4 and L5 read the samples for (by linear interpolation; outside the record). Lines L3 and L6 accumulate
and line L7 returns , or when . The window and the velocity are fixed in each claim.
Claim 1 (bounds). .
Proof. and as sums of squares. If , line L7 returns . Otherwise, for each the Cauchy-Schwarz inequality for the vectors and gives . Summing over gives , so .
Claim 2 (when ). If , then if and only if, at every time of the window, all samples are equal.
Proof. means , that is . Each term is at least by Claim 1, so each term is . Equality in Cauchy-Schwarz holds exactly when is a multiple of , that is when all are equal for that .
So means that the moveout correction with made the traces identical in the window. For a reflection on the hyperbola of velocity the peak lines up on all traces (Claim 2 of the NMO proof), but the NMO stretch makes the far traces wider, so the samples next to the peak differ a little and is close to, not equal to, 1.
Claim 3 (one live trace). If exactly one trace is not zero in the window, then . If the samples at each time have opposite values in pairs (for example and ), then .
Proof. With only trace live, , so and . With and the sums are all , so and when ; line L7 returns also when .
Claim 4 (scale invariance). Multiplying all samples by the same does not change .
Proof. and both get the factor .
A scale that differs from trace to trace does change , so a gather with strong amplitude decay with offset has a lower semblance than the same gather after gain.
Claim 5 (independent noise). If the are independent random variables with mean and the same variance , then .
Proof. For each , , and . With window samples, and .
The claim is about the ratio of the expectations; the mean of the ratio is close to when the window is long, which the tests measure. So is the level of pure noise, and a peak well above it marks coherent energy.
Claim 6 (the scan). Lines L1, L2 and L8 return the matrix with one entry for each scanned time and each trial velocity , each computed as above. With times, velocities, traces and a window of samples, the cost is .
Proof. The double loop calls the semblance once for each pair . Each call reads samples, each with a square root and an interpolation of fixed cost, and does additions and multiplications.
Complexity
In the real-RAM model each semblance value reads samples, so the spectrum costs for times and velocities. The sums over the window can be updated in as the window slides, which removes the factor when all times are scanned. The spectrum needs space. In practice it is computed on a coarse grid of midpoints, for example every 20th to 50th gather, and the velocities are interpolated in between.
Properties
- The output is between 0 and 1 and does not depend on the overall amplitude, so spectra of different gathers and times can be compared.
- The noise floor is about .
- Velocity resolution is a heuristic matter: it gets worse with depth (small moveout) and with a short spread (small largest offset), and better with high frequencies.
- Multiples show as peaks at lower velocities than the primaries at the same time.
Variants and improvements
- Other coherence measures: the plain stack amplitude or power, the normalized or unnormalized cross-correlation sum (Neidell and Taner 1971 compare them).
- AB semblance and weighted semblance: they allow the amplitude to change with offset, so that a reflection whose polarity changes with offset still gives a peak.
- High-resolution spectra based on eigenvalues of the data covariance in the window, in the spirit of high-resolution array processing.
- Higher-order or anisotropic moveout: scan two parameters, the velocity and a nonhyperbolic term.
- Automatic picking along a smooth trend, by dynamic programming over the spectrum.
When to use it
Use it to build the stacking velocity field before CMP stacking, and as the first velocity model for time migration and for the Dix conversion to interval velocities. It assumes hyperbolic moveout, so it is suited to reflections from gentle structures.
Pitfalls
- A peak of a multiple can be picked as a primary, which gives too low a velocity. Follow the expected increase of velocity with depth.
- Velocities picked at the peak are stacking velocities. They equal rms velocities only for flat layers and small offsets, and Dix conversion amplifies their errors.
- A window much longer than the wavelet mixes events; a window much shorter makes the spectrum noisy.
- Strong amplitude decay with offset lowers the semblance of a good velocity; apply a gain first.
- The velocity grid must be fine enough to sample the peak; a step of 50 m/s on a peak a few hundred m/s wide is enough, a step of 200 m/s may miss it.
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
# Part of https://algorithm.tamnd.com/semblance-velocity-analysis/. The authors are listed in prov/8B18AH.jsonl.
"""Semblance velocity analysis of a common-midpoint gather.
The gather is a list of N traces with offsets x_i, sampled at k * dt. For a
zero-offset time index j and a trial velocity v, the samples a_i(k) are read
along the hyperbola t = sqrt((k dt)^2 + x_i^2 / v^2) for k in a window
j - W .. j + W, and the semblance is
S = sum_k (sum_i a_i(k))^2 / (N sum_k sum_i a_i(k)^2),
a number between 0 and 1 (0 when the window holds no energy).
"""
import math
def _interp(trace, dt, t):
n = len(trace)
u = t / dt
if n < 2 or u < 0.0 or u > n - 1:
return 0.0
k = min(int(math.floor(u)), n - 2)
f = u - k
return (1.0 - f) * trace[k] + f * trace[k + 1]
def semblance_of_window(rows):
"""S for a window given as rows a[k][i] (time k, trace i)."""
num = 0.0
den = 0.0
n = 0
for row in rows:
n = len(row)
s = sum(row)
num += s * s
den += sum(a * a for a in row)
if den == 0.0:
return 0.0
return num / (n * den)
def semblance(gather, offsets, dt, j, v, half_window):
"""The semblance at zero-offset index j and velocity v, window j - W .. j + W."""
num = 0.0 # @line L3
den = 0.0
for k in range(j - half_window, j + half_window + 1): # @line L4
t0 = k * dt
a = [_interp(tr, dt, math.sqrt(t0 * t0 + (x / v) ** 2)) if k >= 0 else 0.0
for tr, x in zip(gather, offsets)] # @line L5
s = sum(a) # @line L6
num += s * s
den += sum(ai * ai for ai in a)
if den == 0.0: # @line L7
return 0.0
return num / (len(gather) * den)
def velocity_spectrum(gather, offsets, dt, velocities, half_window, times=None):
"""S[j][m] for every zero-offset index j in times (default all) and velocities[m]."""
n = len(gather[0])
idx = range(n) if times is None else times
spec = []
for j in idx: # @line L1
spec.append([semblance(gather, offsets, dt, j, v, half_window) for v in velocities]) # @line L2
return spec # @line L8
def pick_velocity(row, velocities):
"""The trial velocity with the largest semblance in one row of the spectrum."""
m = max(range(len(row)), key=lambda i: row[i])
return velocities[m]
test_semblance_velocity_analysis.py 116 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/semblance-velocity-analysis/. The authors are listed in prov/8B18AH.jsonl.
import math
import random
from semblance_velocity_analysis import (
pick_velocity,
semblance,
semblance_of_window,
velocity_spectrum,
)
def ricker(t, f=25.0):
a = (math.pi * f * t) ** 2
return (1.0 - 2.0 * a) * math.exp(-a)
def gather_with_events(events, offsets, dt, n, rng=None, sigma=0.0):
out = []
for x in offsets:
tr = [0.0] * n
for t0, v, amp in events:
tx = math.sqrt(t0 * t0 + (x / v) ** 2)
for k in range(n):
tr[k] += amp * ricker(k * dt - tx)
if rng is not None:
tr = [a + rng.gauss(0.0, sigma) for a in tr]
out.append(tr)
return out
def test_bounds_on_random_windows():
rng = random.Random(1)
for _ in range(200):
n_tr = rng.randint(1, 10)
rows = [[rng.gauss(0.0, 1.0) for _ in range(n_tr)] for _ in range(rng.randint(1, 8))]
s = semblance_of_window(rows)
assert -1e-15 <= s <= 1.0 + 1e-12
def test_equal_traces_give_one():
rng = random.Random(2)
row_vals = [rng.gauss(0.0, 1.0) for _ in range(9)]
rows = [[v] * 6 for v in row_vals]
assert abs(semblance_of_window(rows) - 1.0) < 1e-12
def test_one_live_trace_gives_one_over_n():
rng = random.Random(3)
rows = [[rng.gauss(0.0, 1.0)] + [0.0] * 4 for _ in range(7)]
assert abs(semblance_of_window(rows) - 0.2) < 1e-12
def test_opposite_polarity_gives_zero():
rows = [[v, -v] for v in (0.3, -1.2, 2.0)]
assert semblance_of_window(rows) == 0.0
assert semblance_of_window([[0.0, 0.0]]) == 0.0
def test_scale_invariance():
rng = random.Random(4)
rows = [[rng.gauss(0.0, 1.0) for _ in range(5)] for _ in range(4)]
s1 = semblance_of_window(rows)
s2 = semblance_of_window([[-3.5 * a for a in r] for r in rows])
assert abs(s1 - s2) < 1e-12
def test_matches_the_definition_by_brute_force():
rng = random.Random(5)
dt, n = 0.004, 120
offsets = [0.0, 150.0, 300.0, 450.0, 600.0]
gather = [[rng.gauss(0.0, 1.0) for _ in range(n)] for _ in offsets]
j, v, w = 60, 2100.0, 4
rows = []
for k in range(j - w, j + w + 1):
row = []
for tr, x in zip(gather, offsets):
t = math.sqrt((k * dt) ** 2 + (x / v) ** 2)
u = t / dt
i0 = int(math.floor(u))
f = u - i0
row.append((1 - f) * tr[i0] + f * tr[i0 + 1])
rows.append(row)
assert abs(semblance(gather, offsets, dt, j, v, w) - semblance_of_window(rows)) < 1e-12
def test_flat_event_at_the_right_velocity_gives_one():
dt, n = 0.004, 250
offsets = [0.0] * 6
gather = gather_with_events([(0.5, 2000.0, 1.0)], offsets, dt, n)
assert abs(semblance(gather, offsets, dt, 125, 2000.0, 5) - 1.0) < 1e-12
def test_picks_the_true_velocity_in_noise():
rng = random.Random(6)
dt, n = 0.004, 300
offsets = [100.0 * i for i in range(16)]
events = [(0.4, 1900.0, 1.0), (0.9, 2600.0, -1.0)]
gather = gather_with_events(events, offsets, dt, n, rng, sigma=0.4)
vels = [1500.0 + 50.0 * m for m in range(33)]
spec = velocity_spectrum(gather, offsets, dt, vels, 5, times=[100, 225])
assert abs(pick_velocity(spec[0], vels) - 1900.0) <= 50.0
assert abs(pick_velocity(spec[1], vels) - 2600.0) <= 100.0
assert max(spec[0]) > 0.5
def test_pure_noise_gives_about_one_over_n():
rng = random.Random(7)
n_tr, n = 8, 600
offsets = [0.0] * n_tr
gather = [[rng.gauss(0.0, 1.0) for _ in range(n)] for _ in range(n_tr)]
vals = [semblance(gather, offsets, 0.004, j, 2000.0, 5) for j in range(10, n - 10, 11)]
mean = sum(vals) / len(vals)
assert abs(mean - 1.0 / n_tr) < 0.03
History
Taner and Koehler (1969) computed velocity spectra by digital stacks along trial hyperbolas and used them to pick stacking velocities. Neidell and Taner (1971) defined semblance and compared it with the stack amplitude and the cross-correlation measures; semblance became the standard measure of velocity analysis in seismic processing.
References
- N. S. Neidell and M. Turhan Taner, Semblance and other coherency measures for multichannel data, Geophysics 36(3), 1971, 482 to 497, the definition of semblance as a ratio of output to input energy and its comparison with other coherence measures
- M. Turhan Taner and Fulton Koehler, Velocity spectra, digital computer derivation and applications of velocity functions, Geophysics 34(6), 1969, 859 to 881, velocity spectra from stacks along trial hyperbolas, and their use for picking stacking velocities
- Oz Yilmaz, Seismic Data Analysis, Society of Exploration Geophysicists, 2001, Investigations in Geophysics 10, the chapter on velocity analysis and statics corrections (velocity spectra, semblance, velocity picking)
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 8B18AH Edit this page History Report an error Markdown