rball.utils package
Submodules
rball.utils.grid_generator module
- class rball.utils.grid_generator.GridGenerator(refinement_levels: int = 2)[source]
Bases:
object
- __init__(refinement_levels: int = 2)[source]
Generate a grid of points for response generation. An Icosahedral with facepoint is chosen because it is closest to equal area while still being very fast for triangulation
- Parameters
refinement_levels (int) –
- Returns
- property n_grid_points: int
- property lons: numpy.ndarray
- property lats: numpy.ndarray
- property phi: numpy.ndarray
- property theta: numpy.ndarray
- property xyz: numpy.ndarray
return the cartesian points on the grid
- Returns
rball.utils.logging module
- rball.utils.logging.colored(text, color=None, on_color=None, attrs=None, ansi_code=None)[source]
Colorize text, while stripping nested ANSI color sequences. Author: Konstantin Lepa <konstantin.lepa@gmail.com> / termcolor Available text colors:
red, green, yellow, blue, magenta, cyan, white.
- Available text highlights:
on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.
- Available attributes:
bold, dark, underline, blink, reverse, concealed.
Example
colored(‘Hello, World!’, ‘red’, ‘on_grey’, [‘blue’, ‘blink’]) colored(‘Hello, World!’, ‘green’)
- rball.utils.logging.cprint(text, color=None, on_color=None, attrs=None)[source]
Print colorize text. Author: Konstantin Lepa <konstantin.lepa@gmail.com> / termcolor It accepts arguments of print function.
- class rball.utils.logging.ColoredRecord(record)[source]
Bases:
object
Wraps a LogRecord, adding named escape codes to the internal dict. The internal dict is used when formatting the message (by the PercentStyle, StrFormatStyle, and StringTemplateStyle classes).
- class rball.utils.logging.ColoredFormatter(fmt, datefmt=None, style='%', log_colors=None, reset=True, secondary_log_colors=None)[source]
Bases:
logging.Formatter
A formatter that allows colors to be placed in the format string. Intended to help in creating more readable logging output. Based on https://github.com/borntyping/python-colorlog
- __init__(fmt, datefmt=None, style='%', log_colors=None, reset=True, secondary_log_colors=None)[source]
Set the format and colors the ColouredFormatter will use. The
fmt
,datefmt
andstyle
args are passed on to thelogging.Formatter
constructor. Thesecondary_log_colors
argument can be used to create additionallog_color
attributes. Each key in the dictionary will set{key}_log_color
, using the value to select from a differentlog_colors
set. :Parameters: - fmt (str): The format string to use - datefmt (str): A format string for the date - log_colors (dict):A mapping of log level names to color names
- reset (bool):
Implicitly append a color reset to all records unless False
- style (‘%’ or ‘{’ or ‘$’):
The format style to use. (No meaning prior to Python 3.2.)
- secondary_log_colors (dict):
Map secondary
log_color
attributes. (New in version 2.6.)
- rball.utils.logging.escape_codes(log_colors, level_name)[source]
Return escape codes from a
log_colors
dict.
- rball.utils.logging.hash_coloured_escapes(text)[source]
Return the ANSI hash colour prefix and suffix for a given text
- rball.utils.logging.silence_warnings()[source]
supress warning messages in console and file usr logs
rball.utils.package_data module
- rball.utils.package_data.get_path_of_data_file(data_file: str) pathlib.Path [source]
get the path of a dat file
- Parameters
data_file (str) – name of the data file
- Returns