vice.yields.agb.interpolator¶
A bi-linear interpolation scheme constructed from the yield tables built into the vice.yields.agb module.
Signature: vice.yields.agb.interpolator(element, study = “cristallo11”)
New in version 1.2.0.
Parameters¶
- element
str
[case-insensitive] The symbol of the element to obtain the yield grid for.
- study
str
[case-insensitive] [default“cristallo11”] A keyword denoting which study to pull the yield table from.
Recognized keywords:
New in version 1.3.0: The “ventura13” and “karakas16” yield models were introduced in version 1.3.0.
Attributes¶
- masses
list
[elements of typefloat
] The masses on which the yield table is sampled.
- metallicities
list
[elements of typefloat
] The metallicities on which the yield table is sampled.
- yields
list
[elements of typelist
] The yields at each stellar mass and metallicity reported by the adopted study.
Calling¶
Call this object with stellar mass and metallicity to compute the fractional net yield for such an AGB star, estimated via bi-linear interpolation.
Parameters:
- massreal number
The stellar mass of an AGB star in solar masses.
- metallicityreal number
The metallicity by mass \(Z\) of the AGB star.
Returns:
- yreal number
The fractional net yield, estimated via bi-linear interpolation. See Notes below.
Tip
This object can be used as a callable object to describe the
AGB star yields of any given element. For the base class, it makes
little sense to do so, since this is the same as setting the yield to
the study itself. However, alternate functionality or interpolation
schema can be achieved by subclassing this object and overriding the
__call__
function.
Notes¶
To conduct the interpolation, this object first finds the masses and metallicities on the grid that enclose the values passed as parameters when this object is called. It then interpolates linearly in metallicity at constant mass twice, then once in mass at constant metallicity to determine the value of the yield at the appropriate mass and metallicity. If the mass and/or metallicity are above or below the maximum or minimum values of the grid, the interpolation scheme falls back on linear extrapolation off of the two largest/smallest values.
This object inherits its functionality from
vice.toolkit.interpolation.interp_scheme_2d
, where the stellar masses
are the x-coordinates, the metallicities the y-coordiantes, and the
yields the z-coordinates. For further details, see the associated
documentation.
Warning
VICE’s AGB star yield interpolation routines force negative
yields to zero below 1.5 \(M_\odot\) in order to prevent numerical
artifacts associated with extrapolation to stellar masses below the
table of yields. This object does not include this functionality;
numerical artifacts may be introduced as a consequence (see “Asymptotic
Giant Branch Stars” under “Nucleosynthetic Yields” in VICE’s science
documentation: https://vice-astro.readthedocs.io/en/latest/science_documentation/index.html).
If this correction is desired, users should subclass this object and
add the following if
statement to the __call__
function for a
value y
returned from the inherited __call__
function:
if mass < 1.5 and y < 0: return 0
.
Example Code¶
>>> import vice
>>> example = vice.yields.agb.interpolator('c')
>>> example.masses
[1.3, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.0]
>>> example.metallicities
[0.0001, 0.0003, 0.001, 0.002, 0.003, 0.006, 0.008, 0.01, 0.014, 0.02]
>>> example.yields[0]
[0.00233122,
0.00206212,
0.00163226,
0.00150313,
0.000781408,
0.000406231,
-5.03077e-05,
-0.000150308,
-0.000317615,
-0.000422]
>>> example.yields[2]
[0.00760034,
0.00650061,
0.0060516,
0.00610347,
0.00510498,
0.00443045,
0.00347925,
0.0035931,
0.0026206,
0.002503]
>>> # the yield at 2.2 solar masses and Z = 0.011
>>> example(2.2, 0.011)
0.004022337000000001
>>> example(5.4, 0.0036)
0.0004046900263999999
>>> example(1.8, 0.018)
0.0017274533333333335