gerg_plotting.modules.utilities#
Module Contents#
- gerg_plotting.modules.utilities.calculate_pad(var, pad=0.0) tuple[float, float]#
Calculate padded range of values in an array.
Parameters#
- vararray_like
Input array to calculate padded range from
- padfloat, optional
Amount of padding to add to both ends of the range, default is 0.0
Returns#
- tuple[float, float]
Tuple of (min_value - pad, max_value + pad)
- gerg_plotting.modules.utilities.calculate_range(var) list[float, float]#
Calculate the range of values in an array, ignoring NaN values.
Parameters#
- vararray_like
Input array to calculate range from
Returns#
- list[float, float]
List containing [minimum, maximum] values
- gerg_plotting.modules.utilities.extract_kwargs(kwargs: dict, defaults: dict)#
Extracts values from kwargs with defaults for missing keys.
Parameters:#
- kwargsdict
The keyword arguments dictionary.
- defaultsdict
A dictionary of default values for keys.
Returns:#
- dict
A dictionary containing the extracted values.
- gerg_plotting.modules.utilities.extract_kwargs_with_aliases(kwargs, defaults)#
Extracts values from kwargs, handling key aliases and defaults.
Parameters:#
- kwargsdict
The keyword arguments dictionary.
- defaultsdict
A dictionary where keys are the primary keys or tuples of aliases, and values are the default values.
Returns:#
- dict
A dictionary containing the extracted values using the primary keys.
- gerg_plotting.modules.utilities.print_datetime(message) None#
Prints a message with the current date and time in ‘YYYY-MM-DD HH:MM:SS’ format.
- Parameters:
message (str): The message to include in the output.
- gerg_plotting.modules.utilities.print_time(message) None#
Prints a message with the current time in ‘HH:MM:SS’ format.
- Parameters:
message (str): The message to include in the output.
- gerg_plotting.modules.utilities.to_numpy_array(values) numpy.ndarray#
Convert various data types to a numpy array using pandas Series as parser.
Parameters#
- valuesarray_like
Input data that can be converted to a numpy array (lists, tuples, sets, etc.)
Returns#
- np.ndarray or None
Numpy array of the input values, or None if input is None
Raises#
- TypeError
If input is a dictionary