Use wdwarfdate to derive white dwarf ages

In this tutorial we are going to estimate the ages of two white dwarfs using wdwarfdate. We are going to start by importing all the packages we are going to need

[1]:
import wdwarfdate
import numpy as np
import time

We are going to set up the white dwarfs’s effective temperatures and surface gravity obtained from Cummings,J.D. et al. 2018.

[2]:
#Define data for the white dwarf
teffs = np.array([19250,20250])
teffs_err = np.array([500,850])
loggs = np.array([8.16,8.526])
loggs_err = np.array([0.084,0.126])

Now we run the age estimation using wdwarfdate and record the time it takes to run. We are going to explicitly indicate the models we want to use:

  1. model_wd = 'DA', to indicate we want to use the thick outermost hydrogen layer model. This could be non-DA to use the thin layer model.

  2. model_ifmr = 'Cummings_2018_MIST', for the initial-to-final mass relation.

  3. feh = 'p0.00' and vvcrit='0.0', for the isochrone of the progenitor star.

These are the default models so we do not need to do it in this case, but we will write them down to be clear. For a list of the models that can be used with wdwarfdate, go the page Models included in the documentation. The rest of the parameters we are going to specify:

  1. high_perc = 84, low_perc = 16: high and low percentiles we want to use to calculate the errors for each parameter.

  2. data_type = 'Gyr': units of the resulting ages. This can be yr, Gyr or log.

  3. save_plots = False: With this parameter we decide to not save the resulting plots.

  4. display_plots=True: With this parameter we decide to display the resulting plots in jupyter notebook.

[3]:
start_time = time.time()
WD = wdwarfdate.WhiteDwarf(teffs,teffs_err,loggs,loggs_err,
                           model_wd='DA',feh='p0.00',vvcrit='0.0',
                           model_ifmr = 'Cummings_2018_MIST',
                           high_perc = 84, low_perc = 16,
                           datatype='Gyr',
                           save_plots=True, display_plots=True)
WD.calc_wd_age()
end_time = time.time()

print(f'Time to run two white dwarfs: {np.round(end_time-start_time,2)}s')
Running Teff = 19250 +/- 500 K, logg = 8.16 +/- 0.08
Grid limits used to evaluate the posterior: mi = 0.95-3.98 Msun, log10_tcool = 7.71-8.31
../_images/tutorials_bayesian_method_6_1.png
../_images/tutorials_bayesian_method_6_2.png
Running Teff = 20250 +/- 850 K, logg = 8.53 +/- 0.13
Grid limits used to evaluate the posterior: mi = 1.92-6.66 Msun, log10_tcool = 7.86-8.67
../_images/tutorials_bayesian_method_6_4.png
../_images/tutorials_bayesian_method_6_5.png
Time to run two white dwarfs: 40.97s
[4]:
WD.results
[4]:
Table length=2
ms_age_medianms_age_err_lowms_age_err_highcooling_age_mediancooling_age_err_lowcooling_age_err_hightotal_age_mediantotal_age_err_lowtotal_age_err_highinitial_mass_medianinitial_mass_err_lowinitial_mass_err_highfinal_mass_medianfinal_mass_err_lowfinal_mass_err_high
float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64
1.00858474938886290.49494237253098161.37087964861394870.104893506846383430.0207700673435275570.024497912796294821.1151860292624580.479178573384645871.34356612139419052.2841660899653980.68877508650519050.6056470588235290.684417054736670.0453182617224749950.049727065362504375
0.165538419203285240.0543118764637803560.093235372828552240.207092512062511640.0480057778991606340.0605243198277875260.389669216510136640.0426821430965430.0581840476640447254.33937716262975750.66867820069204110.74297577854671280.93872835048906080.071287560580878820.07383056622074491

The option save_plots = True will save several files to a folder called ‘results’, or any path we choose using the path parameter. Below we describe each of the files wdwarfdate method creates. In order of appearence (above):

  1. “teff_19250_logg_8.16_feh_p0.00_vvcrit_0.0_DA_Cummings_2018_MIST_gridplot.png”: grid plot for the three independent variables: initial mass, cooling age and delta m.

  2. “teff_19250_logg_8.16_feh_p0.00_vvcrit_0.0_DA_Cummings_2018_MIST_distributions.png”: Parameter distribution for the final mass and cooling age of the white dwarf, mass and main sequence age of the progenitor star and total age of the object.

The fast-test method

The fast-test method included in wdwardate generates a gaussian distribution for each pair of teff and logg using the uncertainties as standard deviation, and runs the full distribution through a chain of models to calculate the total age of the white dwarf, and the rest of the parameters described above. Below we show an example of the fast-test method.

[5]:
WD2 = wdwarfdate.WhiteDwarf(teffs,teffs_err,loggs,loggs_err,
                           method='fast_test',
                           model_wd='DA',feh='p0.00',vvcrit='0.0',
                           model_ifmr = 'Cummings_2018_MIST',
                           high_perc = 84, low_perc = 16,
                           datatype='Gyr', return_distributions=True,
                           save_plots=False, display_plots=True)
WD2.calc_wd_age()
Running teff:19250 logg:8.16
../_images/tutorials_bayesian_method_10_1.png
Running teff:20250 logg:8.526
../_images/tutorials_bayesian_method_10_3.png

The parameters used in the wdwarfdate.WhiteDwarf for the fast-test method are similar to the Bayesian method. In this case we also set return_distributions = True, which will generate that one of the comlumns of the resulting Table of results will have the distributions for each parameter in the case of . For a detailed comparison of the two methods, go to the paper describing wdwarfdate (Kiman et al. in prep). Also, from the output plots described above, in this method we only get the distributions of the parameters.

[6]:
WD2.results_fast_test
[6]:
Table length=2
ms_age_medianms_age_err_lowms_age_err_highcooling_age_mediancooling_age_err_lowcooling_age_err_hightotal_age_mediantotal_age_err_lowtotal_age_err_highinitial_mass_medianinitial_mass_err_lowinitial_mass_err_highfinal_mass_medianfinal_mass_err_lowfinal_mass_err_highms_age_distcooling_age_disttotal_age_distinitial_mass_distfinal_mass_dist
float64float64float64float64float64float64float64float64float64float64float64float64float64float64float64objectobjectobjectobjectobject
0.54498901506414490.132878650391750170.58687049398500060.115718598985855750.0230903740215515630.027108338521485130.66207958765024940.108777159336203240.55814684131506252.8207525499539210.6286606539001580.300164297893946050.71466020399631370.050292852312012640.05295124655123751[1.12974438 0.46235549 0.33118812 ... 0.30315244 0.41602609 1.35233035][0.09528708 0.12230955 0.18047687 ... 0.16698275 0.14583674 0.08696624][1.22503146 0.58466504 0.51166498 ... 0.47013518 0.56186283 1.43929659][2.1933516 2.99287636 3.35776755 ... 3.46489022 3.11106523 1.98412644][0.66446813 0.74366788 0.81190253 ... 0.83193447 0.7657692 0.64773012]
0.152427467103472880.0459808783689091140.096304503045772760.209735774966563180.05072775439094840.061533448461898040.38022780341127520.035016104937890810.0553217973272673864.4790764006607270.75708694028122550.69488315288847070.95026117487069770.081008302610091070.07435249735906635[0.25352724 0.12204163 0.08092531 ... 0.24108948 0.14602959 0.23467511][0.1374518 0.23143196 0.30562059 ... 0.12741409 0.2353348 0.16256821][0.39097904 0.35347359 0.38654591 ... 0.36850357 0.38136439 0.39724332][3.69646729 4.89155363 5.81027686 ... 3.76424812 4.55449404 3.80144745][0.866522 0.99439624 1.09269962 ... 0.87377455 0.95833086 0.87775488]