Reference / API¶
Pre-processing¶
Light curve analysis¶
Performing feature extraction for 1 light curve
LightCurve() |
Light Curve object, holding meta and photometric data. |
LightCurve.load_snpcc_lc(path_to_data) |
Reads one LC from SNPCC data. |
LightCurve.fit_bazin(band) |
Extract Bazin features for one filter. |
LightCurve.fit_bazin_all() |
Perform Bazin fit for all filters independently and concatenate results. |
LightCurve.plot_bazin_fit([save, show, …]) |
Plot data and Bazin fitted function. |
Fitting an entire data set
fit_snpcc_bazin(path_to_data_dir, features_file) |
Perform Bazin fit to all objects in the SNPCC data. |
Basic light curve analysis tools
bazin(time, a, b, t0, tfall, trise) |
Parametric light curve function proposed by Bazin et al., 2009. |
errfunc(params, time, flux) |
Absolute difference between theoretical and measured flux. |
fit_scipy(time, flux) |
Find best-fit parameters using scipy.least_squares. |
Canonical sample¶
The Canonical object for holding the entire sample.
Canonical() |
Canonical sample object. |
Canonical.snpcc_get_canonical_info(…[, …]) |
Load SNPCC metada data required to characterize objects. |
Canonical.snpcc_identify_samples() |
Identify training and test sample. |
Canonical.find_neighbors() |
Identify 1 nearest neighbor for each object in training. |
Functions to populate the Canonical object
build_snpcc_canonical(path_to_raw_data, …) |
Build canonical sample for SNPCC data. |
plot_snpcc_train_canonical(sample[, …]) |
Plot comparison between training and canonical samples. |
Build time domain data base¶
SNPCCPhotometry() |
Handles photometric information for entire SNPCC data. |
SNPCCPhotometry.get_lim_mjds(raw_data_dir) |
Get minimum and maximum MJD for complete sample. |
SNPCCPhotometry.create_daily_file(…[, header]) |
Create one file for a given day of the survey. |
SNPCCPhotometry.build_one_epoch(…[, …]) |
Fit bazin for all objects with enough points in a given day. |
DataBase¶
Object upon which the learning process is performed
DataBase() |
DataBase object, upon which the active learning loop is performed. |
DataBase.load_bazin_features(path_to_bazin_file) |
Load Bazin features from file. |
DataBase.load_features(path_to_file[, …]) |
Load features according to the chosen feature extraction method. |
DataBase.build_samples([initial_training, …]) |
Separate train and test samples. |
DataBase.classify(method, **kwargs) |
Apply a machine learning classifier. |
DataBase.evaluate_classification([metric_label]) |
Evaluate results from classification. |
DataBase.make_query([strategy, batch, …]) |
Identify new object to be added to the training sample. |
DataBase.update_samples(query_indx, loop[, …]) |
Add the queried obj(s) to training and remove them from test. |
DataBase.save_metrics(loop, …[, batch]) |
Save current metrics to file. |
DataBase.save_queried_sample(…[, …]) |
Save queried sample to file. |
Classifiers¶
random_forest(train_features, train_labels, …) |
Random Forest classifier. |
Query strategies¶
random_sampling(test_ids, queryable_ids[, …]) |
Randomly choose an object from the test sample. |
uncertainty_sampling(class_prob, test_ids, …) |
Search for the sample with highest uncertainty in predicted class. |
Metrics¶
Individual metrics
accuracy(label_pred, label_true) |
Calculate accuracy. |
efficiency(label_pred, label_true[, ia_flag]) |
Calculate efficiency. |
purity(label_pred, label_true[, ia_flag]) |
Calculate purity. |
fom(label_pred, label_true[, ia_flag, penalty]) |
Calculate figure of merit. |
Metrics agregated by category or use
get_snpcc_metric(label_pred, label_true[, …]) |
Calculate the metric parameters used in the SNPCC. |
Active Learning loop¶
Full light curve
learn_loop(nloops, strategy, …[, …]) |
Perform the active learning loop. |
Time domain
get_original_training |
|
time_domain_loop(days, output_metrics_file, …) |
Perform the active learning loop. |
Plotting¶
Canvas() |
Canvas object, handles and plot information from multiple strategies. |
Canvas.load_metrics(path_to_files, …) |
Load and identify set of metrics. |
Canvas.set_plot_dimensions() |
Set directives for plot sizes. |
Canvas.plot_metrics(output_plot_file, …[, …]) |
Generate plot for all metrics in files and strategies given as input. |
Scripts¶
build_canonical(user_choices) |
Build canonical sample for SNPCC data set fitted with Bazin features. |
build_time_domain(user_choice) |
Generates features files for a list of days of the survey. |
fit_dataset(user_choices) |
Fit the entire sample with the Bazin function. |
make_metrics_plots(user_input) |
Generate metric plots. |
run_loop(args) |
Command line interface to run the active learning loop. |
run_time_domain(user_choice) |
Command line interface to the Time Domain Active Learning scenario. |