hfpytrace.pharlap¶
Package
MATLAB Engine wrapper for PHaRLAP 2D and 3D calls.
Key Classes¶
Class Engine
Key Methods¶
Function get_matlab_pharlap_lib()
Method Engine.run_pharlap()
Method Engine.run_pharlap_3d()
Method Engine.run_pharlap_3d_sp()
Method Engine.close()
API¶
hfpytrace.pharlap
¶
PHaRLAP MATLAB engine wrappers.
Provides Python wrappers around the PHaRLAP (Provision of High-frequency Raytracing Laboratory for Propagation studies) MATLAB library, enabling 2D and 3D HF ray-tracing from Python via the MATLAB Engine API.
Two 3D formulations are supported:
raytrace_3d— WGS84 ellipsoidal Earth model.raytrace_3d_sp— spherical Earth model (used for the SCurve study).
Requires¶
matlab.engine : MATLAB Engine API for Python (ships with MATLAB installation).
PHaRLAP : MATLAB HF ray-tracing library installed at PHARLAP_LIB_PATH.
Classes / Functions¶
get_matlab_pharlap_lib Resolve the PHaRLAP library path for a given version tag. Engine MATLAB engine lifecycle manager with PHaRLAP ray-tracing methods.
Engine
¶
MATLAB engine lifecycle manager with PHaRLAP ray-tracing methods.
Starts a MATLAB engine session, adds the PHaRLAP library to the MATLAB path, and exposes Python-callable wrappers for:
- :meth:
run_pharlap— 2D spherical ray-tracing (raytrace_2d_sp). - :meth:
run_pharlap_3d— 3D WGS84 ray-tracing (raytrace_3d). - :meth:
run_pharlap_3d_sp— 3D spherical ray-tracing (raytrace_3d_sp).
Parameters¶
str or None
Explicit path to the PHaRLAP MATLAB library directory. None
resolves the path via :func:get_matlab_pharlap_lib.
Notes¶
Call :meth:close (or use as a context manager) to cleanly quit the
MATLAB session and release memory.
Source code in hfpytrace/pharlap.py
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 | |
run_pharlap(ne_grid, collision_freq, elevs, rb, freqs, irreg, nhops=1, tol=1e-07, radius_earth=6371, irregs_flag=0, start_height=50, height_inc=1, range_inc=1)
¶
Run PHaRLAP 2D spherical ray-tracing (raytrace_2d_sp).
Parameters¶
np.ndarray
2D electron density grid, shape (nalt, nrange), in cm⁻³.
np.ndarray
2D collision frequency grid, same shape as ne_grid, in Hz.
np.ndarray, 1D
Launch elevation angles [°].
float
Ground range of the ionospheric profile endpoint [km].
np.ndarray, 1D
Operating frequencies [MHz].
np.ndarray
Irregularity array (passed to PHaRLAP; shape depends on version).
int
Number of ionospheric hops. Default 1.
float
ODE solver tolerance. Default 1e-7.
float
Earth radius [km]. Default 6371.
int
Irregularity flag (0 = no irregularities). Default 0.
int
Starting height for the ray [km]. Default 50.
height_inc, range_inc : int
Grid increment in height and range [km]. Defaults 1.
Returns¶
SimpleNamespace
Per-ray scalar parameters (group_range, phase_path, …).
SimpleNamespace
Per-ray path arrays (group_range, height, …).
Source code in hfpytrace/pharlap.py
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 | |
run_pharlap_3d(origin_lat, origin_lon, origin_ht, elevs, ray_bearings, freqs, iono_en_grid, iono_en_grid_5, collision_freq, iono_grid_parms, Bx, By, Bz, geomag_grid_parms, OX_mode=1, nhops=1, tol=1e-07, ray_state_vec_in=None)
¶
Wrapper for PHaRLAP raytrace_3d (WGS84 formulation).
Source code in hfpytrace/pharlap.py
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 | |
run_pharlap_3d_sp(origin_lat, origin_lon, origin_ht, elevs, ray_bearings, freqs, rad_earth_m, iono_en_grid, iono_en_grid_5, collision_freq, iono_grid_parms, Bx, By, Bz, geomag_grid_parms, OX_mode=1, nhops=1, tol=1e-07, ray_state_vec_in=None)
¶
Wrapper for PHaRLAP raytrace_3d_sp (spherical Earth formulation).
Source code in hfpytrace/pharlap.py
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 | |
get_matlab_pharlap_lib(trace_spec=None, version='4.5.3')
¶
Resolve the PHaRLAP MATLAB library path for a given version tag.
Parameters¶
Path or None
Override the root search path. None uses :data:PHARLAP_LIB_PATH.
str
PHaRLAP version string, e.g. "4.5.3". The directory
pharlap_lib/pharlap_<version> must exist under the resolved root.
Returns¶
str Absolute path to the PHaRLAP sub-directory.
Raises¶
FileNotFoundError If the expected PHaRLAP directory does not exist.
Source code in hfpytrace/pharlap.py
Source Code¶
| hfpytrace/pharlap.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 | |