aixcalibuha.utils package
Package containing utility functions used in different packages. Contains a statistics analyzer and a visualizer.
- exception aixcalibuha.utils.MaxIterationsReached[source]
Bases:
ExceptionException raised for when the calibration ends because the maximum number of allowed iterations is reached.
- exception aixcalibuha.utils.MaxTimeReached[source]
Bases:
ExceptionException raised for when the calibration ends because the maximum calibration time is reached.
- aixcalibuha.utils.convert_mat_to_suffix(mat_result_file, variable_names, suffix_files, parquet_engine='pyarrow', compression='snappy')[source]
Postprocess the mat result files.
- aixcalibuha.utils.validate_cal_class_input(calibration_classes: CalibrationClass | List[CalibrationClass]) List[CalibrationClass][source]
Check if given list contains only CalibrationClass objects or is one and return a list in both cases. Else raise an error
Submodules
aixcalibuha.utils.configuration module
aixcalibuha.utils.visualizer module
Module with classes and function to help visualize different processes inside the framework. Both plots and print-function/log-function will be implemented here. The Visualizer Class inherits the Logger class, as logging will always be used as a default.
- class aixcalibuha.utils.visualizer.CalibrationLogger(working_directory, name, calibration_class, logger=None)[source]
Bases:
objectBase class for showing the process of functions in this Framework with print-statements and saving everything relevant as a log-file.
- Parameters:
working_directory (str,Path) – Directory where to store the output of the Logger and possible child-classes. If the given directory can not be created, an error will be raised.
name (str) – Name of the reason of logging, e.g. classification, processing etc.
calibration_class (aixcalibuha.CalibrationClass) – Calibration class used in the calibration-process.
logger (logging.Logger) – If given, this logger is used to print and or save the messsages. Else, a new one is set up.
- calibrate_new_class(calibration_class, working_directory=None, for_validation=False)[source]
Function to setup the figures for a new class of calibration. This function is called when instantiating this Class. If you uses continuuos calibration classes, call this function before starting the next calibration-class.
- Parameters:
- calibration_callback_func(xk, obj, verbose_information, penalty=None)[source]
Logs the current values of the objective function.
- property calibration_class: CalibrationClass
Get current calibration class object
- decimal_prec = 6
- integer_prec = 4
- log_initial_names()[source]
Function to log the initial names and the statistical measure before calibration.
- log_intersection_of_tuners(intersected_tuner_parameters, **kwargs)[source]
If an intersection for multiple classes occurs, an information about the statistics of the dataset has to be provided.
- Parameters:
intersected_tuner_parameters (dict) – Dict with cols being the name of the tuner parameter and the value being the list with all the different “best” values for the tuner parameter.
- save_calibration_result(best_iterate, model_name, **kwargs)[source]
Process the result, re-run the simulation and generate a logFile for the minimal quality measurement
- property tuner_paras: TunerParas
- class aixcalibuha.utils.visualizer.CalibrationVisualizer(working_directory, name, calibration_class, logger=None, **kwargs)[source]
Bases:
CalibrationLoggerMore advanced class to not only log ongoing function evaluations but also show the process of the functions by plotting interesting causalities and saving these plots.
- Parameters:
show_plot (boolean) – If False, all created plots are not shown during calibration but only stored at the end of the process.
create_tsd_plot (boolean) – If False, the plot of the time series data (goals) is not created and thus shown in during calibration. It therefore is also not stored, even if you set the save_tsd_plot keyword-argument to true.
save_tsd_plot (boolean) – If True, at each iteration the created plot of the time-series is saved. This may make the process much slower
show_plot_pause_time (float) – Set the time (in seconds) the plt.draw() pauses. May be altered if show_plot yields plot which disappear to fast. Default is 1-e3 s.
- calibrate_new_class(calibration_class, working_directory=None, for_validation=False)[source]
Function to setup the figures for a new class of calibration. This function is called when instantiating this Class. If you uses continuuos calibration classes, call this function before starting the next calibration-class.
- Parameters:
- calibration_callback_func(xk, obj, verbose_information, penalty=None)[source]
Logs the current values of the objective function.
- log_intersection_of_tuners(intersected_tuner_parameters, **kwargs)[source]
If an intersection for multiple classes occurs, an information about the statistics of the dataset has to be provided.
- Parameters:
intersected_tuner_parameters (dict) – Dict with cols being the name of the tuner parameter and the value being the list with all the different “best” values for the tuner parameter.
- save_calibration_result(best_iterate, model_name, **kwargs)[source]
Process the result, re-run the simulation and generate a logFile for the minimal quality measurement
- Parameters:
best_iterate (scipy.optimize.minimize.result) – Result object of the minimization
model_name (str) – Name of the model being calibrated