pyphi.numerics#

Tolerant scalar comparison of φ, Φ, and α values.

Floating-point results that are mathematically equal can differ by roughly 1e-15 when computed through different code paths: distinct algebraic routes to the same value produce different bit patterns, and summation order is not associative. Integrated-information theory treats ties between candidates (partitions, purviews, states, systems) as meaningful, so detecting them requires comparison up to a tolerance rather than exact equality.

These predicates are the only tolerant scalar comparisons in the library. Values themselves are plain floats with exact comparison semantics; tolerance applies where a comparison decides an outcome. Selection among competing φ-objects goes through pyphi.resolve_ties, which clusters candidates with eq().

The tolerance is 10**-precision with precision read from config.numerics.precision at call time (default 13).

Functions

eq(x, y)

Return whether two values are equal up to config.numerics.precision.

eq_mask(array, value)

Return a boolean mask of the elements equal to value up to config.numerics.precision.

is_nonpositive(x)

Return whether x is nonpositive (exact).

is_positive(x)

Return whether x is positive up to config.numerics.precision.

is_zero(x)

Return whether x is zero up to config.numerics.precision.

le(x, y)

Return whether x is less than y or equal to it up to config.numerics.precision.

lt(x, y)

Return whether x is less than y beyond config.numerics.precision: strictly less and not within the tolerance of equal.

positive_mask(array)

Return a boolean mask of the elements positive up to config.numerics.precision.

round_to_precision(x)

Return x rounded to config.numerics.precision decimal places.