Reference / API

Datasets

Loading/saving a dataset

Dataset(name, metadata[, observations, …]) A dataset of many astronomical objects.
Dataset.load(name[, metadata_only, chunk, …]) Load a dataset that has been saved in HDF5 format in the data directory.
Dataset.from_objects(name, objects, **kwargs) Load a dataset from a list of AstronomicalObject instances.
Dataset.path Return the path to where this dataset should lie on disk
Dataset.write([overwrite]) Write the dataset out to disk.

Retrieving objects from the dataset

Dataset.get_object([index, object_class, …]) Parse keywords to pull a specific object out of the dataset

Plotting lightcurves of objects in the dataset

Dataset.plot_light_curve(*args, **kwargs) Plot the light curve for an object in the dataset.
Dataset.plot_interactive() Make an interactive plot of the light curves in the dataset.

Extracting features from objects in the dataset

Dataset.extract_raw_features(featurizer[, …]) Extract raw features from the dataset.
Dataset.get_raw_features_path([tag]) Return the path to where the raw features for this dataset should lie on disk
Dataset.write_raw_features([tag]) Write the raw features out to disk.
Dataset.load_raw_features([tag]) Load the raw features from disk.
Dataset.select_features(featurizer) Select features from the dataset for classification.

Classifying objects in the dataset

Dataset.predict(classifier) Generate predictions using a classifier.
Dataset.get_predictions_path([classifier]) Return the path to where the predicitons for this dataset for a given classifier should lie on disk.
Dataset.write_predictions([classifier]) Write predictions for this classifier to disk.
Dataset.load_predictions([classifier]) Load the predictions for a classifier from disk.
Dataset.label_folds([num_folds, random_state]) Separate the dataset into groups for k-folding

Astronomical objects

AstronomicalObject(metadata, observations) An astronomical object, with metadata and a lightcurve.
AstronomicalObject.bands Return a list of bands that this object has observations in
AstronomicalObject.subtract_background() Subtract the background levels from each band.
AstronomicalObject.preprocess_observations([…]) Apply preprocessing to the observations.
AstronomicalObject.fit_gaussian_process([…]) Fit a Gaussian Process model to the light curve.
AstronomicalObject.get_default_gaussian_process() Get the default Gaussian Process.
AstronomicalObject.predict_gaussian_process(…) Predict the Gaussian process in a given set of bands and at a given set of times.
AstronomicalObject.plot_light_curve([…]) Plot the object’s light curve
AstronomicalObject.print_metadata() Print out the object’s metadata in a nice format.

Dataset augmentation

Augmentor API

Augmentor(**cosmology_kwargs) Class used to augment a dataset.
Augmentor.augment_object(reference_object[, …]) Generate an augmented version of an object.
Augmentor.augment_dataset(augment_name, …) Generate augmented versions of all objects in a dataset.

Augmentor Implementations

plasticc.PlasticcAugmentor() Implementation of an Augmentor for the PLAsTiCC dataset

Augmentor methods to implement in subclasses

Augmentor._augment_metadata(reference_object) Generate new metadata for the augmented object.
Augmentor._choose_sampling_times(…[, …]) Choose the times at which to sample for a new augmented object.
Augmentor._choose_target_observation_count(…) Choose the target number of observations for a new augmented light curve.
Augmentor._simulate_light_curve_uncertainties(…) Simulate the observation-related noise for a light curve.
Augmentor._simulate_detection(observations, …) Simulate the detection process for a light curve.

Classification

Classifier API

Classifier(name) Classifier used to classify the different objects in a dataset.
Classifier.train(dataset) Train the classifier on a dataset
Classifier.predict(dataset) Generate predictions for a dataset
Classifier.path Get the path to where a classifier should be stored on disk
Classifier.write([overwrite]) Write a trained classifier to disk
Classifier.load(name) Load a classifier that was previously saved to disk

Classifier Implementations

LightGBMClassifier(name, featurizer[, …]) Feature based classifier using LightGBM to classify objects.

Weights and metrics

evaluate_weights_flat(dataset[, class_weights]) Evaluate the weights to use for classification on a dataset.
evaluate_weights_redshift(dataset[, …]) Evaluate redshift-weighted weights to use to generate a rates-independent classifier.
weighted_multi_logloss(true_classes, predictions) Evaluate a weighted multi-class logloss function.

Feature extraction

Featurizer API

Featurizer Class used to extract features from objects.
Featurizer.extract_raw_features(…[, …]) Extract raw features from an object
Featurizer.select_features(raw_features) Select features to use for classification
Featurizer.extract_features(astronomical_object) Extract features from an object.

Featurizer Implementations

plasticc.PlasticcFeaturizer Class used to extract features for the PLAsTiCC dataset.

Exceptions

AvocadoException The base class for all exceptions raised in avocado.