Definition of the psyTackInterp class.

class posydon.interpolation.interpolation.GRIDInterpolator(path, verbose=False)[source]

Bases: object

Class to interpolate between single star MESA tracks.

path

The path to the directory that contains the h5 grid.

Type

str

keys

Contains valid keys for accessing the data.

Type

tuple of str

Initialize the GRIDInterpolator.

close()[source]

Close any loaded psygrids.

get(key, M_new)[source]

Perform linear interpolation between specific time-series.

Parameters
  • key (str) – The specific time-series described by the key. Valid keys are in the keys attribute.

  • M_new (float) – The associated initial mass which time-series requires interpolation.

Returns

The interpolated ZAMS time-series specified by key associated with the initial mass M_new.

Return type

ndarray

get_final_state(key, M_new)[source]
get_final_values(key, M_new)[source]
get_masses_gridfiles()[source]

Return the masses of the grid files.

Returns

Return type

list of floats

get_profile(key, M_new)[source]
load_grid(*args)[source]

Load the requested data to grid_data.

Parameters

*args – Associated initial masses which corresponding data should be loaded.

posydon.interpolation.interpolation.fscale(u, lim=None, inv=False)[source]

Successively perform min-max rescaling on the last dimension of u.

Parameters
  • u (array_like) – The array which last dimension requires min-max rescaling.

  • lim (sequence of tuple) – The tuples have length 2 and contains the limits on the min-max rescaling. There should be one tuple for each array in the last dimension.

  • inv (bool) – If False then the standard min-max rescaling will be performed. If True then the inverse min-max rescaling to restore and array will be performed.

Returns

The rescaled/original array with the same shape as u.

Return type

ndarray

posydon.interpolation.interpolation.inv_scaler(x, xmin, xmax)[source]

Restore the original array of min-max rescaled array.

Parameters
  • x (array_like) – The array which have been min-max rescaled.

  • xmin (float) – The lower limit of the min-max range.

  • xmax (float) – The upper limit of the min-max range.

Returns

The original array of x that have been min-max rescaled.

Return type

ndarray

class posydon.interpolation.interpolation.psyTrackInterp(path, in_keys=None, interp_in_q=False, verbose=False)[source]

Bases: object

Perform track interpolation for POSYDON.

Initialize the psyTrackInterp class.

Parameters
  • path (string) – The path to the training grid for the interpolator

  • in_keys (List of strings) – A list indicating the variables used for defining the input space, default is None

  • interp_in_q (boolean) – Indicates whether or not mass ratio is to be used, default is false

  • verbose (boolean) – Indicates whether functionality should be run in verbose mode, default is false

close()[source]

Close any loaded psygrids.

evaluate(binary, print_dist=False)[source]

Evaluate given a binary object.

load(filename)[source]

Load interpolation model to be used for predictions.

filenamestr

path/name of pickle file to be loaded.

save(filename)[source]

Save complete interpolation model.

Parameters

filename (str) – path/name of ‘.pkl’ file where the model will be saved.

train(method='NearestNeighbor')[source]

Training method.

posydon.interpolation.interpolation.scaler(x, xmin, xmax)[source]

Perform min-max scaling.

Parameters
  • x (array_like) – The array that requires min-max rescaling.

  • xmin (float) – The lower limit of the range to scale.

  • xmax (float) – The upper limit of the range to scale.

Returns

The rescaled array of x.

Return type

ndarray