Skip to main content

DOI

mesaplot

Library of python routines to read MESA ouput files and plot MESA quantites

Installation instructions:

git clone the repo then call

python3 setup.py install 

Depending on choice of python version, --user can also be passed to install locally

make

Can be called as well

Testing

pytest

To run tests for current python version

tox

will run tests for several python versions

Contributing

Bug reports should go to githubs issue tracker.

Requests for new features should also got to the issue tracker.

If you wish to submit your own fix/new feature please send a pull request.

Reading data:

import mesaPlot as mp
m=mp.MESA()

Now m contains all the useful stuff

History files

m.loadHistory()

This loads up the history file data by default it will look for LOGS/history.data. But if you have a different folder to look at then you can either

m.log_fold='new_folder/LOGS/'
m.loadHistory()

or

m.loadHistory(f='new_folder/LOGS/')

Note this will automatically clean the history data of retries, backups and restarts. To write that data back to disk

m.scrubHistory()

Which will create a file "LOGS/history.data.scrubbed" if you don't want that then:

m.scrubHistory(fileOut='newFile')

Data can be accessed as m.hist.data['COLUMN_NAME'] or m.hist.COLUMN_NAME. The second option is also tab completable. The header information is either m.hist.head['COLUMN_NAME'] or m.hist.COLUMN_NAME.

Profile files

To load a profile file its:

m.loadProfile()

Again you change the LOGS folder either with log_fold or f=. To choose which file to load, either:

m.loadProfile(num=MODEL_NUMBER)
or
m.loadProfile(prof=PROFILE_NUMBER)

Where MODEL_NUMBER is a MESA model number and PROFILE_NUMBER is the number in the profile file name. You can also set a mode

m.loadProfile(num=MODEL_NUMBER,mode='first|lower|upper|nearest')

This is for when the model you want isn't in the data. Either we load the first model, the model just before the one you want, the model just after the one you want or the nearest (above or below) the model you want. There are also two special model numbers 0 for first model and a negative number that counts backwards (-1 is the last model, -2 is last but one etc)

Data can be accessed as m.prof.data['COLUMN_NAME'] or m.prof.COLUMN_NAME. The second option is also tab completable. The header information is either m.prof.head['COLUMN_NAME'] or m.prof.COLUMN_NAME.

NOTE: To speed up repeated readings of the LOG data, mesaPlot saves a binary version of the data (taking care to regenerate this file if the history/profile is updated). This binary file SHOULD NOT be depended upon for long term storage. The file format may change between versions and is not backward compatable. For long term storage allways keep the plain text history/profile file (possibly compressed to save space).

Plotting

Here we'll show the basics of plotting, there are more complex examples for each section. Commands will assume you are in a MESA work folder, such that the data is in a LOGS/ folder.

History data

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotHistory(m,xaxis='star_age',y1='log_center_T',y2='he_core_mass')

Profile data

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotProfile(m,xaxis='mass',y1='logT',y2='ye')

HR

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotHR(m)

Kippenhan's

Kippenhan plot with model number vs mass. Note all Kippenhan plots require your history file to have both mixing_regions X and burning_regions Y set in your history_columns.list file, where X and Y are integers that specify the maximum number of mixing/burning zones in your model, values around 20 will usually suffice. Models going to core collapse may want to increase this limit to 40.

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotKip(m,show_mass_loc=True)

Kippenhan plot with star age vs mass

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotKip2(m)

Generic kippenhan plotter

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotKip3(m,show_mass_loc=True)

Kippenhan plotKip3 SAGB star

New way of doing plotKip2 (star age vs mass)

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotKip3(m,xaxis='star_age',age_lookback=True,age_log=True)

Kippenhan plotKip3 SAGB star 2

Profile based kippenhans

import mesaPlot as mp

m=mp.MESA()
m.loadHistory()
m.loadProfile(num=1)
p=mp.plot()
p.plotKip3(m,plot_type='profile',xaxis='model_number',yaxis='mass',zaxis='logRho',mod_min=1,mod_max=3000)

Kippenhan plotKip3 SAGB star 3

Abundances

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotAbun(m)

Basic abundance plot

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotAbunByA(m)

Production plot

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
m2=mp.MESA()
m2.log_fold='../some/other/mesa/result'
m2.loadprofile(num=-1)
p.plotAbunByA(m,m2=m2)
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
p.set_solar('ag89')
m.loadProfile(num=-1)
#Plot the mass fractions relative to solar
p.plotAbunByA(m,stable=True)
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
p.set_solar('ag89')
m.loadProfile(num=-1)
m2=mp.MESA()
m2.log_fold='../some/other/mesa/result'
m2.loadprofile(num=-1)
#Plot the mass fractions relative to solar relative to 2nd model
p.plotAbunByA(m,m2=m2,stable=True)
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
#Use the data in the history file at model_number==model
p.plotAbunByA(m,plot_type='history',model=1000,prefix='log_center_')
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
p.set_solar('ag89')
m.loadHistory()
#Use the data in the history file, plotting relative to another model number after decaying the isotopes to thier stable versions
p.plotAbunByA(m,plot_type='history',model=1000,model2=1,prefix='surface_',stable=True)
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotAbunPAndN(m)

Nuclear abundances plot

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotAbunPAndN(m,plot_type='history',model=1000,prefix='log_center_')
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotAbunHist(m)

Burn data

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotBurn(m)
import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadHistory()
p.plotBurnHist(m)

Dynamos

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotDynamo(m)

Dynamo  50M_z2m2_high_rotation

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotDyanmo2(m)

Dyanmo 2 50M_z2m2_high_rotation

Angular momentum mixing

import mesaPlot as mp
m=mp.MESA()
p=mp.plot()
m.loadProfile(num=-1)
p.plotAngMom(m)

Time series Profile plots

import mesaPlot as mp

m=mp.MESA()
m.loadHistory()
m.loadProfile(num=1)
p=mp.plot()
p.plotSliderProf(m,'plotAbun')

Passing in a string for the name of a plotting function, (only ones based on profile data). This will show that plot with a slider that can be used to iterate over the available profile files plotSliderProf will take any extra arguments passed to it and pass them to the plotting function.

Stacked plots

Multi profile plots

Grid plotting

Metadata

Release files for mesaPlot 2.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mesaPlot 2.0.11
File Size Uploaded
mesaplot-2.0.11.tar.gz 4.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for mesaPlot 2.0.11
File Interpreter ABI Platform
mesaPlot-2.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 4.4 MB

Release files / mesaplot-2.0.11.tar.gz

Download URL mesaplot-2.0.11.tar.gz
Size 4.4 MB
Tags Source
SHA-256 checksum
How to use checksums
f23cf822a9262cfff0d91d766fab73a4e528df2613a0eb34943a9e91ed3a4a7b
BLAKE2b-256 checksum
How to use checksums
2f90c00880824f3daf83db417aacee46c28383d72e81079c738ed1a661b834ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 17, 2025.

Transparency log

Release files / mesaPlot-2.0.11-py3-none-any.whl

Download URL mesaPlot-2.0.11-py3-none-any.whl
Size 51.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e9374421910323941f8ef0110e3206d25946a002efeaaa4471f796ae35b428d
BLAKE2b-256 checksum
How to use checksums
c17e8162b6af6626cbb0a7dbdc2a8c5a3189ac318c9de5ff915adae73edd07ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.11 This release

2 release files

2.0.10

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.0

2 release files

0.0

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page