[mesa-users] Questions...

Warrick Ball wball at astro.physik.uni-goettingen.de
Mon Jan 25 01:16:24 EST 2016


Bruno,

Regarding question 1, the .data files are all (as far as I know?) columned 
ASCII files, which can easily be read by Python.  If you want to see how 
they're structured, just open them in a text editor.  The first few lines 
are data for which there is only one value in the history or profile. e.g. 
the profiles usually include the star's age.

I routinely use two types of NumPy commands to read .data files.  In any 
work or example directory (after it's run), try:

history = np.loadtxt('LOGS/history.data', skiprows=6)

This will read an array with dimensions number of timesteps x number of 
columns of data.

Alternatively, you can also access the columns by name by using

history = np.genfromtxt('LOGS/history.data', skiprows=5, names=True)

This also returns an array, but the columns can be accessed using the 
names that appear in the .data file.  For example, to plot an HR diagram 
(with Pylab, in my case) using the genfromtxt method, use:

pl.plot(history['log_Teff'], history['log_L'])

If you want to see the names of the columns, try:

print(history.dtype.names)

Of course, other MESA users might have smarter ways to view the data!

Cheers,
Warrick


On Sun, 24 Jan 2016, Bruno Lustosa wrote:

> Hello everyone
> 
> MESA managed to install on PC and am fascinated with such power code. I'm still moving a lot and seeing that there
> are some examples in the suite directory. I have some doubts (may seem amateurish) and some can help me?
> 1. What are .data files that I use in python? Would have some routine (script) that would make a DHR simply.
> 2. In the examples I can run pgstar for the graphics appear, that I already know. I am not able to output the data
> already generating a DHR, as I said earlier.
> 
> Thank you for attention
> 
> Bruno.
> 
>


------------
Warrick Ball
Postdoc, Institut für Astrophysik Göttingen
wball at astro.physik.uni-goettingen.de
+49 (0) 551 39 5069


More information about the Mesa-users mailing list