Core API Reference#

ReceptorEstimator class#

ReceptorEstimator(filters[, domain, ...])

Core class in drEye for analyzing and fitting to capture values given a set of receptor filters and a set of stimulation sources that comprise an experimental system.

Template functions#

gaussian_template(wavelengths, mean[, std])

Create Gaussian filter template normalized to the max.

govardovskii2000_template(wavelengths, alpha_max)

Calculate Opsin template according to Govardovskii et al (2000).

stavenga1993_template(wavelengths, alpha_max)

Calculate opsin template according to Stavenga et al (1993).

Conversion functions#

irr2flux(irradiance, wavelengths[, ...])

Convert from irradiance to photonflux.

flux2irr(photonflux, wavelengths[, ...])

Convert from photonflux to irradiance.

optional_to(obj, units, *args, **kwargs)

Optionally convert to units if obj is a pint.Quantity and return numeric value or np.ndarray object.

has_units(obj)

Check if object has units via duck-typing.

ureg

The unit registry stores the definitions and relationships between units.

Utility functions#

l1norm(arr[, axis, keepdims])

Calculate the L1-norm of an array along a given axis.

l2norm(arr[, axis, keepdims])

Calculate the L2-norm of an array along a given axis.

integral(arr, domain[, axis, keepdims])

Calculate the integral of an array over a given domain along an axis.

calculate_capture(filters, signals[, ...])

Calculate the stimulus-induced capture.

round_to_precision(x[, precision])

Round an array to a specified precision.

round_to_significant_digits(x[, p])

Round an array to a specified number of round to significant digits.

arange_with_interval(start, stop, step[, ...])

Return evenly spaced values within a given interval.

Barycentric functions#

barycentric_to_cartesian(X[, center])

Convert from barycentric coordinates to cartesian coordinates

cartesian_to_barycentric(X[, L1, centered])

Convert from cartesian to barycentric coordinates.

Convex Hull functions#

in_hull(P, B[, bounded, qhull_options])

Check if points B are in the convex hull of P.

range_of_solutions(B, A, lb, ub[, K, ...])

Calculate the range of solutions for a bound-constrained system of linear equations.

Domain functions#

equalize_domains(domains, arrs[, axes, ...])

Equalize domains between different arrays.

Metrics functions#

compute_jensen_shannon_divergence(P, Q[, base])

Compute Jensen-Shannon divergence between two probability distributions P and Q.

compute_jensen_shannon_similarity(P, Q)

Compute Jensen-Shannon similarity between two probability distributions P and Q.

compute_mean_width(X[, n, vectorized, ...])

Compute mean width of a matrix X by projecting it onto random vectors.

compute_mean_correlation(X)

Compute mean correlation of a matrix X.

compute_mean_mutual_info(X, **kwargs)

Compute mean mutual information of a matrix X.

compute_volume(X)

Compute volume of a matrix X.

compute_gamut(X[, at_l1, relative_to, ...])

Compute absolute gamut of a matrix X.

Projection functions#

proj_P_for_hull(P[, hull_class, ...])

This function projects the input array P until it defines a convex hull.

proj_P_to_simplex(P, c)

Project the points that project the convex hull entailed by P onto the simplex with sum of c.

line_to_simplex(x1, x2, c[, axis, checks])

This function finds the point where the line defined by vectors x1 and x2 intersects with the simplex with sum of c.

proj_B_to_hull(B, equations)

Project B to the convex hull defined by the hyperplane equations of the facets.

alpha_for_B_with_P(B, equations)

Get the multiple of vector that intersects with the hull.

B_with_P(B, equations)

Find the hull intersection of vectors B.

Sampling functions#

sample_in_hull(P, n[, seed, engine, ...])

Sampling uniformly from the convex hull defined by points P.

d_equally_spaced(n, d[, one_inclusive])

Creates equally spaced samples in d dimensions.

Spherical functions#

spherical_to_cartesian(Y)

Convert from spherical to cartesian coordinates.

cartesian_to_spherical(X)

Convert from cartesian to spherical coordinates.