Utilities (cachai.utilities)

Documentation /Utilities

The cachai.utilities module contains supporting tools primarily designed for internal use, though some functions may be useful in other contexts.

Contents

chsave(…)

Saves the current matplotlib figure as PNG and optionally PDF with customizable dpi (dots per inch).

angdist(…)

Calculates the minimal angular distance between two angles in radians.

map_from_curve(…)

Generates a map (2D matrix) where each point value is based on its proximity to the nearest point along a specified curve.

colormapped_patch(…)

Applies a colormap to a patch object using a precomputed map matrix, creating a color-filled shape.

equidistant(…)

Resamples points along a curve to make them equidistant while preserving the overall shape.

quadratic_bezier(…)

Evaluates a quadratic Bézier curve at parameter t using three control points.

cubic_bezier(…)

Evaluates a cubic Bézier curve at parameter t using four control points.

get_bezier_curve(…)

Generates a sequence of points along a Bézier curve.

validate_kwargs(…)

Validates that given keyword arguments are within the allowed set of parameters.

kwargs_as_string(…)

Formats keyword argument names as a readable string separated by ,, with optional aliases.

mod_color(…)

Applies multiple color modifications (lightness, saturation, transparency) to an RGB color.

brighter_color(…)

Increases the brightness of an RGB color by a specified factor.

darker_color(…)

Decreases the brightness of an RGB color by a specified factor.

saturate_color(…)

Adjusts the saturation level of an RGB color by a specified factor.

alpha_color(…)

Simulates transparency by blending an RGB color with a background color.

strcol(…)

Applies ANSI color codes to a string (only work in terminal/output cells).

strcol_palette()

Displays a visual palette of all available ANSI 256-color codes for terminal text coloring.