turboflow.pysolver_view.pysolver_utilities module
- turboflow.pysolver_view.pysolver_utilities.create_logger(name, path=None, use_datetime=True)[source]
Creates and configures a logging object for recording logs during program execution.
- Parameters:
- namestr
Name of the log file. Allows for differentiation when analyzing logs from different components or runs of a program.
- pathstr, optional
Specifies the directory where the log files will be saved. By default, a directory named “logs” will be created in the current working directory (cwd).
- use_datetimebool, optional
Determines whether the log filename should have a unique datetime identifier appended. Default is True.
- Returns:
- loggerobject
Configured logger object.
Notes
By default, the function sets the log level to INFO, which means the logger will handle messages of level INFO and above (like ERROR, WARNING, etc.). The log entries will contain the timestamp, log level, and the actual log message.
When use_datetime=True, each log file will have a unique datetime identifier. This ensures traceability, avoids overwriting previous logs, allows chronological ordering of log files, and handles concurrency in multi-instance environments.
- turboflow.pysolver_view.pysolver_utilities.print_installed_fonts()[source]
Print the list of fonts installed on the system.
This function identifies and prints all available fonts for use in Matplotlib.
- turboflow.pysolver_view.pysolver_utilities.print_rc_parameters(filename=None)[source]
Print the current rcParams used by Matplotlib or write to file if provided.
This function provides a quick overview of the active configuration parameters within Matplotlib.
- turboflow.pysolver_view.pysolver_utilities.savefig_in_formats(fig, path_without_extension, formats=['.png', '.svg'], dpi=500)[source]
Save a given Matplotlib figure in multiple file formats.
- Parameters:
- figmatplotlib.figure.Figure
The figure object to be saved.
- path_without_extensionstr
The full path to save the figure excluding the file extension.
- formatslist of str, optional
A list of string file extensions to specify which formats the figure should be saved in. Supported formats are [‘.png’, ‘.svg’, ‘.pdf’, ‘.eps’]. Default is [‘.png’, ‘.svg’].
- dpiint, optional
The resolution in dots per inch with which to save the image. This parameter affects only PNG files. Default is 500.
Examples
>>> import matplotlib.pyplot as plt >>> fig, ax = plt.subplots() >>> ax.plot([0, 1], [0, 1]) >>> save_fig_in_formats(fig, "/path/to/figure/filename")
This will save the figure as “filename.png”, “filename.svg”, and “filename.pdf” in the “/path/to/figure/” directory.
- turboflow.pysolver_view.pysolver_utilities.set_plot_options(fontsize=13, grid=False, major_ticks=True, minor_ticks=True, margin=0.05, color_order='matlab', linewidth=1.25)[source]
Set options for creating publication-quality figures using Matplotlib.
This function updates the internal Matplotlib settings to better align with standards for publication-quality figures. Features include improved font selections, tick marks, grid appearance, and color selections.
- Parameters:
- fontsizeint, optional
Font size for text elements in the plot. Default is 13.
- gridbool, optional
Whether to show grid lines on the plot. Default is True.
- major_ticksbool, optional
Whether to show major ticks. Default is True.
- minor_ticksbool, optional
Whether to show minor ticks. Default is True.
- marginfloat, optional
Margin size for axes. Default is 0.05.
- color_orderstr, optional
Color order to be used for plot lines. Options include “python” and “matlab”. Default is “matlab”.