WPIT’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/stourgai/WPIT/llms.txt
Use this file to discover all available pages before exploring further.
LandauDamp_mod.RayUtils_mod sub-module provides a complete pipeline for post-processing ray-tracing output produced by external ray-tracing codes. Starting from a whitespace-delimited .ray file, you can compute Landau damping along the ray path, enrich the file with derived quantities such as the Stix parameters, wave normal angles, and L-shell coordinates, then evaluate resonance conditions and wave-amplitude enhancement factors for any pitch-angle population. This page covers the file format, each utility function, and representative code examples.
The .ray file format
A .ray file is a plain-text, whitespace-delimited table where each row represents one time step along the ray path. There is no header line — column positions are fixed as follows:
| Column(s) | Name | Description |
|---|---|---|
| 1 | ray | Ray index |
| 2 | ray_stop | Stop flag (0 = propagating) |
| 3 | time | Propagation time (s) |
| 4–6 | posx, posy, posz | Position vector in SM Cartesian (m) |
| 7–9 | vprelx, vprely, vprelz | Phase velocity (relative to c) |
| 10–12 | vgrelx, vgrely, vgrelz | Group velocity (relative to c) |
| 13–15 | nx, ny, nz | Refractive index vector |
| 16–18 | Bx, By, Bz | Geomagnetic field vector (T) |
| 19 | w | Angular wave frequency (rad/s) |
| 20 | Nspec | Number of plasma species |
| 21–24 | qs1–qs4 | Species charges (C) |
| 25–28 | ms1–ms4 | Species masses (kg) |
| 29–32 | Ns1–Ns4 | Species number densities (m⁻³) |
| 33–36 | nus1–nus4 | Collision frequencies (rad/s) |
The species order is by convention: electrons (
qs1, ms1, Ns1), H⁺ (qs2, ms2, Ns2), He⁺ (qs3, ms3, Ns3), O⁺ (qs4, ms4, Ns4). Unused species should be set to zero density.RayUtils_mod function reference
read_input_ray
Reads a raw
.ray file into a pandas DataFrame with named columns.append_ray
Enriches a
.ray file with computed plasma parameters and saves _appended.csv.resonance_along_raypath
Computes the resonant energy as a function of time along the appended ray.
enhancement_factor
Calculates the equatorial cavity enhancement factor weighted by damping amplitude.
read_input_ray
read_input_ray(ray_file_name) reads a raw .ray file and returns a pandas DataFrame with 34 of the 36 raw columns (all except the leading ray index and ray_stop flag) plus a derived freq column (Hz), giving 35 columns total.
Landau damping and append_ray
Before calling append_ray, you must first compute the Landau damping along the ray and save the result as <ray_file>_damping.csv. The LandauDamp_mod.landau_damping function does this:
.ray file, append_ray(ray_file_name) merges both, computes the full set of plasma and wave quantities at each step, and writes <ray_file>_appended.csv.
| Added column | Description |
|---|---|
psi | Wave normal angle ψ relative to B (deg) |
theta_res | Resonance cone angle θ_res (deg) |
gendrin | Gendrin angle (deg) |
Y | Distance from resonance cone |ψ − θ_res| (deg) |
L, alt, lat, lon | L-shell, altitude, latitude, longitude (MAG) |
damp | Normalised wave power (0–1) |
S_stix … L_stix | Cold-plasma Stix parameters S, D, P, R, L |
wce, wcH, wcHe, wcO | Cyclotron frequencies (rad/s) |
wpe, wpH, wpHe, wpO | Plasma frequencies (rad/s) |
wlhr, wuhr | Lower/upper hybrid resonance frequencies (rad/s) |
read_appended_ray
After append_ray has been called you can reload the enriched file using read_appended_ray:
resonance_along_raypath
resonance_along_raypath(ray_file_name, mres, alpha_array) computes, for every pitch angle in alpha_array and every time step in the appended ray, the resonant parallel velocity, perpendicular velocity, total speed, Lorentz factor, and resonant kinetic energy.
| Name | Shape | Description |
|---|---|---|
time | (N,) | Propagation time steps (s) |
psi | (N,) | Wave normal angle along ray (deg) |
Ekev_res | (K, N) | Resonant kinetic energy (keV) |
upar_res | (K, N) | Resonant parallel velocity (m/s) |
uper_res | (K, N) | Resonant perpendicular velocity (m/s) |
gamma_res | (K, N) | Resonant Lorentz factor |
len(alpha_array) and N = number of time steps.
enhancement_factor
enhancement_factor(ray_file_name) computes the wave-amplitude cavity enhancement factor by tracking each equatorial crossing of the ray and weighting the L-shell distribution by the normalised wave power at that crossing. It produces a histogram of the enhancement factor as a function of L-shell.
ray_plots
ray_plots(ray_file_name) is a convenience function that reads the appended CSV and produces a standard set of diagnostic figures: wave power decay, L-shell and latitude vs. time, wave normal angle, refractive index, and a 2-D ray path plot in the XY, XZ, and YZ planes with dipole field lines overlaid.
- Wave frequency (ω) and lower hybrid resonance frequency (ω_LHR) vs. time, with ray latitude on the right axis
- Normalised wave power (Landau damping) vs. time
- L-shell vs. time
- Magnetic latitude vs. time
- Wave normal angle ψ vs. time
- Refractive index vs. time
- XY, XZ, YZ ray path plots with dipole field lines and wave-normal-angle arrows
- Combined L-shell + latitude panel
- Ray path colour-coded by Landau damping magnitude
Complete end-to-end pipeline example
Complete end-to-end pipeline example