utilities

async

await_callback

Wait for the completion of an asynchronous code that uses callbacks to signal completion.

colors

i_to_rgb

Convert a number between 0.0 and 1.0 to an equivalent RGB tuple.

i_to_red

Convert a number between 0.0 and 1.0 to a shade of red.

i_to_green

Convert a number between 0.0 and 1.0 to a shade of green.

i_to_blue

Convert a number between 0.0 and 1.0 to a shade of blue.

i_to_white

Convert a number between 0.0 and 1.0 to a shade of white.

i_to_black

Convert a number between 0.0 and 1.0 to a shade of black.

rgb_to_hex

Convert an RGB color specification to HEX.

color_to_colordict

Convert a color specification to a dict of colors.

color_to_rgb

Convert a HEX or RGB color to RGB.

encoders

DataEncoder

Data encoder for custom JSON serialization with support for COMPAS data structures and geometric primitives.

DataDecoder

Data decoder for custom JSON serialization with support for COMPAS data structures and geometric primitives.

itertools

flatten

Flatten one level of nesting

linspace

Generate a sequence of evenly spaced numbers over a specified interval.

meshgrid

Construct coordinate matrices from two coordinate vectors.

pairwise

Returns a sliding window of size 2 over the data of the iterable.

window

Returns a sliding window (of width n) over the data from the iterable.

iterable_like

Creates an iterator from a reference object with size equivalent to that of a target iterable.

normalize_values

Normalize a list of numbers to the range between new_min and new_max.

remap_values

Maps a list of numbers from one domain to another.

maps

geometric_key

Convert XYZ coordinates to a string that can be used as a dict key.

reverse_geometric_key

Reverse a geometric key string into xyz coordinates.

geometric_key_xy

Convert XY coordinates to a string that can be used as a dict key.