grid

aims3.grid.load_text_grid(filename, mode_loader=<function <lambda>>, progress=False)

Load a grid from a listing in filename.

Parameters
  • filename (str) – filename of the main grid listing

  • mode_loader (function) – a function that takes a mode table filename and returns a structured NumPy array with columns 'l', 'n', 'freq' and 'inertia'.

  • progress (bool) – show a basic progress report

Returns

grid

Return type

Grid

aims3.grid.load_binary_grid(filename)

Unpickle a precomputed binary grid from filename.

Parameters

filename (str) – filename of the pickled Grid.

Returns

grid

Return type

Grid

class aims3.grid.Grid(tracks=[], param_names=[], metadata={}, distortion_matrix=None, tessellation=None)

An object representing information about a grid of stellar tracks. A Grid is really a list of Tracks with a few extra functions for linear interpolation at parameters between the tracks, a dictionary of arbitrary metadata, and a list of column names that specify the track parameters (e.g. ['M', 'Z0']).

You can access elements with [...] indexing in a number of ways.

  • An integer n returns the n-th track in the grid.

  • A slice or list of integers returns a new Grid containing the corresponding models.

  • A string or list of strings either returns the corresponding entry from the metadata dict or an array with the corresponding grid parameters. Anything else will raise a KeyError.

refresh_params()

If we touch the list of tracks, we need to update the list of parameter values.

append(track)

Append the Track object track to the grid.

extend(tracks)

Extend the grid by the given Grid or list of Tracks.

tessellate(perturb=True)

Compute the tessellation. This needs to be called before interpolate(). If perturb=True (the default), fractional perturbations on the order of 1e-11 are added to the points so that the tessellation of a regular grid is robust to transformations.

interpolate(params, age_name='t', scale=False, weight_tol=1e-08)

Interpolate a stellar model at the give parameters. You must call tessellate() before calling interpolate.

Parameters
  • params (iterable of floats) – The parameters at which to interpolate. The last parameter is the evolutionary parameter (usually age); the others are the grid parameters in the same order as the attribute param_names.

  • age_name (str) – Column name of the age parameter (usually the age; default=’t’).

  • scale (bool) – If True, interpolate at a scaled version of the evolutionary parameter.

  • weight_tol (float) – If any weight in the linear interpolation is less than weight_tol, treat it as zero.

Returns

model – The model interpolated at the parameters params.

Return type

Model

to_binary_file(filename, **kwargs)

Save the grid to filename in binary format using pickle.dump. Extra keyword arguments kwargs are passed to pickle.dump.

This is the inverse of load_binary_grid().

to_text_file(filename, save_models=False)

Save the grid listing to filename in plain text format. If save_models is True, also save the model files.

This is the inverse of load_text_grid().