Logger#
Logger/library versions#
This functions provides utility functions for logging simulation information and system details using Python’s logging module. It also logs versions of important libraries such as scipy, pyvista, numpy, and logging, along with system information like platform details and Python version.
- pymycar.Logger.library_versions.log_end_analysis(logger, totaltime=0.0)[source]#
Logs the end of an analysis process, including total simulation time and completion timestamp.
- Parameters:
- loggerlogging.Logger
The logger instance used to record the log messages.
- totaltimefloat, optional
The total simulation time to be logged. Default is 0.0.
Notes
This function logs several informational messages indicating the end of computations, the total simulation time, and the timestamp when the analysis finished.
- pymycar.Logger.library_versions.log_geometry_data(logger, data)[source]#
Logs 3D geometry data in a formatted table using the provided logger. Parameters ———- logger : logging.Logger
The logger instance used to output the formatted table.
- datadict
A dictionary where each key is a component name (str) and each value is an iterable of three floats representing the x, y, and z coordinates of the component.
Notes#
The geometry data is displayed in a table with columns: ‘Component’, ‘x’, ‘y’, and ‘z’. Coordinates are formatted to two decimal places.
- pymycar.Logger.library_versions.log_library_versions(logger)[source]#
Log versions of important libraries.
- Parameters:
- loggerlogging.Logger
The logger object to log the information.
- Returns:
- None
Notes
This function logs the versions of important libraries including Python, DolfinX, ufl, basix, numpy, and logging.
- pymycar.Logger.library_versions.log_system_info(logger)[source]#
Log system information using the provided logger.
- Parameters:
- loggerlogging.Logger
The logger object to be used for logging system information.
- Returns:
- None
Notes
This function logs various system information including operating system, architecture, user name, processor, machine type, and Python version.
- pymycar.Logger.library_versions.logger_suspension_kinematics(data, max_height_increase, max_height_decrease, height_step, save_to_txt=True, result_folder_name='results', path=None)[source]#
Logs suspension kinematics simulation parameters and system information. This function sets up a logger, logs system and library version information, and records the initial geometry data and simulation parameters for a suspension kinematics analysis. Optionally, results can be saved to a text file in a specified folder. Parameters ———- data : dict
Dictionary containing the initial geometry data for the suspension system.
- max_height_increasefloat
Maximum increase in suspension height to simulate.
- max_height_decreasefloat
Maximum decrease in suspension height to simulate.
- height_stepfloat
Step size for height changes during the simulation.
- save_to_txtbool, optional
Whether to save the results to a text file (default is True).
- result_folder_namestr, optional
Name of the folder where results will be saved (default is “results”).
- pathstr or None, optional
Path to the directory where the results folder will be created (default is None).
Returns#
- None
This function logs information but does not return any value.
- pymycar.Logger.library_versions.set_logger(result_folder_name)[source]#
Set up a logger for logging simulation information.
- Parameters:
- result_folder_namestr
The name of the folder where the log file will be stored.
- Returns:
- logging.Logger
The logger object set up for logging simulation information.
Notes
This function sets up a logger named ‘simulation_logger’ with INFO level logging. It creates a log file named ‘simulation.log’ in the specified result folder.
Examples
>>> logger = set_logger('results_folder')