src.superphot_plus.supernova_class
Module Contents
Classes
Classes of Supernovae |
- class SupernovaClass[source]
Bases:
str,enum.EnumClasses of Supernovae
- classmethod get_type_maps(allowed_types=None)[source]
For some allowed supernova classes, create dictionaries mapping an integer classification to the type string.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
allowed_types (list of str, optional) – The list of supernova classes to be included in the mapping. Defaults to [“SN Ia”, “SN II”, “SN IIn”, “SLSN-I”, “SN Ibc”].
- Returns:
Tuple containing the mapping of string labels to integer identifiers and the mapping of integer identifiers to string labels, respectively.
- Return type:
tuple of dict
- classmethod get_alternative_namings()[source]
Returns the alternative namings for each supernova class.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
- Returns:
A dictionary that maps each supernova class label to its respective alternative namings.
- Return type:
dict
- classmethod canonicalize(label)[source]
Returns a canonical label, using the proper and alternative namings for each supernova class.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
label (str) – The label to canonicalize
- Returns:
original label if already canonical, supernova class string if found in dictionary of alternative names, or the original label if not able to be canonicalized.
- Return type:
str
- classmethod from_alerce_to_superphot_format(label)[source]
Converts label from ALeRCE’s to Superphot+’s formatting.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
label (str) – The predicted supernova class label, provided by the ZTF classifier, but in ALeRCE format.
- Returns:
The supernova class label in reflect style.
- Return type:
str
- classmethod get_classes_from_labels(labels)[source]
Returns the integer classes for a list of supernova labels.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
labels (list of str) – The supernovae string labels.
- Returns:
Numpy array containing the supernovae integer classes.
- Return type:
np.array of int
- classmethod get_labels_from_classes(classes)[source]
Returns the supernova labels for a list of integer classes.
- Parameters:
cls (SupernovaClass) – The SupernovaClass class.
classes (list of int) – The supernovae integer classes.
- Returns:
Numpy array containing the supernovae string labels.
- Return type:
np.array of str