Reading and visualising MAS runs

First, load the required modules.

import matplotlib.pyplot as plt

from psipy.data import sample_data
from psipy.model import MASOutput

Load a set of MAS output files.

mas_path = sample_data.mas_sample_data()
model = MASOutput(mas_path)

Each MAS model contains a number of variables. The variable names can be accessed using the .variables attribute.

print(model.variables)
['bp', 'br', 'bt', 'rho', 'vr']

Plot a cut of the model at a constant radius

fig, ax = plt.subplots()
model["rho"].plot_radial_cut(0, ax=ax)
rho, r=29.26$R_{\odot}$
<matplotlib.collections.QuadMesh object at 0x7f7b0fbbae90>

Plot a cut of the model at a constant longitude.

fig = plt.figure()
ax = plt.subplot(111, projection="polar")
model["rho"].plot_phi_cut(75, ax=ax)
rho, $\phi$= 210.94$^{\circ}$
<matplotlib.collections.QuadMesh object at 0x7f7b178eb0a0>

Add the current sheet

fig = plt.figure()
ax = plt.subplot(111, projection="polar")
model["rho"].plot_phi_cut(75, ax=ax)
model["br"].contour_phi_cut(75, levels=[0], ax=ax, colors="white")
plt.show()
rho, $\phi$= 210.94$^{\circ}$

Total running time of the script: ( 0 minutes 0.619 seconds)

Gallery generated by Sphinx-Gallery