The plot_interpolation_test tool

An interactive utility which plots various forms of interpolation error, stored in a binary file produced by AIMS.test_interpolation(). It specifically tests the errors from two types of interpolation:

  • age interpolation: this is interpolation along a given evolutionary track
  • track interpolation: this is interpolation between different evolutionary tracks

This utility allows various types of plots:

  • 3D plots of interpolation errors as a function of grid structural parameters
  • 2D slices which show interpolation errors as a function of age for a given evolutionary track
  • interactive plots which allow you to select 2D slices

Note

Interpolation errors for models in a given evolutionary track are typically stored in arrays as follows:

  • result[model_number,ndim+0] = maximum error on the radial modes
  • result[model_number,ndim+1] = RMS error on the radial modes
  • result[model_number,ndim+2] = RMS error on the radial modes near \(\nu_{\mathrm{max}}\)
  • result[model_number,ndim+3] = maximum error on the non radial modes
  • result[model_number,ndim+4] = RMS error on the non radial modes
  • result[model_number,ndim+5] = RMS error on the non radial modes near \(\nu_{\mathrm{max}}\)
  • result[model_number,ndim+6+[0:nglb]] = errors on the global parameters

where:

  • result = the array which containts the interpolation errors
  • model_numer = an index which represents the model (not necessarily the number of the model along the evolutionary track
  • ndim = the number of dimensions in the grid (including age)
  • nglb = the number of global parameters for stellar models in the grid

Warning

This plot utility only works with 3 dimensional grids (incl. the age dimension).

plot_interpolation_test.all_nan(array)[source]

Test to see if all of the elements of an array are nan’s.

Parameters:array (np.array) – array in which we’re checking to see if all elements are nan’s.
Returns:True if all the elements of array are nan’s, and False otherwise.
Return type:boolean
plot_interpolation_test.ndim = 0

number of dimension in grid (including age)

plot_interpolation_test.nglb = 0

number of global parameters

plot_interpolation_test.onpick_age(event)[source]

Event catcher for the grid plot (which shows the positions of the evolutionary tracks as a function of the grid parameters, excluding age).

Parameters:

Parameters:event – event caught by the grid plot.
plot_interpolation_test.onpick_track(event)[source]

Event catcher for the partition tessellation plot (associated with tests of track interpolation).

Parameters:event – event caught by the partition tessellation plot.
plot_interpolation_test.plot3D(results, error_ndx, tpe='max', title=None, truncate=0)[source]

Create 3D plot showing the error as a function of the two first grid parameters.

Parameters:
  • results (list of np.arrays) – list of 2D arrays which contain various types of errors as a function of the model number along a given evolutionary track.
  • error_ndx (int) – value which specifies the type of error to be plotted.
  • tpe (string) –

    specifies how to combine errors along the evolutionary track. Options include:

    • “max”: corresponds to taking the maximum value.
    • “avg”: takes the root mean-square value.
  • title (string) – the title of the plot
  • truncate (int) – (default = 0): specifies how many models should be omitted on both ends of the track. This is useful for comparing results from tests involing different sizes of increments.

Note

See above introductory description for a more detailled description of the indices which intervene in the 2D arrays contained in results and of the relevant values for error_ndx.

plot_interpolation_test.plot_grid(grid)[source]

Make an interactive plot of the grid. Clicking on the blue dots will produce a 2D slice showing age interpolation errors for the associated evolutionary track.

Parameters:grid (np.array) – array containing basic grid parameters (excluding age)

Warning

This only works for two-dimensional grids (excluding the age dimension).

plot_interpolation_test.plot_partition_tessellation(grid, ndx1, ndx2, tessellation)[source]

Make an interactive tessellation plot based on the supplied partition on the grid. Clicking on the blue dots will produce a 2D slice showing track interpolation errors for the associated evolutionary track.

Parameters:
  • grid (np.array) – array containing basic grid parameters (excluding age)
  • ndx1 (list of int) – list with the indices of the first part of the partition.
  • ndx2 (list of int) – list with the indices of the second part of the partition.
  • tessellation – grid tessellation associated with ndx2

Warning

This only works for two-dimensional tessellations.

plot_interpolation_test.plot_slice_age(pos)[source]

Plot age interpolation error as a function of age for a given track.

Parameters:pos (int) – index of the relevant track.

Note

This pos index applies to results_age, i.e., it is based on the original track indices.

plot_interpolation_test.plot_slice_track(pos)[source]

Plot track interpolation error as a function of age for a given track.

Parameters:pos (int) – index of the relevant track.

Note

This pos index applies to results_track, i.e., it is based on the indices deduced from the grid partition.

plot_interpolation_test.results_age = None

list which contains the arrays with the errors from age interpolation

plot_interpolation_test.results_track = None

list which contains the arrays with the errors from track interpolation

plot_interpolation_test.titles = None

the grid quantities, which will serve as axis labels