This guide walks you from a bare checkout to a working physics calculation in approximately ten minutes. You will clone the repository, install the required packages, import the two core modules, compute the geomagnetic dipole field at a chosen L-shell and latitude, derive the electron cyclotron and plasma frequencies, and finally calculate the whistler-mode refractive index using the Appleton-Hartree formula.Documentation 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.
WPIT has been developed and tested on Ubuntu 18.04 LTS with Python 3.6.9. The steps below should work on any modern Linux or macOS system with Python 3.6+.
WPIT is not published on PyPI. All code lives in the Git repository, so the first step is to clone it locally.
SpacePy may need additional system-level dependencies (e.g. a Fortran compiler and the CDF library) before
pip can build it. If the install fails, follow the SpacePy installation guide for your operating system and then re-run pip install -r requirements.txt.Open a Python session (or start a Jupyter Notebook with
jupyter notebook) from inside the cloned directory. Import the Environment_mod and WaveProperties_mod namespaces:import sys
sys.path.insert(0, '.') # ensure WPIT root is on the path
import WPIT.Environment_mod as env
import WPIT.WaveProperties_mod as wave
import numpy as np
Both modules expose all their functions at the package level — there is no need to reach into individual submodules.
env.Bmag_dipole(L, lamda) returns the scalar geomagnetic field strength at L-shell L and magnetic latitude lamda (in radians), using the standard dipole formula with B₀ = 31 200 nT at the magnetic equator on the Earth’s surface.L = 5.0 # L-shell (dimensionless)
lamda = np.deg2rad(20.0) # magnetic latitude in radians
B = env.Bmag_dipole(L, lamda)
print(f"Dipole field at L={L}, λ={np.rad2deg(lamda):.1f}°: {B*1e9:.2f} nT")
# Example output: Dipole field at L=5, λ=20.0°: 112.37 nT
Use the field value
B together with the physical constants available under env.const to compute the electron cyclotron frequency (ωce) and the electron plasma frequency (ωpe). For the plasma frequency you also need an electron number density — here we use the Sheeley equatorial density model.# Electron cyclotron frequency (rad/s)
wce = env.omega_cyclotron(B, env.const.qe, env.const.me)
# Equatorial electron density from the Sheeley model (cm^-3)
ne_mean, ne_min, ne_max = env.density_equ_sheeley(L)
ne_m3 = ne_mean * 1e6 # convert cm^-3 → m^-3
# Electron plasma frequency (rad/s)
wpe = env.omega_plasma(ne_m3, env.const.qe, env.const.me)
print(f"ωce = {wce:.3e} rad/s")
print(f"ωpe = {wpe:.3e} rad/s")
print(f"fce = {wce/(2*np.pi):.0f} Hz")
print(f"fpe = {wpe/(2*np.pi):.0f} Hz")
All physical constants (electron mass
me, electron charge qe, Earth radius Re, speed of light c_light, etc.) are accessible through env.const. No need to hard-code values.wave.refr_index_appleton(w, wpe, wce, theta) implements the Appleton-Hartree dispersion relation for a cold magnetized plasma. It returns both roots of the dispersion relation (µ²₊ and µ²₋), the refractive index ref_ind for the propagating root, and the wave number kappa along with its parallel and perpendicular components.f_wave = 2000.0 # wave frequency in Hz
w = 2 * np.pi * f_wave # angular frequency in rad/s
theta = np.deg2rad(0.0) # wave normal angle (parallel propagation)
musq_plus, musq_minus, ref_ind, kappa, kappa_par, kappa_per = \
wave.refr_index_appleton(w, wpe, wce, theta)
print(f"Refractive index µ = {ref_ind:.4f}")
print(f"Wave number κ = {kappa:.4f} rad/m")
print(f"κ‖ = {kappa_par:.4f} rad/m, κ⊥ = {kappa_per:.4f} rad/m")
Putting It All Together
The snippet below combines all five steps into a single self-contained script you can run directly:Next Steps
- Explore the
Module_descriptions/Jupyter Notebooks for deeper theoretical background and more example calls. - Read the Concepts: Environment page to understand all density models and frequency routines.
- See Concepts: Wave Properties for Stix parameters, dispersion relations, and resonance angles.
- Run the validation notebooks in
WPIT_tests/to compare WPIT output against published literature.