# relations¶

Functions for computing relations between concepts.

pyphi.relations.all_are_equal(seq='__no__default__')
pyphi.relations.all_are_identical(seq='__no__default__')
pyphi.relations.all_minima(seq='__no__default__')

Return the extrema of seq.

Use < as the comparison to obtain the minima; use > as the comparison to obtain the maxima.

Uses only one pass through seq.

Parameters
• comparison (callable) – A comparison operator.

• seq (iterator) – An iterator over a sequence.

Returns

The maxima/minima in seq.

Return type

list

pyphi.relations.all_maxima(seq='__no__default__')

Return the extrema of seq.

Use < as the comparison to obtain the minima; use > as the comparison to obtain the maxima.

Uses only one pass through seq.

Parameters
• comparison (callable) – A comparison operator.

• seq (iterator) – An iterator over a sequence.

Returns

The maxima/minima in seq.

Return type

list

pyphi.relations.indices(iterable)

Convert an iterable to element indices.

pyphi.relations.divergence(p, q)
pyphi.relations.maximal_state(mice)

Return the maximally divergent state(s) for this MICE.

Note that there can be ties.

Returns

A 2D array where each row is a maximally divergent state.

Return type

np.array

pyphi.relations.congruent_nodes(states)

Return the set of nodes that have the same state in all given states.

class pyphi.relations.Relation(relata, purview, phi, ties=None)

A relation among causes/effects.

property relata
property purview
property phi
property ties
property subsystem
property mechanisms
order_by()

Return a list of values to compare for ordering.

The first value in the list has the greatest priority; if the first objects are equal the second object is compared, etc.

static union(tied_relations)

Return the ‘union’ of tied relations.

This is a new Relation object that contains the purviews of the other relations in the ties attribute.

class pyphi.relations.Relata(subsystem, relata)

A set of potentially-related causes/effects.

property subsystem
property mechanisms
property purviews
property maximal_states
__iter__()

Iterate over relata.

overlap()

Return the set of elements that are in the purview of every relatum.

null_relation(purview=None, phi=0.0)
congruent_overlap()

Yield the congruent overlap(s) among the relata.

These are the common purview elements among the relata whose maximally-divergent states are consistent; that is, the largest subset of the union of the purviews such that, for each element, that element’s state is the same according to the maximally divergent state of each relatum.

Note that there can be multiple congruent overlaps.

possible_purviews()

Return all possible purviews.

This is the powerset of the congruent overlap. If there are multiple congruent overlaps because of ties, it is the union of the powerset of each.

partitioned_divergence(purview, mice)

Return the maximal partitioned divergence over this purview.

The purview is cut away from the MICE and the divergence is computed between the unpartitioned repertoire and partitioned repertoire.

If the MICE has multiple tied maximally-divergent states, we take the maximum unpartitioned-partitioned divergence across those tied states.

Parameters
minimum_information_relation(purview)

Return the minimal information relation for this purview.

Parameters
• relata (Relata) – The relata to consider.

• purview (set) – The purview to consider.

maximally_irreducible_relation()

Return the maximally-irreducible relation among these relata.

If there are ties, the tied relations will be recorded in the ‘ties’ attribute of the returned relation.

Returns

the maximally irreducible relation among these relata, with any tied purviews recorded.

Return type

Relation

pyphi.relations.relation(relata)

Return the maximally irreducible relation among the given relata.

Alias for the Relata.maximally_irreducible_relation() method.

pyphi.relations.separate_ces(ces)

Return the individual causes and effects, unpaired, from a CES.

pyphi.relations.all_relations(subsystem, ces)

Return all relations, even those with zero phi.

pyphi.relations.relations(subsystem, ces)

Return the irreducible relations among the causes/effects in the CES.