astra.contrib.classifier.utils

Module Contents

Functions

load_data(spectra_path, labels_path) Load data for training, testing, or validation.
norm_spectra_med(signal) Pseudo-continuum-normalise a signal based on the median.
write_network(network, path) Write a neural network state to disk.
read_network(network_class, path) Read a neural network state from disk.
astra.contrib.classifier.utils.load_data(spectra_path, labels_path)

Load data for training, testing, or validation.

Parameters:
  • spectra_path – The path containing the spectra. This should be a pickled array that is readable with np.load.
  • labels_path – The path containing the labels. This should be a pickled array that is readable with np.load.
Returns:

A two-length tuple containing the spectra and labels.

astra.contrib.classifier.utils.norm_spectra_med(signal)

Pseudo-continuum-normalise a signal based on the median.

astra.contrib.classifier.utils.write_network(network, path)

Write a neural network state to disk.

Parameters:
  • network – The neural network to save.
  • path – The path to save the neural network to.
astra.contrib.classifier.utils.read_network(network_class, path)

Read a neural network state from disk.

Parameters:
  • network_class – The network class factory to load the model.
  • path – The path where the neural network coefficients are stored.
Returns:

The loaded neural network.