capon.py — EsCaponImager & EsImagingResult¶
Single-Cube Capon Imager
Operates on one (pulse_count, gate_count [, rx_count]) IQ cube —
a single RIQ file or a pre-built NumPy array. Best when many pulses per
frequency are available (e.g. WISS: 256 pulses, or coherently-integrated VIPIR).
Source¶
pynasonde/vipir/analysis/es_imaging/capon.py
API reference¶
pynasonde.vipir.analysis.es_imaging.capon
¶
capon.py — High-resolution sporadic-E layer imaging via Capon cross-spectrum analysis.
Theory¶
A pulse-compressed ionosonde range profile R_ss(t) = [R_s(t₁), …, R_s(t_V)] is a complex sequence of V samples, one per range gate of width r₀ = c·t_p/2 (km), where t_p is the code chip duration. Taking the FFT along the gate axis yields the cross-power spectrum:
G_ss(f_m) = FFT{R_ss}(f_m) = U(f_m) · e^{j4πrf_m/c} (1)
where U(f) = |S(f)|² encodes the transmitted signal power and the complex exponential encodes target range r. The phase difference between adjacent spectral components is
Δφ = 2π · Q / V, Q = r / r₀ (integer bin index) (2)
which is purely proportional to range and free of integer ambiguity.
Capon range-dimensional spectrum estimation
Partition G_ss into a Hankel subband matrix G of shape (Z, V-Z+1), where Z is the
number of subbands
G[i, j] = G_ss[f_{i+j}], i = 0…Z-1, j = 0…V-Z (3)
Form the spatial covariance (with diagonal loading ε for conditioning):
R_f = G · G^H / (V-Z+1) + ε·tr(R_f)/Z · I (4)
Construct a steering matrix A of shape (K·V, Z), where K is the range resolution
improvement factor
A[l, k] = exp(j · k · ω_l), ω_l = 2π·l / (K·V), l = 1…K·V (5)
The Capon minimum-variance pseudospectrum at super-resolved range index l is
P(l · r₀/K) = 1 / (a^H(ω_l) · R_f⁻¹ · a(ω_l)) (6)
giving an effective range resolution of r₀/K. Liu et al. (2023) achieve 384 m (10× improvement) from an intrinsic 3.84 km range bin.
VIPIR data mapping
The VIPIR RIQ cube has shape (pulse_count, gate_count, rx_count):
gate_count ↔ V (pulse-compressed range bins — the range profile R_ss)
pulse_count ↔ 256 duplicate soundings per frequency in Liu et al.
rx_count ↔ receive antenna channels (method is single-channel)
Applying the algorithm along the gate axis requires only a single receiver channel. Multiple pulses can be coherently integrated (trading temporal resolution for SNR) before imaging, exactly as in Liu et al. Fig 6.
Practical constraints
- Z must satisfy Z ≤ (V+1)/2 for R_f to be non-singular (full-rank condition). R_f has shape (Z×Z) but rank at most (V-Z+1); for non-singular inversion the rank must equal Z, requiring V-Z+1 ≥ Z → Z ≤ (V+1)/2. Z > (V+1)/2 is allowed (diagonal loading partially compensates) but imaging degrades — matches Liu et al. (2023) Figure 1d (Z=150, V=200 case). Practical recommendation: Z ≈ V/2 (e.g. Z=100 for V=200).
- K is a free parameter that only controls output grid spacing (Δr = r₀/K). It does NOT enter the covariance matrix R_f and has no singularity constraint.
- SNR > 10 dB is required for reliable layer separation (Liu et al. Fig 1f).
References¶
Liu, T., Yang, G., & Jiang, C. (2023). High-resolution sporadic E layer observation based on ionosonde using a cross-spectrum analysis imaging technique. Space Weather, 21, e2022SW003195. https://doi.org/10.1029/2022SW003195
EsCaponImager
¶
High-resolution Es layer range imager using Capon cross-spectrum analysis.
Implements the algorithm of Liu et al. (2023) applied to the pulse-compressed range profile stored in the VIPIR RIQ I/Q cube.
Parameters¶
n_subbands
Number of Capon subbands Z. Must be less than gate_count.
Larger values improve resolution but increase the risk of covariance
matrix singularity. Default 100.
resolution_factor
Range resolution improvement factor K. Effective resolution becomes
gate_spacing_km / K. Default 10.
coherent_integrations
Number of pulses to coherently integrate per snapshot before imaging.
1 → per-pulse imaging (maximum temporal resolution).
N → N-pulse integration (higher SNR, lower temporal resolution).
Default 1.
rx_index
Receive antenna channel to use when the IQ cube has an rx_count
third axis. Default 0.
diagonal_loading
Diagonal loading fraction for covariance matrix regularisation.
R_f ← R_f + ε·tr(R_f)/Z · I. Default 1e-3.
gate_start_km
Virtual height of the first range gate (km). Default 90.0
(bottom of the E layer).
gate_spacing_km
Spacing between adjacent range gates (km) = r₀ = c·t_p/2.
For WISS this is 3.84 km; check your ionosonde parameters.
Default 3.84.
Examples¶
imager = EsCaponImager(n_subbands=100, resolution_factor=10, ... gate_spacing_km=3.84, gate_start_km=90.0) result = imager.fit(iq_cube) # shape (pulse_count, gate_count, rx) print(result.summary()) result.plot()
Source code in pynasonde/vipir/analysis/es_imaging/capon.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
fit(iq_cube)
¶
Run high-resolution Es layer imaging on a VIPIR IQ cube.
Parameters¶
complex ndarray
Shape (pulse_count, gate_count) or
(pulse_count, gate_count, rx_count).
The gate axis must contain pulse-compressed range bins (the
cross-correlation output stored in RIQ files).
Returns¶
EsImagingResult
Source code in pynasonde/vipir/analysis/es_imaging/capon.py
EsImagingResult
dataclass
¶
High-resolution Es layer range imaging result for one sounding frequency.
Parameters¶
pseudospectrum_db
Normalised Capon pseudospectrum in dB, shape (n_snapshots, n_hr_bins).
Each row is one coherently-integrated snapshot. Normalised so that the
maximum over the full array is 0 dB.
heights_km
Virtual height axis of the high-resolution grid (km), shape
(n_hr_bins,). Spacing is gate_spacing_km / resolution_factor.
gate_heights_km
Original gate heights (km), shape (n_gates,).
n_subbands
Number of Capon subbands Z used.
resolution_factor
Range resolution improvement factor K. Effective resolution is
gate_spacing_km / resolution_factor km.
coherent_integrations
Number of pulses coherently integrated per snapshot.
gate_spacing_km
Original gate spacing r₀ (km).
Source code in pynasonde/vipir/analysis/es_imaging/capon.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
effective_resolution_km: float
property
¶
Effective range resolution after Capon imaging (km).
to_dataframe(snapshot=0)
¶
Return one snapshot as a DataFrame with columns height_km and power_db.
Source code in pynasonde/vipir/analysis/es_imaging/capon.py
plot(ax=None, snapshot=None, vmin=-60.0, cmap='jet')
¶
Plot the imaging result.
Parameters¶
ax
Existing axes. A new figure is created when None.
snapshot
If given, plot only that snapshot as a 1-D profile.
If None and n_snapshots > 1, plot all snapshots as an
intensity map (time × height).
vmin
Minimum colour/y scale in dB. Default -60.
cmap
Colour map for the 2-D plot. Default "jet".
Returns¶
matplotlib.axes.Axes
Source code in pynasonde/vipir/analysis/es_imaging/capon.py
EsCaponImager¶
Constructor parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
n_subbands |
int |
100 |
Z — Capon subbands. Recommended: Z ≤ (V+1)/2 |
resolution_factor |
int |
10 |
K — output grid multiplier (K·V high-res bins). No singularity constraint |
coherent_integrations |
int |
1 |
Pulses averaged before imaging (1 = per-pulse; N = N-pulse coherent stack) |
rx_index |
int |
0 |
Rx channel to extract when input is 3-D (pulses, gates, rx) |
diagonal_loading |
float |
1e-3 |
ε — R_f regularisation: R_f ← R_f + ε·tr(R_f)/Z·I |
gate_start_km |
float |
90.0 |
Height of first range gate (km) |
gate_spacing_km |
float |
3.84 |
Native gate spacing r₀ (km). WISS = 3.84 km, VIPIR ≈ 1.499 km |
fit(iq_cube) → EsImagingResult¶
from pynasonde.vipir.analysis import EsCaponImager
imager = EsCaponImager(
n_subbands=100, # Z
resolution_factor=10, # K
coherent_integrations=1, # per-pulse imaging
rx_index=0, # single Rx channel from 3-D cube
diagonal_loading=1e-3,
gate_start_km=90.0,
gate_spacing_km=3.84, # WISS r₀
)
# 2-D input: (pulse_count, gate_count)
result = imager.fit(iq_cube_2d)
# 3-D input: (pulse_count, gate_count, rx_count) — rx_index=0 extracted
result = imager.fit(iq_cube_3d)
print(result.summary())
# EsImagingResult: snapshots=256 Z=100 K=10 r₀=3.84 km → Δr=0.384 km
# height=90.0–857.7 km
Internal methods (documented for custom pipelines)¶
| Method | Signature | Description |
|---|---|---|
_validate |
_validate(V) |
Check Z < V; warn when Z > (V+1)/2 |
_covariance |
_covariance(G_ss) → R_f_inv |
Build Hankel G, compute R_f, apply diagonal loading, invert |
_steering_matrix |
_steering_matrix(V) → A |
Construct A (K·V, Z) with ω_l = 2π·l/(K·V) |
_capon |
_capon(R_f_inv, A) → P |
P[l] = 1/(a^H R_f⁻¹ a), shape (K·V,) |
_process_pulse |
_process_pulse(range_profile, A) → P |
FFT → covariance → Capon for one range profile |
EsImagingResult¶
Shared result dataclass returned by both EsCaponImager.fit() and RiqAggregator.combine().
Fields¶
| Field | Type | Shape | Description |
|---|---|---|---|
pseudospectrum_db |
ndarray |
(n_snapshots, K·V) |
Normalised Capon pseudospectrum (dB, max = 0 dB) |
heights_km |
ndarray |
(K·V,) |
High-resolution height axis (km), spacing = r₀/K |
gate_heights_km |
ndarray |
(V,) |
Original gate heights (km), spacing = r₀ |
n_subbands |
int |
— | Z used |
resolution_factor |
int |
— | K used |
coherent_integrations |
int |
— | Pulses combined per snapshot |
gate_spacing_km |
float |
— | Native gate spacing r₀ (km) |
Properties¶
| Property | Returns | Description |
|---|---|---|
effective_resolution_km |
float |
r₀ / K |
n_snapshots |
int |
Number of rows in pseudospectrum_db |
Methods¶
result.summary()
# "EsImagingResult: snapshots=1 Z=100 K=10 r₀=1.499 km → Δr=0.150 km
# height=90.0–1537.9 km"
result.to_dataframe(snapshot=0)
# DataFrame with columns: height_km, power_db
result.plot() # RTI intensity map when n_snapshots > 1
result.plot(snapshot=0) # single 1-D profile
result.plot(vmin=-60) # custom dB floor (default −60 dB)
result.plot(cmap="plasma") # custom colormap (default "jet")
Plot behaviour¶
n_snapshots |
snapshot arg |
Output |
|---|---|---|
| 1 | any / None | 1-D profile (power dB vs height km) |
| > 1 | None | 2-D RTI (pulse index × height, pcolormesh) |
| > 1 | int | 1-D profile for that snapshot only |
WISS vs VIPIR quick reference¶
| Setting | WISS (Liu et al.) | VIPIR WI937 |
|---|---|---|
gate_spacing_km |
3.84 | 1.499 |
gate_start_km |
~0 | ~90 |
| Typical V | 200 | 960 |
| Recommended Z | 100 | 480 |
| K | 10 | 10 |
| Δr | 384 m | 150 m |
See Also¶
References¶
Liu, T., Yang, G., & Jiang, C. (2023). Space Weather, 21, e2022SW003195. https://doi.org/10.1029/2022SW003195