synthpop.modules.evolution.charon_interpolator

An interpolator for the isochrone grid

Within each isochrone, it uses a cubic interpolation between adjacent grid-points.

It aligns the phases between adjacent ages and performs a linear interpolation in metallicity and age.

See Klüter & Huston et al (SynthPop Paper I, in prep).

Classes

CharonInterpolator

Performs an interpolation using lagrangian polynomials

Module Contents

class synthpop.modules.evolution.charon_interpolator.CharonInterpolator(isochrones=None, props_no_charon=None, coins=2, **kwargs)

Bases: synthpop.modules.evolution._evolution.EvolutionInterpolator

Performs an interpolation using lagrangian polynomials 2 order for the mass (linear if it is at the edge of the isochrone grid) and a linear interpolation for age and metallicity

Methods

lagrange_poly(x, grid, fgrid)ndarray

performs interpolation using lagrange polynomials

grid_n4(grid, value)ndarray, ndarray

get the closest points from the isochrones mass grid

combined_grid(met_key, mass, iso_ages, props)ndarray, ndarray

get the grid points for different metallicities and ages

interp_props(self,track,mass,age,props)dict

interp the properties using the isochrones.

get_evolved_props () : dict, ndarray

interpolator_name = 'Charon_Polynomials'
accept_np_arrays = True
log_ages
lin_ages
iso_met
props_no_charon
get_tip_func()
static grid_n4(grid, value)

Gets the nearest four points in grid to value. If the value is inside the grid it will return the two values on either side (y) and their indices (x) If the value is outside the grid it returns 4 times the closest value ant its indices If the value is below/above the second lowest/or highest value it returns 2 times the next-lowest/second-highest value and two time the second-lowest/next-highest value and their indices This triggers the interpolation to switch to a linear interpolation between both values

Parameters

grid: pandas.DataFrame value: ndarray

Returns

indicesndarray

indices for the 4 closest neighbours (two upper + two lower)

valuesndarray

grid values for the 4 closest neighbours (two upper + two lower)

static lagrange_poly(x, grid, fgrid)

cubic interpolation function using the lagrange polynomial Poly = sum_{i} f_{i} * Pi_{j, j!=i} (x-xj)/(xi-xj) Interpolation function Uses a lower order if the grid has fewer than 4 unique grid points (combined grid is defined in a way that it produces 4,2 or 1 unique grid points)

Parameters

x: ndarray

values at which the grid should be interpolated

grid: ndarray

grid points. must have shape […, 1, j]

fgrid: ndarray

function values for each grid point must have shape […, i, j] where

Returns

f: ndarray

interpolated value for f(x)

combined_grid(mass, iso_met, iso_ages, props)

Creates a combined grid for the different stars, Uses the isochrone based on each individual metallicity and age uses the grid_n4 to find adjacent entries for the masses

creates a numpy data array which contains the properties for the selected grid cells

Parameters

mass : ndarray iso_met :ndarray iso_ages : ndarray props : list

Returns

grid : ndarray data : ndarray

interp_props(mass, met_grid, log_age_grid, props)

Interpolates the isochrones and returns the value at the given mass metallicity and age. Determines the closets 2 upper and lower neighbours grid and performs a cubic interpolation using the lagrange polynomials. At the edge of isochrone grid it only performs a linear interpolation and outside it uses the closest grid point.

Parameters:

massndarray

initial mass for each star

met_grid: ndarray

numpy array of metallicity dictionary key for each star.

log_age_grid: ndarray

numpy array of iso_ages as defined in the isochrones,

propsSet

list of properties which should be derived from the interpolation

Returns

inter_props returns a dictionary with interpolated values for each property

get_modified_mass(mass, met, log_age, grid_met, grid_log_age)

This function estimates the modified mass. by shifting the mass such that the phase transition points.

Parameters

mass met log_age grid_met grid_log_age

Returns

get_adjacent_gridpoints(met, log_ages)

Estimates the adjacent metallicity and age grid-points Parameters ———- met : np.ndarray

metallicity for each star

log_ages: np.ndarray

log10(age) for each star

Returns

iso_met_lower iso_met_higher log_iso_ages_lower log_iso_ages_higher iso_ages_lower iso_ages_higher

static get_weights(met, age, iso_met_lower, iso_met_higher, iso_ages_lower, iso_ages_higher)

Estimates the weights for each grid-point

Parameters

met age iso_met_lower iso_met_higher iso_ages_lower iso_ages_higher

Returns

get_evolved_props(m_init: numpy.ndarray, met: numpy.ndarray, age: numpy.ndarray, props: Set, inter_age: str = 'linear')

Parameters

m_initndarray [Msun]

inital masses for the stars

metndarray [dex]

initial metallicities for the stars

agendarray [Gyr]

ages for the stars

propsSet

list of stellar properties that should be returnd

inter_age: str [“linear” or “log”]

performe the age interpolation in age or in log10(age).

Returns

s_track : dict in_grid : ndarray