pe.logger package
Submodules
pe.logger.csv_print module
- class pe.logger.csv_print.CSVPrint(output_folder, path_separator='-', float_format='.8f', flush_iteration_freq=1)[source]
Bases:
Logger
The logger that prints the metrics to CSV files.
- __init__(output_folder, path_separator='-', float_format='.8f', flush_iteration_freq=1)[source]
Constructor.
- Parameters:
output_folder (str) – The output folder that will be used to save the CSV files
path_separator (str, optional) – The string that will be used to replace ‘’ and ‘/’ in log names, defaults to “-”
float_format (str, optional) – The format of the floating point numbers, defaults to “.8f”
flush_iteration_freq (int, optional) – The frequency to flush the logs, defaults to 1
- _get_log_path(iteration, item)[source]
Get the log path.
- Parameters:
iteration (int) – The PE iteration number
item (
pe.metric_item.MetricItem
) – The metric item
- Returns:
The log path
- Return type:
str
- _log_float(log_path, iteration, item)[source]
Log a float metric item.
- Parameters:
log_path (str) – The path of the log file
iteration (int) – The PE iteration number
item (
pe.metric_item.FloatMetricItem
orpe.metric_item.FloatListMetricItem
) – The float metric item
- log(iteration, metric_items)[source]
Log the metrics.
- Parameters:
iteration (int) – The PE iteration number
metric_items (list[
pe.metric_item.MetricItem
]) – The metrics to log
pe.logger.image_file module
- class pe.logger.image_file.ImageFile(output_folder, path_separator='-', iteration_format='09d')[source]
Bases:
Logger
The logger that saves images to files.
- __init__(output_folder, path_separator='-', iteration_format='09d')[source]
Constructor.
- Parameters:
output_folder (str) – The output folder that will be used to save the images
path_separator (str, optional) – The string that will be used to replace ‘’ and ‘/’ in log names, defaults to “-”
iteration_format (str, optional) – The format of the iteration number, defaults to “09d”
- _get_image_path(iteration, item)[source]
Get the image save path.
- Parameters:
iteration (int) – The PE iteration number
item (
pe.metric_item.ImageMetricItem
orpe.metric_item.ImageListMetricItem
) – The image metric item
- Returns:
The image save path
- Return type:
str
- _log_image(image_path, item)[source]
Log a single image.
- Parameters:
image_path (str) – The path to save the image
item (
pe.metric_item.ImageMetricItem
) – The image metric item
- _log_image_list(image_path, item)[source]
Log a list of images.
- Parameters:
image_path (str) – The path to save the image
item (
pe.metric_item.ImageListMetricItem
) – The image list metric item
- log(iteration, metric_items)[source]
Log the images.
- Parameters:
iteration (int) – The PE iteration number
metric_items (list[
pe.metric_item.ImageMetricItem
orpe.metric_item.ImageListMetricItem
]) – The images to log
pe.logger.log_print module
- class pe.logger.log_print.LogPrint(log_iteration_freq=1)[source]
Bases:
Logger
The logger that prints the metrics to the console/file using
pe.logging.execution_logger
.- __init__(log_iteration_freq=1)[source]
Constructor.
- Parameters:
log_iteration_freq (int, optional) – The frequency to log the metrics, defaults to 1
- log(iteration, metric_items)[source]
Log the metrics to the console/file.
- Parameters:
iteration (int) – The PE iteration number
metric_items (list[
pe.metric_item.FloatMetricItem
orpe.metric_item.FloatListMetricItem
]) – The metrics to log
pe.logger.logger module
- class pe.logger.logger.Logger[source]
Bases:
ABC
The abstract class for logging the metrics
- abstract log(iteration, metric_items)[source]
Log the metrics.
- Parameters:
iteration (int) – The PE iteration number
metric_items (list[
pe.metric_item.MetricItem
]) – The metrics to log
pe.logger.matplotlib_pdf module
- class pe.logger.matplotlib_pdf.MatplotlibPDF(output_folder, path_separator='-', iteration_format='09d')[source]
Bases:
Logger
The logger that saves Matplotlib figures to PDF files.
- __init__(output_folder, path_separator='-', iteration_format='09d')[source]
Constructor.
- Parameters:
output_folder (str) – The output folder that will be used to save the PDF files
path_separator (str, optional) – The string that will be used to replace ‘’ and ‘/’ in log names, defaults to “-”
iteration_format (str, optional) – The format of the iteration number, defaults to “09d”
- _get_pdf_path(iteration, item)[source]
Get the PDF save path.
- Parameters:
iteration (int) – The PE iteration number
item (
pe.metric_item.MatplotlibMetricItem
) – The Matplotlib figure metric item
- Returns:
The PDF save path
- Return type:
str
- log(iteration, metric_items)[source]
Log the Matplotlib figures to PDF files.
- Parameters:
iteration (int) – The PE iteration number
metric_items (list[
pe.metric_item.MatplotlibMetricItem
]) – The Matplotlib figures to log