astra.contrib.thecannon.plot

Plotting utilities for The Cannon.

Module Contents

Functions

theta(model, indices=None, label_terms=None, show_label_terms=True, normalize=True, common_axis=False, latex_label_names=None, xlim=None, **kwargs) Plot the spectral derivates (\(oldsymbol{ heta}\) coefficiets) from a
scatter(model, ax=None, **kwargs) Plot the noise residuals (\(s\)) at each pixel.
one_to_one(model, test_labels, cov=None, latex_label_names=None, show_statistics=True, **kwargs) Plot a one-to-one comparison of the training set labels, and the test set
astra.contrib.thecannon.plot.theta(model, indices=None, label_terms=None, show_label_terms=True, normalize=True, common_axis=False, latex_label_names=None, xlim=None, **kwargs)

Plot the spectral derivates (\(oldsymbol{ heta}\) coefficiets) from a trained model.

Parameters:
  • model – A trained CannonModel object.
  • indices – [optional] The indices of \(oldsymbol{ heta}\) to plot. By default all coefficients will be shown.
  • label_terms

    [optional]: Specify the label terms to show coefficients for. This is similar to specifying the indices, except you don’t have to calculate the position of each label name.

    For example, specifying indices=0 and label_terms=['TEFF', 'MG_H'] would show the first :math:` heta` value (mean flux), as well as the :math:` heta` coefficients that correspond to the linear terms of 'TEFF' and 'MG_H'.

    Note that label_terms is specific to the model vectorizer. The vectorizer must be able to identify the label term by the inputs provided (e.g., a polynomial vectorizer will recognize 'TEFF' is the linear coefficient of 'TEFF', but 'TEFF' on its own may not be recognisable to a vectorizer that uses sine and cosine functions.)

  • show_label_terms – [optional] Show the label terms on the right hand side of each axis.
  • normalize – [optional] Normalize each coefficient between [-1, 1], except for the first theta coefficient (mean flux).
  • common_axis – [optional] Show all spectral derivatives on a single axes.
  • latex_label_names – [optional] A list containing the label names as LaTeX representations.
  • xlim – [optional] The x-limits to apply to all axes.
Returns:

A figure showing the spectral derivatives.

astra.contrib.thecannon.plot.scatter(model, ax=None, **kwargs)

Plot the noise residuals (\(s\)) at each pixel.

Parameters:model – A trained CannonModel object.
Returns:A figure showing the noise residuals at every pixel.
astra.contrib.thecannon.plot.one_to_one(model, test_labels, cov=None, latex_label_names=None, show_statistics=True, **kwargs)

Plot a one-to-one comparison of the training set labels, and the test set labels inferred from the training set spectra.

Parameters:
  • model – A trained CannonModel object.
  • test_labels – An array of test labels, inferred from the training set spectra.
  • cov – [optional] The covariance matrix returned for all test labels.
  • latex_label_names – [optional] A list of label names in LaTeX representation.
  • show_statistics – [optional] Show the mean and standard deviation of residuals in each axis.