ramjet.photometric_database.tess_synthetic_injected_database

Code to represent the database for injecting synthetic signals into real TESS data.

Module Contents

class TessSyntheticInjectedDatabase(data_directory='data/self_lensing_binaries')[source]

Bases: ramjet.photometric_database.lightcurve_database.LightcurveDatabase

A class to represent the database for injecting synthetic signals into real TESS data.

__init__(self, data_directory='data/self_lensing_binaries')[source]
generate_datasets(self)[source]

Generates the training and validation datasets for the database.

Returns:The training and validation dataset.
get_all_lightcurve_paths(self)[source]

Returns the list of all lightcurves to use. Expected to be overridden for subclass databases.

Returns:The list of lightcurves.
get_all_synthetic_signal_paths(self)[source]

Returns the list of all synthetic signals to use. Expected to be overridden for subclass databases.

Returns:The list of synthetic signals.
train_and_validation_preprocessing(self, lightcurve_path_tensor: tf.Tensor, synthetic_signal_path_tensor: tf.Tensor)[source]

The training and validation preprocessing.

Parameters:
  • lightcurve_path_tensor – The lightcurve’s path to be preprocessed.
  • synthetic_signal_path_tensor – The synthetic signal’s path to be injected.
Returns:

Two examples, one negative un-injected signal and one positive injected signal (paired as a tuple), and the corresponding labels (paired as a tuple). Expected to have a post flat mapping to make each element of the data be an individual example and label pair.

load_fluxes_and_times_from_lightcurve_path(self, lightcurve_path: str)[source]

Loads the lightcurve from the path given. Should be overridden to fit a specific database’s file format.

Parameters:lightcurve_path – The path to the lightcurve file.
Returns:The fluxes and times of the lightcurve
load_magnifications_and_times_from_synthetic_signal_path(self, synthetic_signal_path: str)[source]

Loads the synthetic signal from the path given. Should be overridden to fit a specific database’s file format.

Parameters:synthetic_signal_path – The path to the synthetic signal data file.
Returns:The magnifications and relative times of the synthetic signal.
flux_preprocessing(self, fluxes: np.ndarray, evaluation_mode: bool = False, seed: int = None)[source]

Preprocessing for the flux.

Parameters:
  • fluxes – The flux array to preprocess.
  • evaluation_mode – If the preprocessing should be consistent for evaluation.
  • seed – Seed for the randomization.
Returns:

The preprocessed flux array.

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.

infer_preprocessing(self, lightcurve_path_tensor: tf.string)[source]

Preprocesses a lightcurve for inference. Returns the lightcurve path, as directly linking this to the lightcurve can ease analysis when using multiprocessing, where the order of the inputs is inconsistent.

Parameters:lightcurve_path_tensor – A tensor containing the path of the lightcurve to preprocess.
Returns:The path of the lightcurve and the preprocessed lightcurve.
static generate_synthetic_signal_from_real_data(fluxes: np.ndarray, times: np.ndarray)[source]

Takes real lightcurve data and converts it to a form that can be used for synthetic lightcurve injection.

Parameters:
  • fluxes – The real lightcurve fluxes.
  • times – The real lightcurve times.
Returns:

Fake synthetic magnifications and times.