Algebra#

Extrapolation#

colour

Extrapolator([interpolator, method, left, ...])

Extrapolate the 1-D function of given interpolator.

Interpolation#

colour

KernelInterpolator(x, y[, window, kernel, ...])

Kernel based interpolation of a 1-D function.

NearestNeighbourInterpolator(*args, **kwargs)

A nearest-neighbour interpolator.

LinearInterpolator(x, y[, dtype])

Interpolate linearly a 1-D function.

NullInterpolator(x, y[, absolute_tolerance, ...])

Perform 1-D function null interpolation, i.e. a call within given tolerances will return existing \(y\) variable values and default if outside tolerances.

PchipInterpolator(x, y, *args, **kwargs)

Interpolate a 1-D function using Piecewise Cubic Hermite Interpolating Polynomial interpolation.

SpragueInterpolator(x, y[, dtype])

Construct a fifth-order polynomial that passes through \(y\) dependent variable.

lagrange_coefficients(r[, n])

Compute the Lagrange Coefficients at given point \(r\) for degree \(n\).

TABLE_INTERPOLATION_METHODS

Supported table interpolation methods.

table_interpolation(V_xyz, table[, method])

Perform interpolation of given \(V_{xyz}\) values using given interpolation table.

Interpolation Kernels

colour

kernel_nearest_neighbour(x)

Return the nearest-neighbour kernel evaluated at given samples.

kernel_linear(x)

Return the linear kernel evaluated at given samples.

kernel_sinc(x[, a])

Return the sinc kernel evaluated at given samples.

kernel_lanczos(x[, a])

Return the lanczos kernel evaluated at given samples.

kernel_cardinal_spline(x[, a, b])

Return the cardinal spline kernel evaluated at given samples.

Ancillary Objects

colour.algebra

table_interpolation_trilinear(V_xyz, table)

Perform the trilinear interpolation of given \(V_{xyz}\) values using given interpolation table.

table_interpolation_tetrahedral(V_xyz, table)

Perform the tetrahedral interpolation of given \(V_{xyz}\) values using given interpolation table.

Coordinates#

colour.algebra

cartesian_to_spherical(a)

Transform given cartesian coordinates array \(xyz\) to spherical coordinates array \(\rho\theta\phi\) (radial distance, inclination or elevation and azimuth).

spherical_to_cartesian(a)

Transform given spherical coordinates array \(\rho\theta\phi\) (radial distance, inclination or elevation and azimuth) to cartesian coordinates array \(xyz\).

cartesian_to_polar(a)

Transform given cartesian coordinates array \(xy\) to polar coordinates array \(\rho\phi\) (radial coordinate, angular coordinate).

polar_to_cartesian(a)

Transform given polar coordinates array \(\rho\phi\) (radial coordinate, angular coordinate) to cartesian coordinates array \(xy\).

cartesian_to_cylindrical(a)

Transform given cartesian coordinates array \(xyz\) to cylindrical coordinates array \(\rho\phi z\) (radial distance, azimuth and height).

cylindrical_to_cartesian(a)

Transform given cylindrical coordinates array \(\rho\phi z\) (radial distance, azimuth and height) to cartesian coordinates array \(xyz\).

Geometry#

colour.algebra

normalise_vector(a)

Normalise given vector \(a\).

euclidean_distance(a, b)

Return the Euclidean distance between point array \(a\) and point array \(b\).

manhattan_distance(a, b)

Return the Manhattan (or City-Block) distance between point array \(a\) and point array \(b\).

extend_line_segment(a, b[, distance])

Extend the line segment defined by point arrays \(a\) and \(b\) by given distance and return the new end point.

intersect_line_segments(l_1, l_2)

Compute \(l_1\) line segments intersections with \(l_2\) line segments.

ellipse_coefficients_general_form(coefficients)

Return the general form ellipse coefficients from given canonical form ellipse coefficients.

ellipse_coefficients_canonical_form(coefficients)

Return the canonical form ellipse coefficients from given general form ellipse coefficients.

point_at_angle_on_ellipse(phi, coefficients)

Return the coordinates of the point at angle \(\phi\) in degrees on the ellipse with given canonical form coefficients.

ELLIPSE_FITTING_METHODS

Supported ellipse fitting methods.

ellipse_fitting(a[, method])

Return the coefficients of the implicit second-order polynomial/quadratic curve that fits given point array \(a\) using given method.

Ancillary Objects

colour.algebra

LineSegmentsIntersections_Specification(xy, ...)

Define the specification for intersection of line segments \(l_1\) and \(l_2\) returned by colour.algebra.intersect_line_segments() definition.

ellipse_fitting_Halir1998(a)

Return the coefficients of the implicit second-order polynomial/quadratic curve that fits given point array \(a\) using Halir and Flusser (1998) method.

Random#

colour.algebra

random_triplet_generator(size[, limits, ...])

Return a generator yielding random triplets.

Regression#

colour.algebra

least_square_mapping_MoorePenrose(y, x)

Compute the least-squares mapping from dependent variable \(y\) to independent variable \(x\) using Moore-Penrose inverse.

Common#

colour.algebra

get_sdiv_mode()

Return Colour safe division mode.

set_sdiv_mode(mode)

Set Colour safe division function mode.

sdiv_mode([mode])

Define a context manager and decorator temporarily setting Colour safe division function mode.

sdiv(a, b)

Divide given array \(b\) with array \(b\) while handling zero-division.

is_spow_enabled()

Return whether Colour safe / symmetrical power function is enabled.

set_spow_enable(enable)

Set Colour safe / symmetrical power function enabled state.

spow_enable(enable)

Define a context manager and decorator temporarily setting Colour safe / symmetrical power function enabled state.

spow(a, p)

Raise given array \(a\) to the power \(p\) as follows: \(sign(a) * |a|^p\).

normalise_maximum(a[, axis, factor, clip])

Normalise given array \(a\) values by \(a\) maximum value and optionally clip them between.

vector_dot(m, v)

Perform the dot product of the matrix array \(m\) with the vector array \(v\).

matrix_dot(a, b)

Perform the dot product of the matrix array \(a\) with the matrix array \(b\).

linear_conversion(a, old_range, new_range)

Perform a simple linear conversion of given array \(a\) between the old and new ranges.

linstep_function(x[, a, b, clip])

Perform a simple linear interpolation between given array \(a\) and array \(b\) using \(x\) array.

lerp(x[, a, b, clip])

Perform a simple linear interpolation between given array \(a\) and array \(b\) using \(x\) array.

smoothstep_function(x[, a, b, clip])

Evaluate the smoothstep sigmoid-like function on array \(x\).

smooth(x[, a, b, clip])

Evaluate the smoothstep sigmoid-like function on array \(x\).

is_identity(a)

Return whether \(a\) array is an identity matrix.

eigen_decomposition(a[, eigen_w_v_count, ...])

Return the eigen-values \(w\) and eigen-vectors \(v\) of given array \(a\) in given order.