import numpy as np
import matplotlib.pyplot as plt
# --- PHYSICS CALCULATIONS ---
def get_electron_density(freq_hz):
"""
Applies the Plasma Frequency formula: f_p ≈ 9000 * sqrt(Ne).
Returns density in electrons per cubic centimeter (e-/cc).
"""
return (freq_hz / 9000)**2
def get_cartesian_coords(dist_re, angle_deg):
"""Converts polar satellite data to X-Y coordinates."""
rad = np.radians(angle_deg)
return dist_re * np.cos(rad), dist_re * np.sin(rad)
# --- DATASET (Sample RPI Echoes) ---
# "ID": (Angle, Distance_RE, Reflection_Freq_Hz)
plasma_data = {
"1": (300, 1.0, 284000), "2": (315, 2.5, 201000), "3": (350, 6.5, 12600),
"4": (45, 4.5, 20100), "5": (60, 3.9, 25500), "6": (90, 4.1, 28500),
"7": (120, 4.0, 25500), "8": (135, 5.5, 20100), "9": (215, 7.2, 12600),
"10": (230, 3.5, 220000), "11": (270, 1.2, 348000)
}
# --- PROCESSING ---
x, y, densities = [], [], []
for loc, (ang, dist, freq) in plasma_data.items():
nx, ny = get_cartesian_coords(dist, ang)
x.append(nx); y.append(ny)
densities.append(get_electron_density(freq))
# --- VISUALIZATION ---
plt.figure(figsize=(10, 7))
# Red = High Density (Near Earth), Blue = Low Density (Outer Space)
scatter = plt.scatter(x, y, c=densities, s=[d/5 for d in densities],
cmap='coolwarm', edgecolors='black', alpha=0.8)
# Add Earth for reference
earth = plt.Circle((0, 0), 1, color='skyblue', label='Earth')
plt.gca().add_patch(earth)
plt.colorbar(scatter, label='Electron Density (e-/cc)')
plt.title("Visualizing Earth's Magnetosphere via RPI Sounding")
plt.xlabel("Distance ($R_E$)"); plt.ylabel("Distance ($R_E$)")
plt.axis('equal'); plt.grid(True, alpha=0.3)
plt.show()
By visualizing this data, we can clearly see the boundary known as the plasmopause—the dramatic drop-off where the dense, Earth-bound plasma gives way to the vast, sparse vacuum of the outer magnetosphere. The code we’ve built doesn't just plot points; it provides a window into the dynamic environment that protects our satellites and power grids from solar storms. As the data shows, the closer we get to Earth, the more crowded the neighborhood becomes! Whether you're a space enthusiast or a data scientist, mapping the invisible reminds us that even "empty" space is teeming with activity.
"Computational solutions for the curious mind. Exploring the intersection of Python programming and rigorous science, featuring solved problems in NASA physics, chemistry, and beyond."
Friday, 27 March 2026
Mapping the Invisible: Visualizing Earth’s Magnetosphere with Python
Imagine trying to map a massive, invisible ocean of electricity surrounding our planet. That is exactly what NASA’s IMAGE mission set out to do using the Radio Plasma Imager (RPI). Instead of using visible light, the RPI acts like a long-range "cosmic sonar," sending powerful radio pulses into the Earth's magnetosphere.
By measuring how these pulses bounce off clouds of charged particles (plasma), scientists can "see" the structure of space weather that is normally hidden from our eyes. In this post, we’re going to use Python to take raw RPI sounding data and reconstruct a 2D map of these plasma densities, revealing the dense "inner shell" of our planet's atmosphere.
Subscribe to:
Post Comments (Atom)
Visualizing Particle Kinematics with Python
Understanding the relationship between position, velocity, and acceleration is fundamental to physics. However, seeing how these variables e...
-
The important source of aerosols in the stratosphere is the formation of carbonyl sulfide (COS) droplets. These droplets are more dangerou...
-
This code in python demonstrates how to calculate molecular weights, physical properties like mole fractions, partial pressure calculations ...
-
The code is based on finding volume, density and orbit radius of some dwarf planets. Further we tried to match these densities with one'...

No comments:
Post a Comment