Plotting#

Visualizing MESA models with mesagrid

%load_ext autoreload
%autoreload 2
from mesagrid import Track, star_plots
Updated star.py 2025-10-10 11:48:49.189137
Updated starplots.py 2025-10-10 11:48:49.192879
track = Track('work/LOGS')

Hertzsprung-Russell Diagram#

star_plots.plot_hr(track, solar_symbol=True, show_profiles=True)
findfont: Font family ['cursive'] not found. Falling back to DejaVu Sans.
findfont: Generic family 'cursive' not found because none of the following families were found: Apple Chancery, Textile, Zapf Chancery, Sand, Script MT, Felipa, Comic Neue, Comic Sans MS, cursive
_images/bbc7a0c67f9d9001a04e73df61a13657acfc6f831c52f03474a1bc78442beba1.png

Internal chemical composition#

star_plots.plot_composition(track, 5, legend=True) # 5th profile file
_images/4c8e2d69e54d200fa91c93457edf8c2ff4a9997f444152e5c453e74daf0f855d.png

Propagation diagram#

star_plots.plot_propagation(track, 10, legend=True)
_images/de33c5b13693f8db59d37d424af14b3dcbd845f4df9fb1c5f45cac86de0fa6e6.png

Echelle diagram#

star_plots.plot_echelle(track, 5)
_images/c0775a8068172d27ab7aa66ad686bb1b98d6fdbcaa9fadacbee972c5b935958d.png

Kippenhahn Diagram#

star_plots.plot_kippenhahn(track, radius_lines=[0.5, 1])
/home/docs/checkouts/readthedocs.org/user_builds/mesagrid/envs/latest/lib/python3.12/site-packages/mesagrid/star_plots.py:434: RuntimeWarning: divide by zero encountered in log10
  Z = np.array([sp.interpolate.interp1d(g.m/g.M, np.log10(g.N *  10**6/(2*np.pi)),
_images/469004e8d427488008f00f6387abd041c92f6c19598b1f68860713d87ddcfde4.png

Interactive plotting#

# need to run this in a jupyter notebook for interactivity to actually work 
star_plots.star_interact(track)
_images/912af57b15f212e0daf74113e5a48712ef45a02360e99323787fe76a174912c4.png
star_plots.star_interact(track, panels=[star_plots.plot_hr, star_plots.plot_composition, star_plots.plot_propagation, star_plots.plot_kippenhahn])
_images/526046077ed0d5e7e42ab055f5f2e94372faa89ef3f507947667b3400f766836.png

Pretty Plots#

star_plots.plot_convection_circles(track, 205) # cross section view of star at history row #5
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[11], line 1
----> 1 star_plots.plot_convection_circles(track, 205) # cross section view of star at history row #5

AttributeError: module 'mesagrid.star_plots' has no attribute 'plot_convection_circles'
star_plots.movie(track)
creating folder of images: ./images
Rendering frames: 100%|██████████| 11/11 [00:11<00:00,  1.00s/it]
stitching images into video starmovie.avi