ramjet.photometric_database.standard_and_injected_lightcurve_database¶
An abstract class allowing for any number and combination of standard and injectable/injectee lightcurve collections.
Module Contents¶
Classes¶
OutOfBoundsInjectionHandlingMethod |
An enum of approaches for handling cases where the injectable signal is shorter than the injectee signal. |
StandardAndInjectedLightcurveDatabase |
An abstract class allowing for any number and combination of standard and injectable/injectee lightcurve collections |
-
class
OutOfBoundsInjectionHandlingMethod[source]¶ Bases:
enum.EnumAn enum of approaches for handling cases where the injectable signal is shorter than the injectee signal.
-
ERROR= error¶
-
REPEAT_SIGNAL= repeat_signal¶
-
RANDOM_INJECTION_LOCATION= random_inject_location¶
-
-
class
StandardAndInjectedLightcurveDatabase[source]¶ Bases:
ramjet.photometric_database.lightcurve_database.LightcurveDatabaseAn abstract class allowing for any number and combination of standard and injectable/injectee lightcurve collections to be used for training.
-
generate_datasets(self)[source]¶ Generates the training and validation datasets for the database.
Returns: The training and validation dataset.
-
generate_paths_datasets_group_from_lightcurve_collections_group(self, standard_lightcurve_collections: List[LightcurveCollection], injectee_lightcurve_collection: LightcurveCollection, injectable_lightcurve_collections: List[LightcurveCollection], shuffle: bool = True)[source]¶ Create the path dataset for each lightcurve collection in the standard, injectee, and injectable sets.
Parameters: - standard_lightcurve_collections – The standard lightcurve collections.
- injectee_lightcurve_collection – The injectee lightcurve collection.
- injectable_lightcurve_collections – The injectable lightcurve collections.
- shuffle – Whether to shuffle the dataset or not.
Returns: The standard, injectee, and injectable paths datasets.
-
generate_paths_dataset_from_lightcurve_collection(self, lightcurve_collection: LightcurveCollection, repeat: bool = True, shuffle: bool = True)[source]¶ Generates a paths dataset for a lightcurve collection.
Parameters: - lightcurve_collection – The lightcurve collection to generate a paths dataset for.
- repeat – Whether to repeat the dataset or not.
- shuffle – Whether to shuffle the dataset or not.
Returns: The paths dataset.
-
generate_paths_datasets_from_lightcurve_collection_list(self, lightcurve_collections: List[LightcurveCollection], shuffle: bool = True)[source]¶ Generates a paths dataset for each lightcurve collection in a list.
Parameters: - lightcurve_collections – The list of lightcurve collections.
- shuffle – Whether to shuffle the datasets or not.
Returns: The list of paths datasets.
-
generate_standard_lightcurve_and_label_dataset(self, paths_dataset: tf.data.Dataset, load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], load_label_from_path_function: Callable[[Path], Union[float, np.ndarray]], evaluation_mode: bool = False)[source]¶ Generates a lightcurve and label dataset from a paths dataset using a passed function defining how to load the values from the lightcurve file and the label value to use.
Parameters: - paths_dataset – The dataset of paths to use.
- load_times_and_fluxes_from_path_function – The function defining how to load the times and fluxes of a lightcurve from a path.
- load_label_from_path_function – The function to load the label to use for the lightcurves in this dataset.
- evaluation_mode – Whether or not the preprocessing should occur in evaluation mode (for repeatability).
Returns: The resulting lightcurve example and label dataset.
-
preprocess_standard_lightcurve(self, load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], load_label_from_path_function: Callable[[Path], Union[float, np.ndarray]], lightcurve_path_tensor: tf.Tensor, evaluation_mode: bool = False)[source]¶ Preprocesses a individual standard lightcurve from a lightcurve path tensor, using a passed function defining how to load the values from the lightcurve file and the label value to use. Designed to be used with partial to prepare a function which will just require the lightcurve path tensor, and can then be mapped to a dataset.
Parameters: - load_times_and_fluxes_from_path_function – The function to load the lightcurve times and fluxes from a file.
- load_label_from_path_function – The function to load the label to assign to the lightcurve.
- lightcurve_path_tensor – The tensor containing the path to the lightcurve file.
- evaluation_mode – Whether or not the preprocessing should occur in evaluation mode (for repeatability).
Returns: The example and label arrays shaped for use as single example for the network.
-
static
expand_label_to_training_dimensions(label: Union[int, List[int], Tuple[int], np.ndarray])[source]¶ Expand the label to the appropriate dimensions for training.
Parameters: label – The label to convert. Returns: The label with the correct dimensions.
-
generate_infer_path_and_lightcurve_dataset(self, paths_dataset: tf.data.Dataset, load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]])[source]¶ Generates a path and lightcurve dataset from a paths dataset using a passed function defining how to load the values from the lightcurve file.
Parameters: - paths_dataset – The dataset of paths to use.
- load_times_and_fluxes_from_path_function – The function defining how to load the times and fluxes of a lightcurve from a path.
Returns: The resulting lightcurve example and label dataset.
-
preprocess_infer_lightcurve(self, load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], lightcurve_path_tensor: tf.Tensor)[source]¶ Preprocesses a individual standard lightcurve from a lightcurve path tensor, using a passed function defining how to load the values from the lightcurve file and returns the path and lightcurve. Designed to be used with partial to prepare a function which will just require the lightcurve path tensor, and can then be mapped to a dataset.
Parameters: - load_times_and_fluxes_from_path_function – The function to load the lightcurve times and fluxes from a file.
- lightcurve_path_tensor – The tensor containing the path to the lightcurve file.
Returns: The path and example array shaped for use as single example for the network.
-
generate_injected_lightcurve_and_label_dataset(self, injectee_paths_dataset: tf.data.Dataset, injectee_load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], injectable_paths_dataset: tf.data.Dataset, injectable_load_times_and_magnifications_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], load_label_from_path_function: Callable[[Path], Union[float, np.ndarray]], evaluation_mode: bool = False)[source]¶ Generates a lightcurve and label dataset from an injectee and injectable paths dataset, using passed functions defining how to load the values from the lightcurve files for each and the label value to use.
Parameters: - injectee_paths_dataset – The dataset of paths to use for the injectee lightcurves.
- injectee_load_times_and_fluxes_from_path_function – The function defining how to load the times and fluxes of an injectee lightcurve from a path.
- injectable_paths_dataset – The dataset of paths to use for the injectable lightcurves.
- injectable_load_times_and_magnifications_from_path_function – The function defining how to load the times and magnifications of an injectable signal from a path.
- load_label_from_path_function – The function to load the label to use for the lightcurves in this dataset.
- evaluation_mode – Whether or not the preprocessing should occur in evaluation mode (for repeatability).
Returns: The resulting lightcurve example and label dataset.
-
preprocess_injected_lightcurve(self, injectee_load_times_and_fluxes_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], injectable_load_times_and_magnifications_from_path_function: Callable[[Path], Tuple[np.ndarray, np.ndarray]], load_label_from_path_function: Callable[[Path], Union[float, np.ndarray]], injectee_lightcurve_path_tensor: tf.Tensor, injectable_lightcurve_path_tensor: tf.Tensor, evaluation_mode: bool = False)[source]¶ Preprocesses a individual injected lightcurve from an injectee and an injectable lightcurve path tensor, using a passed function defining how to load the values from each lightcurve file and the label value to use. Designed to be used with partial to prepare a function which will just require the lightcurve path tensor, and can then be mapped to a dataset.
Parameters: - injectee_load_times_and_fluxes_from_path_function – The function to load the injectee lightcurve times and fluxes from a file.
- injectable_load_times_and_magnifications_from_path_function – The function to load the injectee lightcurve times and signal from a file.
- load_label_from_path_function – The function to load the label to assign to the lightcurve.
- injectee_lightcurve_path_tensor – The tensor containing the path to the injectee lightcurve file.
- injectable_lightcurve_path_tensor – The tensor containing the path to the injectable lightcurve file.
- evaluation_mode – Whether or not the preprocessing should occur in evaluation mode (for repeatability).
Returns: The injected example and label arrays shaped for use as single example for the network.
-
inject_signal_into_lightcurve(self, lightcurve_fluxes: np.ndarray, lightcurve_times: np.ndarray, signal_magnifications: np.ndarray, signal_times: np.ndarray)[source]¶ Injects a synthetic magnification signal into real lightcurve fluxes.
Parameters: - lightcurve_fluxes – The fluxes of the lightcurve to be injected into.
- lightcurve_times – The times of the flux observations of the lightcurve.
- signal_magnifications – The synthetic magnifications to inject.
- signal_times – The times of the synthetic magnifications.
Returns: The fluxes with the injected signal.
-