utility module

This file is part of PyFrac.

Created by Haseeb Zia on Thu Dec 22 17:18:37 2016. Copyright (c) “ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland, Geo-Energy Laboratory”, 2016-2020. All rights reserved. See the LICENSE.TXT file for more details.

utility.ReadFracture(filename)[source]
utility.logging_level(logging_level_string)[source]

This function returns the pertinent logging level based on the string received as input.

Parameters

logging_level_string – string that defines the level of logging: ‘debug’ - Detailed information, typically of interest only when diagnosing problems. ‘info’ - Confirmation that things are working as expected. ‘warning’ - An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’). The software is still working as expected. ‘error’ - Due to a more serious problem, the software has not been able to perform some function. ‘critical’ - A serious error, indicating that the program itself may be unable to continue running.

Returns

code representing the logging error

utility.plot_as_matrix(data, mesh, fig=None)[source]
utility.save_images_to_video(image_folder, video_name='movie')[source]
utility.setup_logging_to_console(verbosity_level='debug')[source]
This function sets up the log to the console

Note: from any module in the code you can use the logging capabilities. You just have to:

  1. import the module

import logging

  1. create a child of the logger named ‘PyFrac’ defined in this function. Use a pertinent name as ‘Pyfrac.frontrec’

logger1 = logging.getLogger(‘PyFrac.frontrec’)

  1. use the object to send messages in the module, such as

logger1.debug(‘debug message’) logger1.info(‘info message’) logger1.warning(‘warn message’) logger1.error(‘error message’) logger1.critical(‘critical message’)

  1. IMPORTANT TO KNOW: 1-If you want to log only to the console in the abobe example you have to use: logger1 = logging.getLogger(‘PyFrac_LC.frontrec’) 2-SystemExit and KeyboardInterrupt exceptions are never swallowed by the logging package .

Parameters

verbosity_level

string that defines the level of logging concerning the console: ‘debug’ - Detailed information, typically of interest only when diagnosing problems. ‘info’ - Confirmation that things are working as expected. ‘warning’ - An indication that something unexpected happened, or indicative of some

problem in the near future (e.g. ‘disk space low’). The software is still working as expected.

’error’ - Due to a more serious problem, the software has not been able to perform

some function.

’critical’ - A serious error, indicating that the program itself may be unable to

continue running.

Returns