src.superphot_plus.plotting.utils
This module contains helper functions to access/manipulate data for plotting more concisely.
Module Contents
Functions
|
Lightens the given color by multiplying (1-luminosity) by the given amount. |
Return catalog with supernova fractions from existing |
|
|
Helper function to read in a probability csv file |
|
Get alerce probabilities corresponding to the four (no SN IIn) |
|
Generate csv with ALeRCE's predicted |
|
Extract Superphot+ and ALeRCE predictions and true class info. |
|
Evaluate a gaussian with params A at the values in x. |
|
Generate histogram bin edges, such that counts are equal in each bin. |
|
Adds 10% SNR and num of SNR > 5 points columns |
|
Calculate purity recall values at |
|
Incorporate K-fold uncertainties. |
|
Turn completeness to the independent variable, |
|
Return confidence vs. fraction of true positives. |
- lighten_color(color, amount=0.5)[source]
Lightens the given color by multiplying (1-luminosity) by the given amount. Input can be matplotlib color string, hex string, or RGB tuple.
- get_survey_fracs()[source]
Return catalog with supernova fractions from existing catalogue datasets. referenced in papers.
- read_probs_csv(probs_fn)[source]
Helper function to read in a probability csv file and return the columns as numpy arrays.
- get_alerce_pred_class(ztf_name, alerce, superphot_style=False)[source]
Get alerce probabilities corresponding to the four (no SN IIn) classes in our ZTF classifier.
- Parameters:
ztf_name (str) – ZTF name of the object.
superphot_style (bool, optional) – If True, change format of output labels. Default is False.
- Returns:
Predicted class label.
- Return type:
str
- create_alerce_pred_csv(probs_fn, save_fn)[source]
Generate csv with ALeRCE’s predicted classes for SN names in probs_csv.
- retrieve_four_class_info(probs_csv, probs_alerce_csv, p07=False)[source]
Extract Superphot+ and ALeRCE predictions and true class info.
- gaussian(inputs, amp, mean, sigma)[source]
Evaluate a gaussian with params A at the values in x.
- Parameters:
inputs (array-like or float) – Value(s) to evaluate gaussian at
amp (float) – Amplitude of the Gaussian.
mean (float) – Mean of Gaussian
sigma (float) – Standard deviation of Gaussian
- Returns:
Gaussian values evaluated at x
- Return type:
array-like or float
- histedges_equalN(vals, nbin)[source]
Generate histogram bin edges, such that counts are equal in each bin.
- Parameters:
vals (array-like or float) – Value(s) to bin in histogram
nbin (integer) – number of bins
- add_snr_to_prob_csv(probs_csv, data_dir, new_csv)[source]
Adds 10% SNR and num of SNR > 5 points columns to probability CSV. Useful for plots.
- calc_precision_recall(y_true, y_score, folds)[source]
Calculate purity recall values at multiple threshholds for plot. Assumes y_true only contains 0s and 1s (target), and y_score are probabilities of being class 1.