RAMjET

ramjet.analysis.lightcurve_visualizer

Code for visualizing lightcurves.

Module Contents

Functions

plot_lightcurve(times: np.ndarray, fluxes: np.ndarray, labels: np.ndarray = None, predictions: np.ndarray = None, title: str = None, x_label: str = ‘Days’, y_label: str = ‘Flux’, x_limits: (float, float) = (None, None), y_limits: (float, float) = (None, None), save_path: Union[Path, str] = None, exclude_flux_outliers: bool = False, base_data_point_size: float = 3) Plots a lightcurve with a consistent styling. If true labels and/or predictions are included, these will
is_outlier(points: np.ndarray, threshold: float = 5) Uses the median absolute deviation to determine if the input data points are “outliers” for the purpose of
create_dual_lightcurve_figure(fluxes0, times0, name0, fluxes1, times1, name1, title, x_axis_label=’Time (days)’, y_axis_label=’Relative flux’) → Figure Plots two lightcurves together. Mostly for comparing a lightcurve cleaned by two different methods.
calculate_inlier_range(points: np.ndarray) → (float, float) Calculates the inlier range for a set of points.
plot_lightcurve(times: np.ndarray, fluxes: np.ndarray, labels: np.ndarray = None, predictions: np.ndarray = None, title: str = None, x_label: str = 'Days', y_label: str = 'Flux', x_limits: (float, float) = (None, None), y_limits: (float, float) = (None, None), save_path: Union[Path, str] = None, exclude_flux_outliers: bool = False, base_data_point_size: float = 3)[source]

Plots a lightcurve with a consistent styling. If true labels and/or predictions are included, these will additionally be plotted.

Parameters:
  • times – The times of the measurements.
  • fluxes – The fluxes of the measurements.
  • labels – The binary labels for each time step.
  • predictions – The probability prediction for each time step.
  • title – The title of the plot.
  • x_label – The label for the x axis.
  • y_label – The label for the y axis.
  • x_limits – Optional axis limiting for the x axis.
  • y_limits – Optional axis limiting for the y axis.
  • save_path – The path to save the plot to. If None, the plot will be shown instead.
  • exclude_flux_outliers – Whether or not to exclude flux outlier data points when plotting.
  • base_data_point_size – The size of the data points to use when plotting (and related sizes).
is_outlier(points: np.ndarray, threshold: float = 5)[source]

Uses the median absolute deviation to determine if the input data points are “outliers” for the purpose of plotting.

Parameters:
  • points – The observations to search for outliers in.
  • threshold – The modified z-score to use as a threshold. Observations with a modified z-score based on the median absolute deviation greater than this value will be classified as outliers.
create_dual_lightcurve_figure(fluxes0, times0, name0, fluxes1, times1, name1, title, x_axis_label='Time (days)', y_axis_label='Relative flux') → Figure[source]

Plots two lightcurves together. Mostly for comparing a lightcurve cleaned by two different methods.

Parameters:
  • fluxes0 – The fluxes of the first plot.
  • times0 – The times of the first plot.
  • name0 – The name of the first plot.
  • fluxes1 – The fluxes of the second plot.
  • times1 – The times of the second plot.
  • name1 – The name of the second plot.
  • title – The title of the figure.
  • x_axis_label – The label of the x axis.
  • y_axis_label – The label of the y axis.
Returns:

The resulting figure.

calculate_inlier_range(points: np.ndarray) -> (float, float)[source]

Calculates the inlier range for a set of points.

Parameters:points – The points to get the range for.
Returns:The start and end of the inlier range.