wf_psf.utils.configs_handler module

Configs_Handler.

A module which provides general utility methods to manage the parameters of the config files

Authors:

Jennifer Pollack <jennifer.pollack@cea.fr>

exception wf_psf.utils.configs_handler.ConfigParameterError(message='An error with your config settings occurred.')[source]

Bases: Exception

Custom Config Parameter Error exception class for specific error scenarios.

class wf_psf.utils.configs_handler.DataConfigHandler(data_conf, training_model_params)[source]

Bases: object

DataConfigHandler.

A class to handle data configuration parameters.

Parameters:
  • data_conf (str) – Path of the data configuration file

  • training_model_params (Recursive Namespace object) – Recursive Namespace object containing the training model parameters

class wf_psf.utils.configs_handler.MetricsConfigHandler(metrics_conf, file_handler, training_conf=None)[source]

Bases: object

MetricsConfigHandler.

A class to handle metrics configuation parameters.

Parameters:
  • ids (tuple) – A tuple containing a string id for the Configuration Class

  • metrics_conf (str) – Path to the metrics configuration file

  • file_handler (object) – An instance of the FileIOHandler

  • training_conf (RecursiveNamespace object) – RecursiveNamespace object containing the training configuration parameters

Attributes:
data_conf
metrics_conf
metrics_dir
plotting_conf
psf_model
training_conf
weights_basename_filepath

Get PSF model weights filepath.

weights_path

Methods

call_plot_config_handler_run(model_metrics)

Make Metrics Plots.

run()

Run.

call_plot_config_handler_run(model_metrics)[source]

Make Metrics Plots.

A function to call the PlottingConfigHandler run command to generate metrics plots.

Parameters:

model_metrics (dict) – A dictionary storing the metrics output generated during evaluation of the trained PSF model.

property data_conf
ids = ('metrics_conf',)
property metrics_conf
property metrics_dir
property plotting_conf
property psf_model
run()[source]

Run.

A function to run wave-diff according to the input configuration.

property training_conf
property weights_basename_filepath

Get PSF model weights filepath.

A function to return the basename of the user-specified psf model weights path.

Returns:

weights_basename – The basename of the psf model weights to be loaded.

Return type:

str

property weights_path
class wf_psf.utils.configs_handler.PlottingConfigHandler(plotting_conf, file_handler)[source]

Bases: object

PlottingConfigHandler.

A class to handle plotting config settings.

Parameters:
  • ids (tuple) – A tuple containing a string id for the Configuration Class

  • plotting_conf (str) – Name of plotting configuration file

  • file_handler (obj) – An instance of the FileIOHandler class

Methods

check_and_update_metrics_confs()

Check and Update Metrics Confs.

load_metrics_into_dict()

Load Metrics into Dictionary.

make_dict_of_metrics()

Make dictionary of metrics.

run()

Run.

check_and_update_metrics_confs()[source]

Check and Update Metrics Confs.

A function to check if user provided inputs metrics dir to add to metrics_confs dictionary.

ids = ('plotting_conf',)
load_metrics_into_dict()[source]

Load Metrics into Dictionary.

A method to load a metrics file of a trained model from a previous run into a dictionary.

Returns:

metrics_files_dict – A dictionary containing all of the metrics from the loaded metrics files.

Return type:

dict

make_dict_of_metrics()[source]

Make dictionary of metrics.

A function to create a dictionary for each metrics per run.

Returns:

A dictionary containing metrics or an empty dictionary.

Return type:

dict

run()[source]

Run.

A function to run wave-diff according to the input configuration.

class wf_psf.utils.configs_handler.TrainingConfigHandler(training_conf, file_handler)[source]

Bases: object

TrainingConfigHandler.

A class to handle training configuration parameters.

Parameters:
  • ids (tuple) – A tuple containing a string id for the Configuration Class

  • training_conf (str) – Path of the training configuration file

  • file_handler (object) – A instance of the FileIOHandler class

Methods

run()

Run.

ids = ('training_conf',)
run()[source]

Run.

A function to run wave-diff according to the input configuration.

wf_psf.utils.configs_handler.get_run_config(run_config, config_params, file_handler)[source]

Get Run Configuration.

A function to get the configuration for a wf-psf run.

Parameters:
  • run_config (str) – Name of the type of run configuraton

  • config_params (str) – Path of the run configuration file

  • file_handler (object) – A class instance of FileIOHandler

Returns:

config_class – A class instance of the selected configuration class.

Return type:

object

wf_psf.utils.configs_handler.register_configclass(config_class)[source]

Register Config Class.

A wrapper function to register all config classes in a dictionary.

Parameters:

config_class (type) – Config Class

Returns:

config_class – Config class

Return type:

type

wf_psf.utils.configs_handler.set_run_config(config_name)[source]

Set Config Class.

A function to select the class of a configuration from CONFIG_CLASS dictionary.

Parameters:

config_name (str) – Name of config

Returns:

config_class – Name of config class

Return type:

class