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.

rball.utils.logging.isnotebook()[source]

Check if running within a Jupyter notebook

rball.utils.logging.supports_color()[source]

Checks if the terminal supports color.

rball.utils.logging.esc(*x)[source]

Create escaped code from format code

rball.utils.logging.parse_colors(sequence)[source]

Return escape codes from a color sequence.

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).

__init__(record)[source]

Add attributes from the escape_codes dict and the record.

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 and style args are passed on to the logging.Formatter constructor. The secondary_log_colors argument can be used to create additional log_color attributes. Each key in the dictionary will set {key}_log_color, using the value to select from a different log_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.)

format(record)[source]

Format a message from a record object.

rball.utils.logging.escape_codes(log_colors, level_name)[source]

Return escape codes from a log_colors dict.

rball.utils.logging.hash_coloured(text)[source]

Return a ANSI coloured text based on its hash

rball.utils.logging.hash_coloured_escapes(text)[source]

Return the ANSI hash colour prefix and suffix for a given text

class rball.utils.logging.LogFilter(level)[source]

Bases: object

__init__(level)[source]
filter(logRecord)[source]
rball.utils.logging.silence_warnings()[source]

supress warning messages in console and file usr logs

rball.utils.logging.activate_warnings()[source]

supress warning messages in console and file usr logs

rball.utils.logging.update_logging_level(level)[source]
rball.utils.logging.setup_logger(name)[source]

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

rball.utils.package_data.get_path_of_data_dir() pathlib.Path[source]

get the path of the package data directory

Returns

rball.utils.package_data.get_path_of_user_config() pathlib.Path[source]

get the path to the user configuration

Returns

Module contents