Note
This tutorial was generated from a Jupyter notebook that can be downloaded here.
Timestep options
When creating an animation, tulips
offers multiple options to rescale the time in order to capture all evolutionary phases. This is controlled by the time_scale_type
argument, for which three different options exist: model_number
, linear
and log_to_end
. In this notebook we demonstrate these possibilities.
Note
The time_scale_type
option is only available for the perceived_color
and energy_and_mixing
diagrams. It requires many output models to be stored, which is not always the case for diagrams that rely on MESA profile output.
model_number
The default option model_number
is used for the animations in the tutorials. In this case, the timesteps follow the moments when a new MESA model was saved. This is a non-physical arbitrary timescale that depends on various resolution settings in MESA. We create a energy_and_mixing
animation with this setting for a 11 \(M_{\odot}\) star:
[1]:
# Interactive matplotlib plotting for jupyter lab
%matplotlib inline
# If you use jupyter notebook
# %matplotlib notebook
import matplotlib as plt
import mesaPlot as mp
import tulips
EXAMPLE_DIR = "../../tulips/MESA_DIR_EXAMPLE/"
m = mp.MESA() # Create MESA object
m.loadHistory(filename_in=EXAMPLE_DIR + 'history.data')
[3]:
tulips.energy_and_mixing(m, time_ind=(0,-1,10), fps=30, time_scale_type='model_number', output_fname='em_model_number')
Creating movie...
[3]:
(<Figure size 1100x800 with 3 Axes>,
<AxesSubplot:xlabel='Mass$\\,[\\rm{M}_\\odot]$', ylabel='Mass$\\,[\\rm{M}_\\odot]$'>)
[4]:
from IPython.display import Video
Video("em_model_number.mp4", embed=True, width=700, height=600)
[4]:
linear
Alternatively, when you set time_scale_time='linear'
, the timesteps follow the actual physical age of the star (linearly). During the lifetime of a star, it passes through different stages of stellar evolution. These stages can have vastly different timescales. Stars spend the longest part of their life on the main sequence, whereas the last stages of nuclear burning can last for only a day. When we produce an animation with this setting, the majority of the resulting video therefore shows
the star slowly evolving on the main sequence:
[5]:
tulips.energy_and_mixing(m, time_ind=(0,-1,10), fps=30, time_scale_type='linear', output_fname='em_linear')
Creating movie...
[5]:
(<Figure size 1100x800 with 3 Axes>,
<AxesSubplot:xlabel='Mass$\\,[\\rm{M}_\\odot]$', ylabel='Mass$\\,[\\rm{M}_\\odot]$'>)
[6]:
from IPython.display import Video
Video("em_linear.mp4", embed=True, width=700, height=600)
[6]:
log_to_end
To capture the shorter phases at the end of the evolution of a stellar model, you can rescale the time in such a way that all evolution stages have more similar durations. You can do this by setting time_scale_type='log_to_end'
. When this is set, the time follows \(\textrm{log}_{10}(t_{\textrm{end}} - t)\), where \(t_{\textrm{end}}\) is the final age of the stellar model and \(t\) is the age of the star. As a result, the earlier phases shorten whereas the later phases lengthen.
This allows us to distinguish the different evolutionary stages and also capture the fast transitions. Especially for the energy_and_mixing
diagram this is useful since it reveals the different stages of nuclear burning in more detail.
[7]:
tulips.energy_and_mixing(m, time_ind=(0,-1,10), fps=15, time_scale_type='log_to_end', output_fname='em_log_to_end')
Creating movie...
[7]:
(<Figure size 1100x800 with 3 Axes>,
<AxesSubplot:xlabel='Mass$\\,[\\rm{M}_\\odot]$', ylabel='Mass$\\,[\\rm{M}_\\odot]$'>)
[8]:
from IPython.display import Video
Video("em_log_to_end.mp4", embed=True, width=700, height=600)
[8]: