The model module

A module which contains various classes relevant to the grid of models:

These different classes allow the program to store a grid of models and perform a number of operations, such as:

  • retrieving model properties

  • interpolate within the grid models

  • sort the models within a given evolutionary track

class model.Model(_glb, _name=None, _modes=None)[source]

A class which contains a stellar model, including classical and seismic information.

Parameters
  • _glb (np.array) – 1D array of global parameters for this model. Its dimension should be greater or equal to nglb

  • _name (string) – name of the model (typically the second part of its path)

  • _modes (list of (int, int, float, float)) – list of modes in the form of tuples (n,l,freq,inertia) which will be appended to the set of modes in the model.

property FeH

Find [Fe/H] value for model.

The conversion from (Xs,Zs) to [Fe/H] is performed using the following formula:

\(\mathrm{[Fe/H] = \frac{[M/H]}{A_{FeH}} = \frac{1}{A_{FeH}} \log_{10} \left(\frac{z/x}{z_{\odot}/x_{\odot}} \right)}\)

Returns

the \(\mathrm{[Fe/H]}\) value

Return type

float

Note

The relevant values are given in constants

property FeH0

Find initial [Fe/H] value for model.

The conversion from (X,Z) to [Fe/H] is performed using the following formula:

\(\mathrm{[Fe/H] = \frac{[M/H]}{A_{FeH}} = \frac{1}{A_{FeH}} \log_{10} \left(\frac{z/x}{z_{\odot}/x_{\odot}} \right)}\)

Returns

the initial \(\mathrm{[Fe/H]}\) value

Return type

float

Note

The relevant values are given in constants

property MH

Find [M/H] value for model.

The conversion from (Xs,Zs) to [M/H] is performed using the following formula:

\(\mathrm{[M/H] = \log_{10} \left(\frac{z/x}{z_{\odot}/x_{\odot}} \right)}\)

Returns

the \(\mathrm{[M/H]}\) value

Return type

float

Note

The relevant values are given in constants

property MH0

Find initial [M/H] value for model.

The conversion from (X,Z) to [M/H] is performed using the following formula:

\(\mathrm{[M/H] = \log_{10} \left(\frac{z/x}{z_{\odot}/x_{\odot}} \right)}\)

Returns

the initial \(\mathrm{[M/H]}\) value

Return type

float

Note

The relevant values are given in constants

append_modes(modes)[source]

Append a list of modes to the model.

Parameters

modes (list of (int, int, float, float)) – list of modes which are in the form of tuples: (n,l,freq,inertia).

property b_Kjeldsen2008

Return the exponent for the Kjeldsen et al. (2008) surface correction recipe, as calculated based on the Sonoi et al. (2015) scaling relation.

Returns

the Kjeldsen et al. exponent

Return type

float

property beta_Sonoi2015

Return the exponent for the Sonoi et al. (2015) surface correction recipe, as calculated based on the Sonoi et al. (2015) scaling relation.

Returns

the Kjeldsen et al. exponent

Return type

float

property cutoff

Find \(\nu_{\mathrm{cut-off}}\) for model.

The \(\nu_{\mathrm{cut-off}}\) value is obtained from the following scaling relation:

\(\frac{\nu_{\mathrm{cut-off}}}{\nu_{\mathrm{cut-off},\odot}} = \left(\frac{M}{M_{\odot}}\right) \left(\frac{R}{R_{\odot}}\right)^2 \left(\frac{T_{\mathrm{eff}}}{T_{\mathrm{eff},\odot}}\right)^{-1/2}\)

Returns

the \(\nu_{\mathrm{cut-off}}\) value

Return type

float

Note

The relevant values are given in constants

find_epsilon(ltarget)[source]

Find epsilon, the constant offset in a simplified version of Tassoul’s asymptotic formula:

\(\nu_n = \Delta \nu (n + \varepsilon)\)

Parameters

ltarget (int) – target l value. Only modes with this l value will be used in obtaining epsilon.

Returns

the constant offset

Return type

float

find_large_separation()[source]

Find large frequency separation using only radial modes.

Returns

the large frequency separation

Return type

float

find_mode(ntarget, ltarget)[source]

Find a mode with specific n and l values.

Parameters
  • ntarget (int) – target n value

  • ltarget (int) – target l value

Returns

the frequency of the mode

Return type

float

find_mode_range()[source]

Find n and l ranges of the modes in the model.

Returns

the n and l ranges of the modes

Return type

int, int, int, int

freq_sorted()[source]

Check to see if the frequencies are in ascending order for each l value.

Returns

True if the frequencies are in ascending order.

Return type

boolean

get_age()[source]

Return age of stellar model.

This is useful for sorting purposes.

Returns

the age of the model

Return type

float

get_freq(surface_option=None, a=[])[source]

Obtain model frequencies, with optional frequency corrections.

Parameters
  • surface_option (string) –

    specifies the type of surface correction. Options include:

    • None: no corrections are applied

    • "Kjeldsen2008": apply a correction based on Kjeldsen et al. (2008)

    • "Kjeldsen2008_scaling": apply a correction based on Kjeldsen et al. (2008).

      The exponent is based on a scaling relation from Sonoi et al. (2015).

    • "Kjeldsen2008_2": apply a correction based on Kjeldsen et al. (2008).

      The exponent is a free parameter.

    • "Ball2014": apply a one-term correction based on Ball and Gizon (2014)

    • "Ball2014_2": apply a two-term correction based on Ball and Gizon (2014)

    • "Sonoi2015": apply a correction based on Sonoi et al. (2015)

    • "Sonoi2015_scaling": apply a correction based on Sonoi et al. (2015)

      The exponent is based on a scaling relation from Sonoi et al. (2015).

    • "Sonoi2015_2": apply a correction based on Sonoi et al. (2015)

      The exponent is a free parameter.

  • a (array-like) – amplitude parameters which intervene in the surface correction

Returns

models frequencies (including surface corrections)

Return type

np.array

Note

If surface_option==None or a==[], the original frequencies are returned (hence modifying them modifies the Model object).

get_surface_correction(surface_option, a)[source]

Obtain corrections on model frequencies (these corrections should be added to the theorectical frequencies).

Parameters
  • surface_option (string) –

    specifies the type of surface correction. Options include:

    • None: no corrections are applied

    • "Kjeldsen2008": apply a correction based on Kjeldsen et al. (2008)

    • "Kjeldsen2008_scaling": apply a correction based on Kjeldsen et al. (2008).

      The exponent is based on a scaling relation from Sonoi et al. (2015).

    • "Kjeldsen2008_2": apply a correction based on Kjeldsen et al. (2008).

      The exponent is a free parameter.

    • "Ball2014": apply a one-term correction based on Ball and Gizon (2014)

    • "Ball2014_2": apply a two-term correction based on Ball and Gizon (2014)

    • "Sonoi2015": apply a correction based on Sonoi et al. (2015)

    • "Sonoi2015_scaling": apply a correction based on Sonoi et al. (2015)

      The exponent is based on a scaling relation from Sonoi et al. (2015).

    • "Sonoi2015_2": apply a correction based on Sonoi et al. (2015)

      The exponent is a free parameter.

  • a (array-like) –

    parameters which intervene in the surface correction. According to the correction they take on the following meanings:

    • "Kjeldsen2008": a[0]*freq**b_Kjeldsen2008

    • "Kjeldsen2008_scaling": a[0]*freq**b_scaling

    • "Kjeldsen2008_2": a[0]*freq**a[1]

    • "Ball2014": a[0]*freq**3/I

    • "Ball2014_2": a[0]*freq**3/I + a[1]/(freq*I)

    • "Sonoi2015": a[0]*[1 - 1/(1 + (nu/numax)**beta_Sonoi2015)]

    • "Sonoi2015_scaling": a[0]*[1 - 1/(1 + (nu/numax)**beta_scaling)]

    • "Sonoi2015_2": a[0]*[1 - 1/(1 + (nu/numax)**a[1])]

Returns

surface corrections on the model frequencies

Return type

np.array

Note

The array operations lead to the creation of a new array with the result, which avoids modifications of the original frequencies and inertias.

glb

Array which will contain various global quantities

multiply_modes(constant)[source]

Multiply the frequencies by constant.

Parameters

constant (float) – constant by which the mode frequencies are multiplied

name

Name of the model, typically the second part of its path

property numax

Find \(\nu_{\mathrm{max}}\) for model.

The \(\nu_{\mathrm{max}}\) value is obtained from the following scaling relation:

\(\frac{\nu_{\mathrm{max}}}{\nu_{\mathrm{max},\odot}} = \left(\frac{M}{M_{\odot}}\right) \left(\frac{R}{R_{\odot}}\right)^{-2} \left(\frac{T_{\mathrm{eff}}}{T_{\mathrm{eff},\odot}}\right)^{-1/2}\)

Returns

the \(\nu_{\mathrm{max}}\) value

Return type

float

Note

The relevant values are given in constants

print_me()[source]

Print classical and seismic characteristics of the model to standard output.

read_file(filename)[source]

Read in a set of modes from a file. This method will either call read_file_CLES(), read_file_MESA(), or read_file_agsm() according to the value of the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. The format of this file is decided by the mode_format variable in AIMS_configure.py.

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

At this stage the frequencies should be expressed in \(\mu\mathrm{Hz}\). They will be non-dimensionalised in read_model_list_standard().

read_file_CLES(filename)[source]

Read in a set of modes from a file. This uses the “simple” or “CLES” format as specified in the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. The file should contain a one-line header followed by five columns which correspond to l, n, frequency, unused, inertia.

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

  • The fourth column is discarded.

  • Frequencies above config.cutoff * \(\nu_{\mathrm{cut-off}}\) are discarded.

read_file_CLES_Mod(filename)[source]

Read in a set of modes from a file. This uses the “CLES_Mod” format as specified in the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. The file may contain a header (the header lines start with “#”) followed by four columns which correspond to l, n, unused, frequency.

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

  • The third column is discarded.

  • Frequencies above config.cutoff * \(\nu_{\mathrm{cut-off}}\) are discarded.

read_file_MESA(filename)[source]

Read in a set of modes from a file. This uses the GYRE (i.e. MESA) format as specified in the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. The file should contain a seven-line header followed by various columns which contain l, n, frequency, and inertia for each pulsation mode.

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

  • Frequencies above config.cutoff * \(\nu_{\mathrm{cut-off}}\) are discarded.

read_file_PLATO(filename)[source]

Read in a set of modes from a file. This uses the “PLATO” format as specified in the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. The file may contain a header (the header lines start with “#”) followed by four columns which correspond to l, n, frequency, inertia.

Returns

False

Return type

boolean

Note

  • No mode selection is carried out, hence the return value

  • np.loadtxt is used to gain speed (the grid is quite large)

read_file_agsm(filename)[source]

Read in a set of modes from a file. This uses the “agsm” format as specified in the mode_format variable in AIMS_configure.py.

Parameters

filename (string) – name of the file with the modes. This file is a binary fortran “agsm” file produced by the ADIPLS code. See instructions to the ADIPLS code for a description of this format.

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

  • Frequencies above config.cutoff * \(\nu_{\mathrm{cut-off}}\) are discarded.

read_modes_Aldo(norder, farray)[source]

Read in a set of modes from a table. This uses the Aldo format as specified in the mode_format variable in AIMS_configure.py.

Parameters
  • norder (2D numpy int array) – table which gives the starting n values and number of modes per l value

  • farray (1D numpy float array) – table with mode frequencies and inertias as follows: frequency1, inertia1, frequency2, inertia2 …

Returns

True if at least one frequency has been discarded (see note below).

Return type

boolean

Note

  • Frequencies above config.cutoff * \(\nu_{\mathrm{cut-off}}\) are discarded.

remove_duplicate_modes()[source]

Remove duplicate modes.

Modes are considered to be duplicate if they have the same l and n values (regardless of frequency).

Returns

True if at least one mode has been removed.

Return type

boolean

Warning

This method assumes the modes are sorted.

sort_modes()[source]

Sort the modes by l, then n, then freq.

string_to_param(string)[source]

Return a parameter for an input string.

Parameters

string (string) – string that indicates which parameter we’re seeking

Returns

the value of the parameter

Return type

float

write_file_simple(filename)[source]

Write a set of modes into a file using the “simple” format as described in read_file_simple().

Parameters

filename (string) – name of the file where the modes should be written.

Note

  • The output frequencies are expressed in \(\mathrm{\mu Hz}\)

property zsx_0

Find the Z0/X0 value

Returns

the Z0/X0 value

Return type

float

property zsx_s

Find the Zs/Xs value

Returns

the Zs/Xs value

Return type

float

class model.Model_grid[source]

A grid of models.

check_age_adim()[source]

This checks that all of the tracks are sorted according to dimensionless age parameter.

distort_grid()[source]

Define distortion matrix with which to distort grid to break its Cartesian character prior to tessellation. This can cause find_simplex to run much faster.

distort_mat

Transformation matrix used to break the Cartesian character of the grid and reduce computation time

find_epsilons(ltarget)[source]

Find epsilon values in models from the grid

Parameters

ltarget (int) – target l value for which epsilons are being obtained

Returns

the epsilon values

Return type

list of floats

find_partition()[source]

Find a partition of the grid for use with Model_grid.test_interpolation()

Returns

a random partition of [0 … n-1] into two equal halves, where n is the number of tracks in the grid

Return type

two lists of int

grid

Array containing the grid parameters for each evolutionary track (excluding age).

grid_params

Set of parameters (excluding age) used to construct the grid and do interpolations.

Note

For best interpolation results, these parameters should be comparable.

ndim

Number of dimensions for the grid (excluding age), as based on the Model_grid.grid_params variable

ndx

List containing track indices

plot_tessellation()[source]

Plot the grid tessellation.

Warning

This only works for two-dimensional tessellations.

postfix

Last part of the filenames which contain the model frequencies (default = “.freq”).

prefix

Root folder with grid of models (including final slash).

range(aParam)[source]

Find range of values for the input parameter.

Parameters

aParam (str) – name of the parameter for which to find the range

Warning

The input parameter can only be one of the grid parameters or an age/mHe parameter.

read_model_list(filename)[source]

Read list of models from a file and construct a grid. If the mode format is Aldo, an entirely different strategy must be used.

Parameters

filename (string) – name of the file with the list.

read_model_list_Aldo(filename)[source]

Read list of models in Aldo format from a file and construct a grid.

A track in Aldo format contains 3 parts:

  1. A three line header which is discarded.

  2. A set of four lines, for l=0 to 3, which describe the mode structure. The first columns gives the start value of n, whereas the second column gives the number of modes for that particular l value.

  3. A table where each line corresponds to a model and the different columns correspond to the model ID, global quantities, and pulsation frequencies and inertias.

Parameters

filename (string) – name of the file with the list of track files.

read_model_list_standard(filename)[source]

Read list of models from a file and construct a grid.

Parameters

filename (string) –

name of the file with the list. The first line of this file should contain a prefix which is typically the root folder of the grid of models. This followed by a file with multiple columns. The first 9 contain the following information for each model:

  1. the second part of the path. When concatenated with the prefix on the first line, this should give the full path to the model.

  2. The stellar mass in \(\mathrm{g}\)

  3. The stellar radius in \(\mathrm{cm}\)

  4. The stellar luminosity in \(\mathrm{g.cm^2.s^{-3}}\)

  5. The metallicity

  6. The hydrogen content

  7. The stellar age in \(\mathrm{Myrs}\)

  8. The effective temperature in \(\mathrm{K}\)

  9. A dimensionless age parameter

The following columns contain the parameters specified in the AIMS_configure.user_params variable.

remove_tracks(nthreshold)[source]

Removes stellar evolution tracks with fewer than nthreshold models.

Parameters

nthreshold (int) – lower limit on number of models in a stellar evolutionary track

Returns

True if tracks have been removed and the grid needs to be retessellated

Return type

boolean

replace_age_adim()[source]

This replaces the dimensionless ages in the tracks according to the replace_age_adim option chosen in AIMS_configure.py.

tessellate()[source]

Apply Delauny triangulation to obtain the grid tessellation.

tessellation

Object containing the tessellation of the grid used for interpolation.

test_freq()[source]

Test to see if frequencies in all of the models of the grid are in ascending order for each l value.

Returns

The following items are returned

  • the effective temperatures of the models with frequencies out of order

  • the luminosities of the models with frequencies out of order

  • the effective temperatures of the models with sorted frequencies

  • the luminosities of the models with sorted frequencies

Return type

four lists of floats

test_interpolation()[source]

Test interpolation between different evolutionary tracks in a given grid.

Returns

The following four items are returned:

  • the interpolation errors

  • the first half of the partition (where the interpolation is tested)

  • the second half of the partition (used to carry out the interpolation)

  • the tessellation associated with the second half of the partition

Return type

np.array, list, list, tessellation object

tracks

List of evolutionary tracks contained in the grid.

user_params

The set of user parameters involved in the grid. This is to avoid having a different set of user parameters in AIMS_configure.py

class model.Track(aModel, grid_params)[source]

An evolutionary track.

Parameters
  • aModel (Model) – first model to be added to evolutionary track (it does not need to be the youngest model in an evolutionary sequence). This Model is used to obtain the relevant parameters for the evolutionary track (as given by the grid_params variable).

  • grid_params (list of strings) – list of strings which are the names of the parameters which describe the evolutionary track.

age_adim_to_age()[source]

Replace dimensionless age parameter by the physical age.

Warning

This method should only be applied after the track has been sorted (according to age).

age_adim_to_scale_Xc()[source]

Replace dimensionless age parameter by the central hydrogen abundance, Xc, scaled from 0 to 1.

Warning

This method should only be applied after the track has been sorted (according to age).

age_adim_to_scale_age()[source]

Replace dimensionless age parameter by the physical age scaled from 0 to 1.

Warning

This method should only be applied after the track has been sorted (according to age).

property age_lower

Provides the lowest age an evolutionary track.

property age_range

Provides the age range for an evolutionary track.

property age_upper

Provides the highest age for an evolutionary track.

append(aModel)[source]

Append a model to the evolutionary track.

Parameters

aModel (Model) – model which is being appended to the track

append_track(aTrack)[source]

Append a track to the current evolutionary track (i.e. combine the two tracks), and remove the track which has been appended. The resultant track is then sorted according to age.

Parameters

aModel (Model) – model which is being appended to the track

duplicate_ages()[source]

Check to see if the evolutionary track contains models with duplicate ages.

Returns

True if there are duplicate age(s)

Return type

boolean

Warning

This method should only be applied after the track has been sorted.

find_combination(age, coef)[source]

Return a model combination at a given age which is obtained using linear interpolation.

Parameters
  • age (float) – age of desired model in \(\mathrm{Myrs}\)

  • coef (float) – coefficient which multiplies this combination

Returns

pairs composed of an interpolation coefficient and a model name

Return type

tuple of (float, string)

Warning

This method assumes the track is sorted, since it applies a binary search algorithm for increased efficiency.

find_epsilon(imodel, ltarget)[source]

Find epsilon, the constant offset in a simplified version of Tassoul’s asymptotic formula:

\(\nu_n = \Delta \nu (n + \varepsilon)\)

Parameters
  • imodel (ltarget) – model number

  • ltarget (int) – target l value. Only modes with this l value will be used in obtaining epsilon.

Returns

the constant offset

Return type

float

find_large_separation(imodel)[source]

Find large frequency separation using only radial modes.

Parameters

imodel (ltarget) – model number

Returns

the large frequency separation

Return type

float

find_mode_range()[source]

Find n and l ranges of modes in models

Returns

the n and l ranges

Return type

int, int, int, int

find_modes(ntarget, ltarget)[source]

Return two lists, one with the ages of the models and the other with the mode non-dimensional frequencies corresponding to target n and l values.

This function is useful for seeing how the frequency of a particular mode changes with stellar age.

Parameters
  • ntarget (int) – target n value

  • ltarget (int) – target l value

Returns

lists of ages and frequencies

Return type

list, list

find_modes_dim(ntarget, ltarget)[source]

Return two lists, one with the ages of the models and the other with the mode dimensional frequencies corresponding to target n and l values.

This function is useful for seeing how the frequency of a particular mode changes with stellar age.

Parameters
  • ntarget (int) – target n value

  • ltarget (int) – target l value

Returns

lists of ages and frequencies

Return type

list, list

freq_sorted(imodel)[source]

Check to see if the frequencies of model i are in ascending order for each l value.

Parameters

imodel (int) – the number of the model to be checked

Returns

True if the frequencies are in ascending order.

Return type

boolean

glb

Global properties of the models

grid_params

Names of the parameters used to construct the grid

interpolate_model(age)[source]

Return a model at a given age which is obtained using linear interpolation.

Parameters

age (float) – age of desired model in \(\mathrm{Myrs}\)

Returns

the interpolated model

Return type

Model

Warning

This method assumes the track is sorted, since it applies a binary search algorithm for increased efficiency.

is_sorted()[source]

Check to see of models are in ascending order according to age.

Returns

True if the models ar in order of increasing age

Return type

boolean

is_sorted_adim()[source]

Check to see of models are in ascending order according to age.

Returns

True if the models ar in order of increasing age

Return type

boolean

matches(aModel, params_tol=None)[source]

Check to see if a model matches the evolutionary track and can therefore be included in the track.

Parameters
  • aModel (Model) – input model being tested

  • params_tol (float np.array) – the tolerance on each parameter. None means no tolerance (i.e. the parameters have to be exactly the same).

Returns

True only if all of the parameters of the input model match those of the evolutionary track within the provided tolerances

Return type

boolean

mode_indices

starting indices in Track.modes array corresponding to a given model

modes

array containing the modes (n, l, freq, inertia) of all of the models

names

List of model names

nmodes

Total number pulsation modes from all of the models in this evolutionary track

params

Parameters which characterise this evolutionary track

remove_duplicate_ages()[source]

Removes models with duplicate ages from the evolutionary track.

Returns

True if models with duplicate age(s) have been removed

Return type

boolean

Warning

This method should only be applied after the track has been sorted.

sort()[source]

Sort models within evolutionary track according to age.

test_interpolation(nincr)[source]

Test accuracy of interpolation along evolutionary track.

This method removes every other model and retrieves its frequencies by interpolation from neighbouring models. The accuracy of the interpolated frequencies and global parameters are tested by carrying out comparisons with the original models.

Parameters

nincr (int) – increment with which to carry out the interpolation. By comparing results for different values of nincr, one can evaluate how the interpolation error depends on the size of the interval over which the interpolation is carried out.

Returns

the interpolation errors

Return type

np.array

model.age_adim_str = 'Age_adim'

Name of the non-dimensional age parameter used in the interpolation

model.age_str = 'Age'

Name of the physical age parameter used in the interpolation

model.combine_models(model1, coef1, model2, coef2)[source]

Do linear combination of this model with another.

This method returns a new model which is the weighted sum of two models for the purposes of model interpolation. The classical parameters are combined in a self-consistent way as are the frequencies.

Parameters
  • model1 (Model) – first model

  • coef1 (float) – weighting coefficient applied to first model

  • model2 (Model) – second model

  • coef2 (float) – weighting coefficient applied to second model

Returns

the combined model

Return type

Model

Warning

One should avoid negative or zero coefficients as these could lead to undefined results.

model.compare_models(model1, model2)[source]

Compare two models and find the largest frequency different for radial and non-radial modes.

Parameters
  • model1 (Model) – first model

  • model2 (Model) – second model

Returns

a 1D array to be used in plot_test_interpolation.py with the following measurements of the differences between the two models:

  • result[0] = maximum error on the radial modes

  • result[1] = RMS error on the radial modes

  • result[2] = RMS error on the radial modes near \(\nu_{\mathrm{max}}\)

  • result[3] = maximum error on the non radial modes

  • result[4] = RMS error on the non radial modes

  • result[5] = RMS error on the non radial modes near \(\nu_{\mathrm{max}}\)

  • result[6+[0:nglb]] = errors on the global parameters

Return type

np.array

model.eps = 1e-06

relative tolerance on parameters used for setting up evolutionary tracks

model.find_ages(coefs, tracks, age)[source]

Find ages to which each track needs to be interpolated for a specified age. The variable age_interpolation in AIMS_configure.py decides between the following options:

  1. age_interpolation = age: each track is simply interpolated to age.

  2. age_interpolation = scale_age: the age of each model along each evolutionary track, including the interpolated track, is linearly mapped onto the interval [0,1]. A dimensionless parameter eta is obtained by interpolating age onto the interval [0,1], using the linear transformation associated with the interpolated track. Using the parameter eta, a corresponding age is obtained along each track.

  3. age_interpolation = age_adim: each track is interpolated to the appropriate dimensionless age so that the interpolated physical age reproduces the input age. This dimensionless age parameter is calculated via a fortran subroutine.

_images/age_interpolation.svg

This diagram illustrates age interpolation for the two first options, namely age and scale_age, and shows the advantages of selecting the latter.

Parameters
  • coefs (list of floats) – interpolation coefficients used to weight each track.

  • tracks (list of Track) – evolutionary tracks involved in the interpolation.

  • age (float) – target age for the output interpolated model.

Returns

the relevant age for each track

Return type

list of floats

Note

  • the interpolation coefficients should add up to 1.0

  • there should be as many tracks as interpolation coefficients.

model.find_combination(grid, pt)[source]

Find linear combination of models which corresponds to interpolating the model based on the provided parameters.

The interpolation is carried out using the same procedure as in interpolate_model().

Parameters
  • grid (Model_grid) – grid of models in which we’re carrying out the interpolation

  • pt (array-like) – set of parameters used for the interpolation. The first part contains the grid parameters, whereas the last element is the age. If the provided set of parameters lies outside the grid, then None is returned instead of an interpolated model.

Returns

pairs of coefficients and model names

Return type

tuple of (float,string)

model.find_interpolation_coefficients(grid, pt, tessellation, ndx)[source]

Find interpolation weights from the corresponding simplex.

Linear interpolation weights are obtained with the simplex by finding the barycentric coordinates of the point given by pt.

Parameters
  • grid (Model_grid) – grid of models in which we’re carrying out the interpolation

  • pt (array-like) – set of parameters used for finding the interpolation weights. The first part contains the grid parameters (relevant to this interpolation), whereas the last element is the age (not used here). If the provided set of parameters lies outside the grid, then None is returned instead of an interpolated model.

  • tessellation (Delaunay tessellation object) – tessellation with which to carry out the interpolation.

  • ndx (list of int) – indices of the grid points associated with the tessellation

Returns

lists of interpolation coefficients and tracks

Return type

list of floats, list of Track

model.ftype

type used for the frequencies

model.get_surface_parameter_names(surface_option)[source]

Return the relevant parameter names for a given surface correction option.

Parameters

surface_option (string) – specifies the type of surface correction.

Returns

names for the surface parameters

Return type

tuple of strings

model.gtype

type used for grid data

model.iage = 1

index of the parameter corresponding to age in the Model.glb array

model.iage_adim = 0

index of the parameter corresponding to dimensionless age in the Model.glb array

model.ifreq_ref = 12

index of the parameter corresponding to the reference frequency (used to non-dimensionalise the pulsation frequencies of the model) in the Model.glb array

model.iluminosity = 14

index of the parameter corresponding to luminosity in the Model.glb array

model.imass = 2

index of the parameter corresponding to mass in the Model.glb array

model.init_user_param_dict()[source]

Initialise the dictionaries which are related to user-defined parameters. For a given parameter, these dictionaries provide the appropriate index for for the Model.glb array as well as the appropriate latex name.

model.interpolate_model(grid, pt, tessellation, ndx)[source]

Interpolate model in grid using provided parameters.

The interpolation is carried out in two steps. First, linear interpolation according to age is carried out on each node of the simplex containing the set of parameters. This interpolation is done using the Track.interpolate_model method. Then, linear interpolation is carried out within the simplex. This achieved by finding the barycentric coordinates of the model (i.e. the weights), before combining the age-interpolated models form the nodes using the combine_models method. In this manner, the weights are only calculated once, thereby increasing computational efficiency.

Parameters
  • grid (Model_grid) – grid of models in which we’re carrying out the interpolation

  • pt (array-like) – set of parameters used for the interpolation. The first part contains the grid parameters, whereas the last element is the age. If the provided set of parameters lies outside the grid, then None is returned instead of an interpolated model.

  • tessellation (Delaunay tessellation object) – tessellation with which to carry out the interpolation.

  • ndx (list of int) – indices of the grid points associated with the tessellation

Returns

the interpolated model

Return type

Model

model.iradius = 13

index of the parameter corresponding to radius in the Model.glb array

model.itemperature = 3

index of the parameter corresponding to temperature in the Model.glb array

model.ix0 = 5

index of the parameter corresponding to the initial hydrogen content in the Model.glb array

model.iz0 = 4

index of the parameter corresponding to the initial metallicity the Model.glb array

model.log0 = -1e+150

value which is returned when log(0) is calculated (rather than causing an error)

model.ltype

type used for the l values

model.make_distort_matrix(d, theta=0.157)[source]

Create a distortion matrix which can be used to make the grid more “tessellation-friendly”, i.e. which leads to much shorter computation times for finding simplices.

Parameters
  • d (int) – number of dimensions

  • theta (float) – a small angle

Returns

a distortion matrix

Return type

2D float array

model.make_scale_matrix(grid)[source]

Create a distortion matrix which can be used to make the grid more “tessellation-friendly”, i.e. which leads to much shorter computation times for finding simplices.

Parameters

grid – set of points used in the construction of the tessellation

Returns

a distortion matrix

Return type

2D float array

model.modetype = [('n', <class 'numpy.int16'>), ('l', <class 'numpy.int8'>), ('freq', <class 'numpy.float64'>), ('inertia', <class 'numpy.float64'>)]

structure for modes

model.nglb = 15

total number of global quantities in a model (see Model.glb).

model.nlin = 12

total number of global quantities which are interpolated in a linear way (see combine_models()). These quantities are numbered 0:nlin-1

model.ntype

type used for the n values

model.string_to_latex(string, prefix='', postfix='')[source]

Return a fancy latex name for an input string.

Parameters
  • string (string) – string that indicates for which parameter we’re seeking a latex name

  • prefix (string) – optional prefix to add to the string

  • postfix (string) – optional postfix to add to the string

Returns

a fancy latex name

Return type

string

Note

This also works for the names of the amplitude parameters for surface corrections.

model.tol = 1e-06

tolerance level for points slightly outside the grid

model.user_params_index = {}

dictionary which will supply the appropriate index for the user-defined parameters

model.user_params_latex = {}

dictionary which will supply the appropriate latex name for the user-defined parameters