models.cuts

Objects that represent partitions of sets of nodes.

class pyphi.models.cuts.Cut

Represents a unidirectional cut.

from_nodes

tuple[int] – Connections from this group of nodes to those in to_nodes are from_nodes.

to_nodes

tuple[int] – Connections to this group of nodes from those in from_nodes are from_nodes.

Create new instance of Cut(from_nodes, to_nodes)

indices

Returns the indices of this cut.

splits_mechanism(mechanism)

Check if this cut splits a mechanism.

Parameters:mechanism (tuple[int]) – The mechanism in question.
Returns:True if mechanism has elements on both sides of the cut; False otherwise.
Return type:bool
cuts_connections(a, b)

Check if this cut severs any connections from a to b.

all_cut_mechanisms()

Return all mechanisms with elements on both sides of this cut.

Returns:tuple[tuple[int]]
apply_cut(cm)

Return a modified connectivity matrix where the connections from one set of nodes to the other are destroyed.

cut_matrix()

Compute the cut matrix for this cut.

The cut matrix is a square matrix which represents connections severed by the cut. The matrix is shrunk to the size of the cut subsystem—not necessarily the size of the entire network.

Example

>>> cut = Cut((1,), (2,))
>>> cut.cut_matrix()
array([[ 0.,  1.],
       [ 0.,  0.]])
to_json()

Return a JSON-serializable representation.

class pyphi.models.cuts.ActualCut

Represents an cut for a Context.

cause_part1

tuple[int] – Connections from this group to those in effect_part2 are cut.

cause_part2

tuple[int] – Connections from this group to those in effect_part1 are cut.

effect_part1

tuple[int] – Connections to this group from cause_part2 are cut.

effect_part2

tuple[int] – Connections to this group from cause_part1 are cut.

Create new instance of ActualCut(cause_part1, cause_part2, effect_part1, effect_part2)

indices

tuple[int] – The indices in this cut.

apply_cut(cm)

Cut a connectivity matrix.

Parameters:cm (np.ndarray) – A connectivity matrix
Returns:A copy of the connectivity matrix with connections cut across the cause and effect indices.
Return type:np.ndarray
cut_matrix()
class pyphi.models.cuts.Part

Represents one part of a Bipartition.

mechanism

tuple[int] – The nodes in the mechanism for this part.

purview

tuple[int] – The nodes in the mechanism for this part.

Example

When calculating \(\varphi\) of a 3-node subsystem, we partition the system in the following way:

mechanism:  A,C    B
            ─── ✕ ───
  purview:   B    A,C

This class represents one term in the above product.

Create new instance of Part(mechanism, purview)

to_json()

Return a JSON-serializable representation.

class pyphi.models.cuts.KPartition

A partition with an arbitrary number of parts.

Construct the base tuple with multiple Part arguments.

static __new__(*args)

Construct the base tuple with multiple Part arguments.

__getnewargs__()

And support unpickling with this __new__ signature.

mechanism

tuple[int] – The nodes of the mechanism in the partition.

purview

tuple[int] – The nodes of the purview in the partition.

to_json()
class pyphi.models.cuts.Bipartition

A bipartition of a mechanism and purview.

part0

Part – The first part of the partition.

part1

Part – The second part of the partition.

Construct the base tuple with multiple Part arguments.

to_json()

Return a JSON-serializable representation.

classmethod from_json(json)
class pyphi.models.cuts.Tripartition

Construct the base tuple with multiple Part arguments.