Plotting
All plotting functions take windsoln objects as inputs.
from wind_ae.wrapper.relax_wrapper import wind_simulation as wind_sim
from wind_ae.wrapper.wrapper_utils.plots import spectrum_plot
sim = wind_sim()
sim.load_planet('planet.csv')
spectrum_plot(sim.windsoln,)
The two most common plots for analysis (energy_plot() and six_panel_plot()) are
also accessible via the functions in Relaxation Module as
wind_ae.wrapper.relax_wind.six_panel_plot() and wind_ae.wrapper.relax_wind.energy_plot() (e.g., sim.six_panel_plot()).
- wind_ae.wrapper.wrapper_utils.plots.four_panel_plot(windsoln, ax, ax_Ys=None, label=None, alpha=0.8, pvar=[['v', 'rho'], ['T', 'Ys_HI']], norm=[[100000.0, 1.0], [1.0, 1.0]], radius_prefix=None, sub_sonic=False, past_rmin=False, sonic_vert=True)
Produces a velocity, density, temperature, and neutral fraction plot from intermediate solutions while ramping. For a more aesthetic four-panel plot use quickplot().
- Parameters:
windsoln – windsoln object to be plotted.
ax (np.ndarray) – The ax array on which plots are placed (must have shape = (2,2)).
ax_Ys (matplotlib.axes.Axes, optional) – Axis for plotting ionization fraction. Defaults to None.
label (str, optional) – Label to be added to ax[0][0]. Defaults to None.
alpha (float, optional) – Alpha of lines plotted. Defaults to 0.8.
pvar (list of lists of str, optional) – Variables to plot. Defaults to [[‘v’,’rho’],[‘T’,’Ys_HI’]].
norm (list of lists of floats, optional) – Values to norm (divide) pvars with. Defaults to [[1e5,1e0],[1e0,1e0]].
radius_prefix (str, optional) – SI prefix for x-axis (None defaults to units of Rp). Defaults to None.
sub_sonic (bool, optional) – Only plot sub-sonic region. Defaults to False.
past_rmin (bool, optional) – Only plot past Rmin region. Defaults to False.
sonic_vert (bool, optional) – Add vertical line at sonic point. Defaults to True.
- Returns:
None
- wind_ae.wrapper.wrapper_utils.plots.quick_plot(soln, Mdot_legend=True, c='k', ls='-', label='', label_dim=[0, 1.3, 2], ion_label=True, first_plotted=True, ax=0)
Plots density (g/cm³), temperature (K), velocity (10 km/s), and ionization fraction as a function of r (Rp).
- Parameters:
soln (windsoln) – Wind solution object (sim.windsoln).
Mdot_legend (bool, optional) – If True, put Mdot in legend of plot. Else, just prints. Defaults to True.
c (str, optional) – Line color. Defaults to ‘k’.
ls (str, optional) – Line style. Defaults to ‘-‘.
label (str, optional) – Label for the plot. Defaults to ‘’.
label_dim (list, optional) – Location of label and ncols [x, y, ncols]. Defaults to [0, 1.3, 2].
ion_label (bool, optional) – If True, show ionization legend. Defaults to True.
first_plotted (bool, optional) – True if this is the first of many plots on the same axes. Defaults to True.
ax (matplotlib.axes.Axes, optional) – Axes object to plot on. Defaults to 0.
- Returns:
Axes object (if first_plotted=True). str: Title string summarizing species and mass fractions.
- Return type:
matplotlib.axes.Axes
- wind_ae.wrapper.wrapper_utils.plots.six_panel_plot(soln, Mdot_legend=True, c='k', ls='-', label='', label_dim=[0, 1.3, 2], ion_label=True, first_plotted=True, ax=0)
Plots density (g/cm3), temperature (K), velocity (10 km/s), ionization fraction, column density (g/cm2), and number density (1/cm2), as a function of r (Rp).
- Parameters:
object (soln - windsoln)
True (Mdot_legend - Bool; if)
Else (put Mdot in legend of plot.)
prints. (just)
color (c - str; line)
style (ls - str; line)
label (label - str; line)
default=[0 (label_dim - list;)
1.3
[x (2]. Location of label and ncols)
y
ncols].
SixPlot (first_plotted - Bool; True if this the first of many OR the ONLY) – to be plotted on the same axes.
first_plotted=False (ax - matplotlib axis obj; if) – will be be plotted on desired figure with other simulations for comparison
this (provide axis object so) – will be be plotted on desired figure with other simulations for comparison
- Returns:
ax - axes object (if first_plotted=True)
Example
ax1 = SixPlot(sim1.windsoln, first_plotted=True) SixPlot(sim2.windsoln, ax=ax1) SixPlot(sim3.windsoln, ax=ax1)
- wind_ae.wrapper.wrapper_utils.plots.energy_plot(windsoln, ax=0, alpha=0.8, all_terms=False, CII_line_cool=False, CIII_line_cool=False, OII_line_cool=False, OIII_line_cool=False, legend=True, sub_sonic=True)
Plots energy balance terms used in the energy equation (Broome et al. 2025)
- Parameters:
windsoln – The wind solution object containing the simulation data. (“sim.windsoln”)
ax – The axis to plot on (default is 0, which creates a new figure)
alpha – Transparency level for the plot lines (default is 0.8). Useful when overplotting multiple on same axes
all_terms – If True, plot terms not included in Wind-AE, e.g., free-free cooling, (default is False)
CII_line_cool – If True, include CII line cooling terms (default is False)
CIII_line_cool – If True, include CIII line cooling terms (default is False)
OII_line_cool – If True, include OII line cooling terms (default is False)
OIII_line_cool – If True, include OIII line cooling terms (default is False)
legend – If True, display the legend (default is True)
sub_sonic – If True, sets x-axis upper limit at sonic point radius
- Returns:
None
- wind_ae.wrapper.wrapper_utils.plots.coriolis_plot(windsoln, ax, var='position', label_system=None)
- Parameters:
windsoln – The wind solution object containing the data to plot.
ax – The matplotlib axis to plot on.
var – The variable to plot (‘position’, ‘velocity’, ‘pos_angle’, ‘vel_angle’).
label_system – Optional label for the color legend.
- wind_ae.wrapper.wrapper_utils.plots.ballistic_plot(windsoln, ax, show_star=False, t_end=None)
Plot ballistic trajectories. Windsoln must be integrated out (if not, run sim.integrate_out()) There is currently no stellar wind term.
- Parameters:
ax (matplotlib.axes.Axes) – The axes to plot on.
show_star (bool) – Whether to show the star marker at the semimajor axis.
t_end (float) – The end time for the ballistic trajectories.
- Returns:
None
- wind_ae.wrapper.wrapper_utils.plots.collisionality_plot(windsoln, ax, legend=True, same_colors=False, sub_sonic=False, past_rmin=False, sonic_vert=True, exo_vert=False)
Deprecated (requires updates to Knudsen number calculations).
- wind_ae.wrapper.wrapper_utils.plots.spectrum_plot(windsoln, var='F_wl', xaxis='wl', semimajor_au=1.0, highlight_euv=True, wl_norm=1e-07, print_warnings=False)
Plot the spectrum. Displays the observations, smoothed, and spans.
- Parameters:
var (str) – Which variable plotted, energy (‘F_wl’) or number (‘Phi_wl’)
xaxis (str) – ‘wl’ or ‘energy’; x variable. Wavelength in nm or energy in eV
semimajor_au (float) – semimajor axis in units of au to which to scale the spectrum
highlight_euv (bool) – default=True; highlights EUV and XUV range and prints APPROXIMATE fluxes in ergs/s/cm2 each range.
wl_norm (float) – default=1e-7; wavelength normalization factor to convert nm to cm.
print_warnings (bool) – default=False; prints any warnings generated when loading spectrum.
- Returns:
The figure and axis object plotted on
- Return type:
(fig, ax)
- wind_ae.wrapper.wrapper_utils.plots.spectrum_binning_plot(windsoln, var='F_wl', xaxis='wl', semimajor_au=1.0, plot_polys=False, wl_norm=1e-07, print_warnings=False)
Plot the spectrum. Displays the observations, smoothed, and spans.
Legend Key: Subbin edges - are automatically set at ionization edges (including K-shell ionization edges) for species present in a given simulation for maximum accuracy in calculating ionization rates. Crits - dashed lines are the critical points in the smoothing Bin edges - wavelength range window edges
- Parameters:
var (str) – Which variable plotted, energy (‘F_wl’) or number (‘Phi_wl’)
xaxis (str) – ‘wl’ or ‘energy’; x variable. Wavelength in nm or energy in eV
semimajor_au (float) – semimajor axis in units of au to which to scale the spectrum
highlight_euv (bool) – default=True; highlights EUV and XUV range and prints APPROXIMATE fluxes in ergs/s/cm2 each range.
wl_norm (float) – default=1e-7; wavelength normalization factor to convert nm to cm.
print_warnings (bool) – default=False; prints any warnings generated when loading spectrum.
- Returns:
The figure and axis object plotted on
- Return type:
(fig, ax)