wf_psf.plotting.plots_interface

Plot Interface.

An interface module with classes to handle different plot configurations.

Author:

Jennifer Pollack <jennifer.pollack@cea.fr>

Functions

define_plot_style()

Define Plot Style.

get_number_of_stars(metrics)

Get Number of Stars.

make_plot(x_axis, y_axis, y_axis_err, ...[, ...])

Make Plot.

plot_metrics(plotting_params, ...)

Plot model results.

Classes

MetricsPlotHandler(plotting_params, metrics, ...)

MetricsPlotHandler class.

MonochromaticMetricsPlotHandler(...)

MonochromaticMetricsPlotHandler class.

ShapeMetricsPlotHandler(plotting_params, ...)

ShapeMetricsPlotHandler class.

class wf_psf.plotting.plots_interface.MetricsPlotHandler(plotting_params, metrics, list_of_stars, metric_name, rmse, std_rmse, rel_rmse, plot_title, plots_dir)[source]

Bases: object

MetricsPlotHandler class.

A class to handle plot parameters for various metrics results.

Parameters:
  • id (str) – Class ID name

  • plotting_params (Recursive Namespace object)

  • metrics (dict) – Dictionary containing list of metrics

  • list_of_stars (list) – List containing the number of training stars per run

  • metric_name (str) – Name of metric

  • rmse (str) – Root-mean square error label

  • std_rmse (str) – Standard error on root-mean square error standard label

  • plots_dir (str) – Output directory for metrics plots

Methods

get_metrics(dataset)

Get Metrics.

plot()

Plot.

get_metrics(dataset)[source]

Get Metrics.

A function to get metrics: rmse, rmse_std for each run input, e.g. wf-outputs-xxxxxxxxxxxx.

Parameters:

dataset (str) – A str representing dataset type, i.e. test_metrics or train_metrics.

Returns:

A tuple consisting of the id, root-mean-square (rms) and standard rms errors for a metric for each input run.

Return type:

tuple

ids = ('poly_metrics', 'opd_metrics', 'poly_pixel')
plot()[source]

Plot.

A function to generate metric plots as function of number of stars for the train and test metrics.

class wf_psf.plotting.plots_interface.MonochromaticMetricsPlotHandler(plotting_params, metrics_confs, metrics, list_of_stars, plots_dir)[source]

Bases: object

MonochromaticMetricsPlotHandler class.

A class to handle plot parameters for monochromatic metrics results.

Parameters:
  • id (str) – Class ID name

  • plotting_params (Recursive Namespace object) – RecursiveNamespace object containing plotting parameters

  • metrics_confs (dict) – Dictionary containing the metric configurations as RecursiveNamespace objects for each run

  • metrics (list) – Dictionary containing list of metrics

  • list_of_stars (list) – List containing the number of stars used for each training data set

  • plots_dir (str) – Output directory for metrics plots

Methods

plot()

Plot.

ids = ('mono_metrics',)
plot()[source]

Plot.

A function to generate plots for the train and test metrics.

class wf_psf.plotting.plots_interface.ShapeMetricsPlotHandler(plotting_params, metrics, list_of_stars, plots_dir)[source]

Bases: object

ShapeMetricsPlotHandler class.

A class to handle plot parameters shape metrics results.

Parameters:
  • id (str) – Class ID name

  • plotting_params (Recursive Namespace object) – Recursive Namespace Object containing plotting parameters

  • metrics (list) – Dictionary containing list of metrics

  • list_of_stars (list) – List containing the number of stars used for each training data set

  • plots_dir (str) – Output directory for metrics plots

Methods

make_shape_metrics_plot(rmse_data, ...)

Make Shape Metrics Plot.

plot()

Plot.

prepare_metrics_data(plot_dataset, ...)

Prepare Metrics Data.

id = 'shape_metrics'
make_shape_metrics_plot(rmse_data, std_rmse_data, rel_rmse_data, plot_dataset, metric)[source]

Make Shape Metrics Plot.

A function to produce plots for the shape metrics.

Parameters:
  • rmse_data (list) – A list of dictionaries where each dictionary stores run as the key and the Root Mean Square Error (rmse).

  • std_rmse_data (list) – A list of dictionaries where each dictionary stores run as the key and the Standard Deviation of the Root Mean Square Error (rmse) as the value.

  • rel_rmse_data (list) – A list of dictionaries where each dictionary stores run as the key and the Root Mean Square Error (rmse) relative to the Euclid requirements as the value.

  • plot_dataset (str) – A string denoting whether metrics are for the train or test datasets.

  • metric (str) – A string representing the type of shape metric, i.e., e1, e2, or R2.

plot()[source]

Plot.

A generic function to generate plots for the train and test metrics.

prepare_metrics_data(plot_dataset, e1_req_euclid, e2_req_euclid, R2_req_euclid)[source]

Prepare Metrics Data.

A function to prepare the metrics data for plotting.

Parameters:
  • plot_dataset (str) – A string representing the dataset, i.e. training or test metrics.

  • e1_req_euclid (float) – A float denoting the Euclid requirement for the e1 shape metric.

  • e2_req_euclid (float) – A float denoting the Euclid requirement for the e2 shape metric.

  • R2_req_euclid (float) – A float denoting the Euclid requirement for the R2 shape metric.

Returns:

shape_metrics_data – A dictionary containing the shape metrics data from a set of runs.

Return type:

dict

wf_psf.plotting.plots_interface.define_plot_style()[source]

Define Plot Style.

A function to set plot_style parameters.

wf_psf.plotting.plots_interface.get_number_of_stars(metrics)[source]

Get Number of Stars.

A function to get the number of stars used in training the model.

Parameters:

metrics (dict) – A dictionary containig the metrics results per run

Returns:

list_of_stars – A list containing the number of training stars per run.

Return type:

list

wf_psf.plotting.plots_interface.make_plot(x_axis, y_axis, y_axis_err, y2_axis, label, plot_title, x_axis_label, y_right_axis_label, y_left_axis_label, filename, plot_show=False)[source]

Make Plot.

A function to generate metrics plots.

Parameters:
  • x_axis (list) – x-axis values

  • y_axis (list) – y-axis values

  • y_axis_err (list) – Error values for y-axis points

  • y2_axis (list) – y2-axis values for right axis

  • label (str) – Label for the points

  • plot_title (str) – Name of plot

  • x_axis_label (str) – Label for x-axis

  • y_left_axis_label (str) – Label for left vertical axis of plot

  • y_right_axis_label (str) – Label for right vertical axis of plot

  • filename (str) – Name of file to save plot

  • plot_show (bool) – Boolean flag to set plot display

wf_psf.plotting.plots_interface.plot_metrics(plotting_params, list_of_metrics, metrics_confs, plot_saving_path)[source]

Plot model results.

Parameters:
  • plotting_params (RecursiveNamespace Object) – Recursive Namespace object containing plot configuration parameters

  • list_of_metrics (list) – List containing all model metrics

  • metrics_confs (list) – List containing all metrics configuration parameters

  • plot_saving_path (str) – Directory path for saving output plots