Theoretical WDLF API

class WDPhotTools.theoretical_lf.WDLF(imf_model='C03', ifmr_model='C08', low_mass_cooling_model='montreal_co_da_20', intermediate_mass_cooling_model='montreal_co_da_20', high_mass_cooling_model='montreal_co_da_20', ms_model='PARSECz0017')[source]

Computing the theoretical WDLFs based on the input IFMR, WD cooling and MS lifetime models.

We are using little m for WD mass and big M for MS mass throughout this package.

All the models are reporting in different set of units. They are all converted by the formatter to this set of units: (1) mass is in solar mass, (2) luminosity is in erg/s, (3) time/age is in year.

For conversion, we use (1) M_sun = 1.98847E30 and (2) L_sun = 3.826E33.

compute_density(mag, passband='Mbol', atmosphere='H', interpolator='CT', mass_ms_max=8.0, limit=10000, n_points=100, epsabs=1e-06, epsrel=1e-06, normed=True, save_csv=False, folder=None, filename=None)[source]

Compute the density based on the pre-selected models: (1) MS lifetime model, (2) initial mass function, (3) initial-final mass relation, and (4) WD cooling model. It integrates over the function _integrand().

Parameters:
  • mag (float or array of float) – Absolute magnitude in the given passband

  • passband (str (Default: "Mbol")) – The passband to be integrated in.

  • atmosphere (str (Default: H)) – The atmosphere type.

  • interpolator (str (Default: CT)) – Choose between ‘CT’ and ‘RBF.’

  • mass_ms_max (float (Deafult: 8.0)) – The upper limit of the main sequence stellar mass. This may not be used if it exceeds the upper bound of the IFMR model.

  • limit (int (Default: 10000)) – The maximum number of steps of integration

  • n_points (int (Default: 100)) – The number of points for initial integration sampling, too small a value will lead to failed integration because the integrato can underestimate the density if the star formation periods are short. While too large a value will lead to low performance due to oversampling, though the accuracy is guaranteed. The default value is sufficient to compute WDLF for star burst as short as 1E8 years. For burst as short as 1E7, we recommand an n_points of 1000 or larger.

  • epsabs (float (Default: 1e-6)) – The absolute tolerance of the integration step. For star burst, we recommend a step smaller than 1e-8.

  • epsrel (float (Default: 1e-6)) – The relative tolerance of the integration step. For star burst, we recommend a step smaller than 1e-8.

  • normed (boolean (Default: True)) – Set to True to return a WDLF sum to 1. Otherwise, it is arbitrary to the integrator.

  • save_csv (boolean (Default: False)) – Set to True to save the WDLF as CSV files. One CSV per T0.

  • folder (str (Default: None)) – The relative or absolute path to destination, the current working directory will be used if None.

  • filename (str (Default: None)) – The filename of the csv. The default filename will be used if None.

Returns:

  • mag (array of float) – The magnitude at which the number density is computed.

  • number_density (array of float) – The (arbitrary) number density at that magnitude.

plot_input_models(figsize=(15, 15), title=None, display=True, savefig=False, folder=None, filename=None, ext=['png'], sfh_log=False, imf_log=True, ms_time_log=True, cooling_model_use_mag=True, **kwargs)[source]

Plot the input cooling model.

Parameters:
  • use_mag (bool (Default: True)) – Set to use magnitude instead of luminosity

  • figsize (array of size 2 (Default: (12, 8))) – Set the dimension of the figure.

  • title (str (Default: None)) – Set the title of the figure.

  • display (bool (Default: True)) – Set to display the figure.

  • savefig (bool (Default: False)) – Set to save the figure.

  • folder (str (Default: None)) – The relative or absolute path to destination, the current working directory will be used if None.

  • filename (str (Default: None)) – The filename of the figure. The default filename will be used if None.

  • ext (str (Default: ['png'])) – Image type to be saved, multiple extensions can be provided. The supported types are those available in matplotlib.pyplot.savefig.

  • sfh_log (bool (Default: False)) – Set to plot the SFH in logarithmic space

  • imf_log (bool (Default: False)) – Set to plot the Imass_function in logarithmic space

  • ms_time_log (bool (Default: True)) – Set to plot the MS lifetime in logarithmic space

  • cooling_model_use_mag (bool (Default: True)) – Set to plot the Cooling model in logarithmic space

  • fig (matplotlib.figure.Figure (Default: None)) – Overplotting on an existing Figure.

  • kwargs (dict (Default: {})) – Keyword arguments for the colorbar()

plot_wdlf(log=True, figsize=(12, 8), title=None, display=True, savefig=False, folder=None, filename=None, ext=['png'], fig=None)[source]

Plot the input Initial-Final Mass Relation.

Parameters:
  • log (bool (Default: True)) – Set to plot the WDLF in logarithmic space

  • figsize (array of size 2 (Default: (12, 8))) – Set the dimension of the figure.

  • title (str (Default: None)) – Set the title of the figure.

  • display (bool (Default: True)) – Set to display the figure.

  • savefig (bool (Default: False)) – Set to save the figure.

  • folder (str (Default: None)) – The relative or absolute path to destination, the current working directory will be used if None.

  • filename (str (Default: None)) – The filename of the figure. The default filename will be used if None.

  • ext (str (Default: ['png'])) – Image type to be saved, multiple extensions can be provided. The supported types are those available in matplotlib.pyplot.savefig.

  • fig (matplotlib.figure.Figure (Default: None)) – Overplotting on an existing Figure.

set_ifmr_model(model, ifmr_function=None)[source]

Set the initial-final mass relation (IFMR).

Parameters:
  • model (str (Default: 'EB18')) –

    Choice of IFMR model:

    1. C08 - Catalan et al. 2008

    2. C08b - Catalan et al. 2008 (two-part)

    3. S09 - Salaris et al. 2009

    4. S09b - Salaris et al. 2009 (two-part)

    5. W09 - Williams, Bolte & Koester 2009

    6. K09 - Kalirai et al. 2009

    7. K09b - Kalirai et al. 2009 (two-part)

    8. C18 - Cummings et al. 2018

    9. EB18 - El-Badry et al. 2018

    10. manual

  • ifmr_function (callable function (Default: None)) – A callable ifmr function, only used if model is ‘manual’.

set_imf_model(model, imf_function=None)[source]

Set the initial mass function.

Parameters:
  • model (str (Default: 'C03')) –

    Choice of IFMR model:

    1. K01 - Kroupa 2001

    2. C03 - Charbrier 2003

    3. C03b - Charbrier 2003 (including binary)

    4. manual

  • imf_function (callable function (Default: None)) – A callable imf function, only used if model is ‘manual’.

set_ms_model(model, ms_function=None)[source]

Set the total stellar evolution lifetime model.

Parameters:
  • model (str (Default: 'PARSECz0017')) –

    Choice of MS model are from the PARSEC, Geneva and MIST stellar evolution models. The complete list of available models is as follow:

    1. PARSECz00001 - Z = 0.0001, Y = 0.249

    2. PARSECz00002 - Z = 0.0002, Y = 0.249

    3. PARSECz00005 - Z = 0.0005, Y = 0.249

    4. PARSECz0001 - Z = 0.001, Y = 0.25

    5. PARSECz0002 - Z = 0.002, Y = 0.252

    6. PARSECz0004 - Z = 0.004, Y = 0.256

    7. PARSECz0006 - Z = 0.006, Y = 0.259

    8. PARSECz0008 - Z = 0.008, Y = 0.263

    9. PARSECz001 - Z = 0.01, Y = 0.267

    10. PARSECz0014 - Z = 0.014, Y = 0.273

    11. PARSECz0017 - Z = 0.017, Y = 0.279

    12. PARSECz002 - Z = 0.02, Y = 0.284

    13. PARSECz003 - Z = 0.03, Y = 0.302

    14. PARSECz004 - Z = 0.04, Y = 0.321

    15. PARSECz006 - Z = 0.06, Y = 0.356

    16. GENEVAz002 - Z = 0.002

    17. GENEVAz006 - Z = 0.006

    18. GENEVAz014 - Z = 0.014

    19. MISTFem400 - [Fe/H] = -4.0

    20. MISTFem350 - [Fe/H] = -3.5

    21. MISTFem300 - [Fe/H] = -3.0

    22. MISTFem250 - [Fe/H] = -2.5

    23. MISTFem200 - [Fe/H] = -2.0

    24. MISTFem175 - [Fe/H] = -1.75

    25. MISTFem150 - [Fe/H] = -1.5

    26. MISTFem125 - [Fe/H] = -1.25

    27. MISTFem100 - [Fe/H] = -1.0

    28. MISTFem075 - [Fe/H] = -0.75

    29. MISTFem050 - [Fe/H] = -0.5

    30. MISTFem025 - [Fe/H] = -0.25

    31. MISTFe000 - [Fe/H] = 0.0

    32. MISTFe025 - [Fe/H] = 0.25

    33. MISTFe050 - [Fe/H] = 0.5

  • ms_function (callable function (Default: None)) – A callable MS lifetime function, only used if model is ‘manual’.

set_sfr_model(mode='constant', age=10000000000.0, duration=1000000000.0, mean_lifetime=3000000000.0, sfr_model=None)[source]

Set the SFR scenario, we only provide a few basic forms, free format can be supplied as a callable function through sfr_model.

The SFR function accepts the time in unit of year, which is the lookback time (i.e. today is 0, age of the university is ~13.8E9).

For burst and constant SFH, tophat functions are used:

  • t1 is the beginning of the star burst

  • t2 is the end

  • t0 and t3 are tiny deviations from t1 and t2 required for interpolation

>>>    SFR
>>>    ^                x-------x
>>>    |                |       |
>>>    |                |       |
>>>    |    x-----------x       x-----------------x
>>>        -30E9   0   t3/t2    t1/t0   13.8E9   30E9
>>>                Lookback Time
Parameters:
  • mode (str (Default: 'constant')) –

    Choice of SFR mode:

    1. constant

    2. burst

    3. decay

    4. manual

  • age (float (Default: 10E9)) – Lookback time in unit of years.

  • duration (float (Default: 1E9)) – Duration of the starburst, only used if mode is ‘burst’.

  • mean_lifetime (float (Default: 3E9)) – Only used if mode is ‘decay’. The default value has a SFR mean lifetime of 3 Gyr (SFR dropped by a factor of e after 3 Gyr).

  • sfr_model (callable function (Default: None)) – The free-form star formation rate, in unit of years. If not callable, it reverts to using a constant star formation rate. It is necessary to fill in the age argument.