ramjet.photometric_database.microlensing_label_per_example_database

Code for representing a dataset of lightcurves for binary classification with a single label per example.

Module Contents

class MicrolensingLabelPerExampleDatabase(data_directory='data/moa_microlensing')[source]

Bases: ramjet.photometric_database.lightcurve_database.LightcurveDatabase

A representation of a dataset of lightcurves for binary classification with a single label per example.

__init__(self, data_directory='data/moa_microlensing')[source]
generate_datasets(self, positive_data_directory: str = 'positive', negative_data_directory: str = 'negative')[source]

Generates the training and validation datasets.

Parameters:
  • positive_data_directory – The relative path from the data directory to the directory containing the positive example files.
  • negative_data_directory – The relative path from the data directory to the directory containing the negative example files.
set_shape_function(self, lightcurve: tf.Tensor, label: tf.Tensor)[source]

Explicitly sets the shapes of the lightcurve and label tensor, otherwise TensorFlow can’t infer it.

Parameters:
  • lightcurve – The lightcurve tensor.
  • label – The label tensor.
Returns:

The lightcurve and label tensor with TensorFlow inferable shapes.

load_and_preprocess_example_file(self, file_path: tf.Tensor)[source]

Loads numpy files from the tensor alongside labels.

preprocess_and_augment_lightcurve(self, lightcurve: np.ndarray)[source]

Prepares the lightcurves for training with several preprocessing and augmenting steps.

static roll_lightcurve(lightcurve: np.ndarray)[source]

Randomly rolls the lightcurve, moving starting elements to the end.

generate_inference_dataset(self, inference_directory: str)[source]

Generates the inference dataset.