hfpytrace.homing¶
Package
HF ray homing-in for 2-D and 3-D ionospheric tracers.
"Homing-in" finds all launch angles whose ray path arrives at (or within a tolerance of) a prescribed target on the ground. For NVIS / ionosonde work the target ground range is zero; for oblique links it is a specific range or lat/lon point.
The algorithm follows Laryunin (2025):
- Fan sweep – rays are launched over a coarse elevation grid (plus azimuth
grid in 3-D) and the miss-distance
Dis recorded for each angle. - Root-finding – a cubic spline is fitted to
D(φ)and zero-crossings are located with Brent's method. Each crossing is one propagation mode (ordinary, loop-like, off-vertical …). - Re-trace – the ODE is integrated again at each refined angle to collect the group delay, virtual height, and full path geometry.
Key Classes¶
Class HomingConfig
Class HomingResult
Class Homing2D
Class Homing3D
HomingConfig¶
Shared sweep and tolerance parameters. Passed to either Homing2D or Homing3D.
Per-call keyword arguments on home() override these values without mutating the
stored config.
| Field | Type | Default | Description |
|---|---|---|---|
tol_km |
float | 10.0 |
Acceptance radius [km] |
elev_min_deg |
float | -30.0 |
Lower elevation bound [°] |
elev_max_deg |
float | 89.0 |
Upper elevation bound [°] |
elev_step_deg |
float | 2.0 |
Coarse elevation step [°] |
az_min_deg |
float | 0.0 |
(3-D only) Lower azimuth bound [°] |
az_max_deg |
float | 360.0 |
(3-D only) Upper azimuth bound [°] |
az_step_deg |
float | 5.0 |
(3-D only) Azimuth step [°] |
fine_points |
int | 2000 |
Spline interpolation resolution |
max_roots |
int | 10 |
Safety cap on total returned rays |
max_roots_per_az |
int | 5 |
(3-D only) Safety cap per azimuth slice |
mode |
str | "O" |
Polarisation mode ("O" or "X") |
HomingResult¶
Frozen (immutable) record returned by home(). Call .to_dict() for a plain
dict of scalar fields.
Common fields (2-D and 3-D)
| Field | Description |
|---|---|
freq_hz |
Operating frequency [Hz] |
elevation_deg |
Homed launch elevation [°] |
group_path_km |
Integrated group path [km] |
group_delay_sec |
Two-way group delay [s] |
virtual_height_km |
Virtual height h' = c·τ/2 [km] |
status |
Ray termination status ("ground", "domain", …) |
mode |
Polarisation mode |
2-D only
| Field | Description |
|---|---|
ground_range_km |
Actual landing ground range [km] |
miss_km |
Signed miss-distance from target [km] |
x_km, z_km |
Ray path in (range, altitude) |
3-D only
| Field | Description |
|---|---|
azimuth_deg |
Homed launch azimuth [°] |
landing_lat, landing_lon |
Landing coordinates [°] |
dist_to_target_km |
Great-circle distance from landing to target [km] |
lat_deg, lon_deg |
Full path lat/lon arrays (spherical solver) |
extra |
Dict of additional raw path arrays (r_km, x_km, …) |
Homing2D¶
Homing over a 2-D slice (RT2D).
Constructor¶
Key Methods¶
Method home(freq_hz, *, x_target_km=0.0, tol_km=None, elev_min/max/step_deg=None, mode=None)
Method synthesize_ionogram(freqs_hz, *, x_target_km=0.0, tol_km=None, mode=None)
synthesize_ionogram returns ndarray (N, 5) –
columns: freq_hz | virtual_height_km | elevation_deg | ground_range_km | miss_km.
Algorithm¶
Inner cusps / loop-like paths (Laryunin 2025) produce two adjacent sign changes at nearly the same elevation and are found automatically.
Homing3D¶
Homing over a 3-D volume (RT3D). Decomposes the 2-D search into independent
1-D elevation root-finds per azimuth slice.
Constructor¶
Homing3D(rt3d, *, tx_lat, tx_lon, config=HomingConfig(),
coordinate_system="spherical", solver="gradient", trace_kw={})
Key Methods¶
Method home(freq_hz, *, target_lat, target_lon, tol_km=None, az_*/elev_*=None, mode=None)
Method synthesize_ionogram(freqs_hz, *, target_lat, target_lon, tol_km=None, mode=None)
home() returns results sorted by ascending azimuth_deg.
synthesize_ionogram returns ndarray (N, 6) –
columns: freq_hz | virtual_height_km | azimuth_deg | elevation_deg | landing_lat | landing_lon.
coordinate_system |
Landing coordinates source |
|---|---|
"spherical" |
ray.lat_deg[-1], ray.lon_deg[-1] directly |
"cartesian" |
Flat-Earth from ray.x_km[-1], ray.y_km[-1] using tx_lat/tx_lon |
Quick-start Examples¶
NVIS ionogram (2-D)¶
from hfpytrace.homing import Homing2D, HomingConfig
import numpy as np
homing = Homing2D(model, config=HomingConfig(tol_km=10.0),
trace_kw=dict(x0_km=0.0, z0_km=60.0, s_max_km=3000.0))
rays = homing.home(freq_hz=7e6) # all modes at 7 MHz
iono = homing.synthesize_ionogram(np.arange(2e6, 12e6, 0.02e6)) # (N, 5)
Oblique homing (2-D, 800 km target)¶
Oblique link homing (3-D)¶
from hfpytrace.homing import Homing3D, HomingConfig
homing = Homing3D(model, tx_lat=40.0, tx_lon=-95.0,
config=HomingConfig(tol_km=25.0, az_step_deg=5.0))
rays = homing.home(freq_hz=5e6, target_lat=45.0, target_lon=-90.0)
iono = homing.synthesize_ionogram(np.arange(3e6, 10e6, 0.05e6),
target_lat=45.0, target_lon=-90.0) # (N, 6)
Config override (no mutation)¶
tight = homing.home(freq_hz=5e6, tol_km=5.0)
loose = homing.home(freq_hz=5e6, tol_km=30.0)
assert homing.config.tol_km == 25.0 # unchanged
API¶
hfpytrace.homing
¶
hfpytrace.homing¶
HF ray homing-in for 2-D and 3-D ionospheric tracers.
Overview¶
"Homing-in" is the process of finding all launch angles whose ray path arrives at (or within a tolerance of) a prescribed target on the ground. In vertical-incidence sounding (NVIS / ionosonde) the target ground range is zero; for oblique links it is a specific distance or lat/lon.
The algorithm follows Laryunin (2025) [1]_:
- Fan sweep – launch rays over a coarse elevation grid (and, for 3-D,
over a coarse azimuth grid as well) and record the signed miss-distance
Dfor each launch angle. - Root-finding – fit a cubic spline to
D(φ)(andD(φ,ψ)per azimuth slice) and locate zero-crossings with Brent's method. Each crossing is one propagation mode (ordinary, loop-like, off-vertical …). - Re-trace – integrate the ODE again at the refined launch angle and collect group delay, virtual height, and path geometry.
Classes¶
HomingConfig
Shared sweep / tolerance parameters, passed to either tracer class.
HomingResult
Immutable result record for a single homed ray.
Homing2D
Homing over a 2-D ionospheric slice (RT2D).
Homing3D
Homing over a 3-D ionospheric volume (RT3D).
Quick start¶
from hfpytrace.homing import Homing2D, Homing3D, HomingConfig cfg = HomingConfig(tol_km=15.0, elev_step_deg=2.0) h2 = Homing2D(rt2d, config=cfg) rays = h2.home(freq_hz=5e6) # NVIS (x_target=0) rays = h2.home(freq_hz=7e6, x_target_km=800) # oblique iono = h2.synthesize_ionogram(freqs_hz) # full ionogram h3 = Homing3D(rt3d, tx_lat=40.0, tx_lon=-95.0, config=cfg) rays = h3.home(freq_hz=5e6, target_lat=45.0, target_lon=-90.0)
References¶
.. [1] Laryunin, O. (2025). Reconstruction of medium-scale TID characteristics from a series of vertical incidence ionograms with inner cusps. Advances in Space Research, 75, 6425–6430. https://doi.org/10.1016/j.asr.2025.01.069
HomingConfig
dataclass
¶
Sweep and convergence parameters shared by both :class:Homing2D and
:class:Homing3D.
Parameters¶
float
Acceptance radius [km]. A homed ray is accepted when its landing
point is within tol_km of the target. Default 10.0.
float
Lower bound of the elevation fan sweep [°]. Default -30.0.
float
Upper bound of the elevation fan sweep [°]. Default 89.0.
float
Coarse elevation step for the fan sweep [°]. Default 2.0.
float
(3-D only) Lower azimuth bound [°]. Default 0.0.
float
(3-D only) Upper azimuth bound [°]. Default 360.0.
float
(3-D only) Coarse azimuth step [°]. Default 5.0.
int
Number of interpolation points used when searching for spline roots.
Increase for densely packed multipath modes. Default 2000.
int
Safety cap on total returned ray paths per frequency. Default 10.
int
(3-D only) Safety cap per azimuth slice. Default 5.
str
Polarisation mode ('O' or 'X'). Default 'O'.
Source code in hfpytrace/homing.py
HomingResult
dataclass
¶
Immutable record for a single homed ray.
Common fields (2-D and 3-D)¶
float
Operating frequency [Hz].
float
Homed launch elevation [°].
float
Integrated group path length [km].
float
Two-way group delay [s].
float
Virtual height h' = c · τ / 2 [km].
str
Ray termination status ('ground', 'domain', …).
str
Polarisation mode.
2-D only¶
float
Actual landing ground range [km].
float
Signed miss-distance from target [km].
x_km, z_km : ndarray Ray path in Cartesian (range, altitude) coordinates.
3-D only¶
float
Homed launch azimuth [°].
landing_lat, landing_lon : float Geographic coordinates of the landing point [°].
float
Great-circle distance from landing to target [km].
Source code in hfpytrace/homing.py
to_dict()
¶
Return a plain dict representation (excludes extra).
Homing2D
¶
Homing-in solver for a 2-D ionospheric tracer (:class:~hfpytrace.model.rt2d.RT2D).
The solver finds all elevation angles whose ray path lands within
:attr:~HomingConfig.tol_km of a target ground range x_target_km
(default 0 = NVIS / vertical incidence).
Parameters¶
RT2D
Initialised 2-D tracer with a loaded ionospheric profile.
HomingConfig, optional
Sweep and tolerance settings. A default :class:HomingConfig is
used when omitted.
callable, optional
Override the trace callable. Defaults to rt2d.trace. Must
accept freq_hz, elevation_deg, and mode keyword
arguments and return a :class:~types.SimpleNamespace with at
least status, ground_range_km, group_path_km,
group_delay_sec, x_km, and z_km.
dict, optional
Extra keyword arguments forwarded to trace_fn on every call.
Examples¶
NVIS ionogram synthesis::
from hfpytrace.model.rt2d import RT2D, RT2DProfile
from hfpytrace.homing import Homing2D, HomingConfig
import numpy as np
profile = RT2DProfile.from_cfg(cfg, time=event_time, fetch_iri=True)
model = RT2D(profile=profile)
homing = Homing2D(model, config=HomingConfig(tol_km=10.0, elev_step_deg=2.0))
freqs = np.arange(2e6, 12e6, 0.02e6)
iono = homing.synthesize_ionogram(freqs) # shape (N, 5)
Oblique homing to 800 km::
rays = homing.home(freq_hz=7e6, x_target_km=800.0, tol_km=20.0)
for r in rays:
print(f"el={r.elevation_deg:.1f}° h'={r.virtual_height_km:.0f} km")
Source code in hfpytrace/homing.py
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 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | |
home(freq_hz, *, x_target_km=0.0, tol_km=None, elev_min_deg=None, elev_max_deg=None, elev_step_deg=None, mode=None)
¶
Find all elevation angles that home to x_target_km ground range.
Per-call keyword arguments override the corresponding
:class:HomingConfig values without mutating the stored config.
Parameters¶
float
Operating frequency [Hz].
float
Target ground range [km]. 0 gives NVIS / vertical incidence.
float, optional
Override :attr:HomingConfig.tol_km for this call.
elev_min/max/step_deg : float, optional Override sweep bounds / step for this call.
str, optional
Override polarisation mode for this call.
Returns¶
list[HomingResult] One entry per distinct ray path that lands within tol_km of the target. Empty list when no return exists (above MUF, etc.).
Source code in hfpytrace/homing.py
synthesize_ionogram(freqs_hz, *, x_target_km=0.0, tol_km=None, mode=None)
¶
Build a synthetic ionogram by running :meth:home at each frequency.
Parameters¶
array-like
Operating frequencies [Hz].
float
Target ground range [km].
float, optional
Override tolerance for this call.
str, optional
Override polarisation mode.
Returns¶
np.ndarray, shape (N_pixels, 5)
Columns: [freq_hz, virtual_height_km, elevation_deg,
ground_range_km, miss_km].
Each row is one ionogram pixel (one homed ray at one frequency).
Source code in hfpytrace/homing.py
Homing3D
¶
Homing-in solver for a 3-D ionospheric tracer (:class:~hfpytrace.model.rt3d.RT3D).
For each azimuth in the fan, the solver sweeps elevation angles and
finds where the great-circle distance from the landing point to the
target falls within :attr:~HomingConfig.tol_km. This naturally
handles multipath, loop-like paths, and off-great-circle propagation.
Parameters¶
RT3D
Initialised 3-D tracer with a loaded ionospheric profile.
float
Transmitter latitude [°]. Required for Cartesian → lat/lon conversion when the tracer runs in Cartesian mode.
float
Transmitter longitude [°].
HomingConfig, optional
Sweep and tolerance settings.
str
Passed to :meth:RT3D.oblique_trace. 'spherical' (default)
gives lat_deg/lon_deg outputs directly; 'cartesian'
uses flat-Earth conversion via tx_lat/tx_lon.
str
Passed to :meth:RT3D.oblique_trace. 'gradient' (default)
or 'hamiltonian'.
dict, optional
Extra keyword arguments forwarded to :meth:RT3D.oblique_trace
on every call.
Examples¶
Oblique link homing from (40°N, 95°W) to (45°N, 90°W) within 25 km::
from hfpytrace.model.rt3d import RT3D, RT3DProfile
from hfpytrace.homing import Homing3D, HomingConfig
profile = RT3DProfile.from_cfg(cfg, time=event_time, fetch_iri=True)
model = RT3D(profile=profile)
homing = Homing3D(model, tx_lat=40.0, tx_lon=-95.0,
config=HomingConfig(tol_km=25.0, az_step_deg=5.0))
rays = homing.home(freq_hz=5e6, target_lat=45.0, target_lon=-90.0)
for r in rays:
print(f"az={r.azimuth_deg:.0f}° el={r.elevation_deg:.1f}° "
f"h'={r.virtual_height_km:.0f} km dist={r.dist_to_target_km:.1f} km")
3-D ionogram synthesis::
import numpy as np
freqs = np.arange(2e6, 10e6, 0.05e6)
iono = homing.synthesize_ionogram(freqs, target_lat=45.0, target_lon=-90.0)
Source code in hfpytrace/homing.py
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |
home(freq_hz, *, target_lat, target_lon, tol_km=None, az_min_deg=None, az_max_deg=None, az_step_deg=None, elev_min_deg=None, elev_max_deg=None, elev_step_deg=None, mode=None)
¶
Find all (azimuth, elevation) pairs that home to (target_lat, target_lon).
Parameters¶
float
Operating frequency [Hz].
float
Target landing latitude [°].
float
Target landing longitude [°].
float, optional
Acceptance radius [km]; overrides :attr:HomingConfig.tol_km.
az_min/max/step_deg : float, optional Override azimuth fan bounds / step. elev_min/max/step_deg : float, optional Override elevation sweep bounds / step.
str, optional
Override polarisation mode.
Returns¶
list[HomingResult] One entry per homed ray path, sorted by ascending azimuth.
Source code in hfpytrace/homing.py
synthesize_ionogram(freqs_hz, *, target_lat, target_lon, tol_km=None, mode=None)
¶
Build a synthetic 3-D ionogram by running :meth:home at each frequency.
Parameters¶
array-like
Operating frequencies [Hz].
target_lat, target_lon : float Target landing point [°].
float, optional
Override acceptance radius.
str, optional
Override polarisation mode.
Returns¶
np.ndarray, shape (N_pixels, 6)
Columns: [freq_hz, virtual_height_km, azimuth_deg,
elevation_deg, landing_lat, landing_lon].
Source code in hfpytrace/homing.py
Source Code¶
| hfpytrace/homing.py | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 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 211 212 213 214 215 216 217 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 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |