pyphi.compositional_state.CompositionalState#

class pyphi.compositional_state.CompositionalState(distinctions=None)[source]#

Bases: UserDict

Represent assignments of purviews to mechanisms.

Has the following structure:

{
    <purview>: {
        Direction.CAUSE: {<mechanism>},
        Direction.EFFECT: {<mechanism>},
    }
}

where {<mechanism>} is a set of mechanisms. To represent a valid compositional state, this set must be a singleton; however, the class can be used with multiple mechanisms per purview & direction to keep track of conflicts among the distinctions in a CauseEffectStructure.

purviews()[source]#

Return all purviews in this CompositionalState.

mechanisms()[source]#

Return all mechanisms in this CompositionalState.

update(value)[source]#

Update the CompositionalState with one or more distinctions.

has_conflicts(purview=None, mechanism=None)[source]#

Return whether the CompositionalState has conflicts.

conflicted_purviews()[source]#

Return the purviews that are conflicted (specified by >1 distinction).

conflicted_mechanisms()[source]#

Return the mechanisms that are conflicted (specify >1 purview)

conflicts()[source]#

Return the subset of the CompositionalState that has conflicts.

remove(mechanism)[source]#

Remove a mechanism from this CompositionalState in-place.

number_of_conflicts(mechanism)[source]#

Return the number of other mechanisms the given mechanism conflicts with.

resolve_conflicts(func=None)[source]#

Greedily discard extra mechanisms to return a valid CompositionalState.

Mechanisms with the most conflicts are discarded first.

conflicts_with(mechanism, cause_purview, effect_purview)[source]#

Return whether the distinction conflicts with this CompositionalState.

conflicts_with_distinction(distinction)[source]#

Return whether the given distinction conflicts.

resolve_conflicts_consistently(other)[source]#

Greedily resolve conflicts in this CompositionalState in a manner consistent with the other one.

filter(distinctions)[source]#

Return only the distinctions that are consistent with this CompositionalState. The result preserves the resolution subtype of the input.

classmethod nonconflicting_consistent_ces_set(distinction_set, reference=None)[source]#

Return new CESs that are nonconflicting and consistent with the first.

Optionally specify a reference CompositionalState with which to enforce consistency.

TODO: define ‘consistent’