astra.contrib.thecannon.tasks.train

Module Contents

Classes

TrainTheCannonBase A base task for training The Cannon.
TrainingSetTarget A training set target.
TrainTheCannonGivenTrainingSetTarget A task to train The Cannon, given some file that contains high-quality labels,
TrainTheCannonGivenTrainingSetTask A general task to train The Cannon, given some task that would create the training set.
class astra.contrib.thecannon.tasks.train.TrainTheCannonBase

A base task for training The Cannon.

Parameters:
  • label_names – A list of label names.
  • order – (optional) The polynomial order to use for this model (default: 2).
  • regularization – (optional) The strength of L1-regularization to apply during training.
  • threads – (optional) The number of threads to use (default: 1).
  • plot – (optional) A boolean flag to indicate whether to produce post-training quality plots.
regularization
threads
plot
task_namespace = TheCannon
label_names
order
run(self)

Execute this task.

output(self)

The output of this task.

class astra.contrib.thecannon.tasks.train.TrainingSetTarget

A training set target.

Parameters:training_set_path

The path to a pickle file that contains a dictionary with the following keys:

  • wavelength: an array of shape (P, ) where P is the number of pixels
  • flux: an array of flux values with shape (N, P) where N is the number of observed spectra and P is the number of pixels
  • ivar: an array of inverse variance values with shape (N, P) where N is the number of observed spectra and P is the number of pixels
  • labels: an array of shape (L, N) where L is the number of labels and N is the number observed spectra
  • label_names: a tuple of length L that describes the names of the labels
training_set_path
output(self)
class astra.contrib.thecannon.tasks.train.TrainTheCannonGivenTrainingSetTarget

A task to train The Cannon, given some file that contains high-quality labels, and pseudo-continuum-normalised fluxes and inverse variances.

Parameters:
  • training_set_path

    The path to a pickle file that contains a dictionary with the following keys:

    • wavelength: an array of shape (P, ) where P is the number of pixels
    • flux: an array of flux values with shape (N, P) where N is the number of observed spectra and P is the number of pixels
    • ivar: an array of inverse variance values with shape (N, P) where N is the number of observed spectra and P is the number of pixels
    • labels: an array of shape (L, N) where L is the number of labels and N is the number observed spectra
    • label_names: a tuple of length L that describes the names of the labels
  • regularization – (optional) The L1 regularization strength to use during training (default: 0.0).
  • threads – (optional) The number of threads to use during training (default: 1).
  • plot – (optional) Produce quality assurance figures after training (default: True).
training_set_path
regularization
threads
plot
task_namespace = TheCannon
label_names
order
requires(self)

Requirements of this task.

run(self)

Execute this task.

output(self)

The output of this task.

class astra.contrib.thecannon.tasks.train.TrainTheCannonGivenTrainingSetTask

A general task to train The Cannon, given some task that would create the training set.

create_training_set_task
regularization
threads
plot
task_namespace = TheCannon
label_names
order
requires(self)

The requirements of this task.

run(self)

Execute this task.

output(self)

The output of this task.