Skip to content

put strong connectivity check in config.SHORTCIRCUIT_SIA. #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: feature/iit-4.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyphi/new_big_phi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class ShortCircuitConditions(Enum):
NO_VALID_PARTITIONS = auto()
NO_CAUSE = auto()
NO_EFFECT = auto()
NOT_STRONGLY_CONNECTED = auto()


def _has_no_cause_or_effect(system_state):
Expand Down Expand Up @@ -300,6 +301,7 @@ def sia(
partitions: Optional[Iterable] = None,
system_state: Optional[SystemStateSpecification] = None,
subsystem_cause: Optional[Subsystem] = None,

**kwargs,
) -> SystemIrreducibilityAnalysis:
"""Find the minimum information partition of a system."""
Expand Down Expand Up @@ -339,7 +341,17 @@ def _null_sia(**kwargs):
**kwargs,
)


if config.SHORTCIRCUIT_SIA:

#For the case where cm is not offered by an user
if subsystem.cm.sum() == subsystem.cm.size:
subsystem.cm = subsystem.network.tpm.infer_cm()

#When subsystem is not strongly connected
if not connectivity.is_strong(subsystem.cm, subsystem.node_indices):
return _null_sia(reasons=[ShortCircuitConditions.NOT_STRONGLY_CONNECTED])

shortcircuit_reasons = _has_no_cause_or_effect(system_state)
if shortcircuit_reasons:
return _null_sia(reasons=shortcircuit_reasons)
Expand Down