Skip to content

Commit

Permalink
Remove old logic; use 4.0 as IIT_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Dec 9, 2022
1 parent 397a6c4 commit ba0533c
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 53 deletions.
2 changes: 1 addition & 1 deletion pyphi/big_phi.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ def sia(
desc="Generating nonconflicting phi-structures",
)

if config.IIT_VERSION == "maximal-state-first":
if config.IIT_VERSION == 4.0:

maximal_compositional_state = find_maximal_compositional_state(
phi_structures,
Expand Down
2 changes: 1 addition & 1 deletion pyphi/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class PyphiConfig(Config):
"""``pyphi.config`` is an instance of this class."""

IIT_VERSION = Option(
"maximal-state-first",
4.0,
doc="""
The version of the theory to use.""",
)
Expand Down
50 changes: 0 additions & 50 deletions pyphi/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,46 +913,6 @@ def phi(self, mechanism, purview, **kwargs):
# Maximal state methods
# =========================================================================

def _specified_states_to_specified_index(self, states, purview):
full_index = [np.zeros(len(states), dtype=int) for i in self.node_indices]
specified_indices = states.transpose()
for i, index in zip(purview, specified_indices):
full_index[i] = index
return tuple(full_index)

def find_maximally_irreducible_state(self, direction, mechanism, purview):
required_repertoire_distances = [
"IIT_4.0_SMALL_PHI",
"IIT_4.0_SMALL_PHI_NO_ABSOLUTE_VALUE",
]
if config.REPERTOIRE_DISTANCE not in required_repertoire_distances:
raise ValueError(
f'REPERTOIRE_DISTANCE must be set to one of "{required_repertoire_distances}"'
)

state_to_mip = {
state: self.find_mip(direction, mechanism, purview, state=state)
for state in utils.all_states(len(purview))
}
_, max_mip = max(state_to_mip.items())

# Record ties
tied_states, tied_mips = zip(
*(
(state, mip)
for state, mip in state_to_mip.items()
if mip.phi == max_mip.phi
)
)
tied_states = np.array(tied_states)
tied_index = self._specified_states_to_specified_index(tied_states, purview)
for mip in tied_mips:
# TODO change definition of specified state
mip._specified_state = tied_states
mip._specified_index = tied_index

return max_mip

def intrinsic_information(
self,
direction: Direction,
Expand Down Expand Up @@ -1080,13 +1040,6 @@ def find_mice(self, direction, mechanism, purviews=False, **kwargs):
MaximallyIrreducibleCauseOrEffect: The |MIC| or |MIE|.
"""

def _find_maximally_irreducible_state(
purview, subsystem=None, direction=None, mechanism=None
):
return subsystem.find_maximally_irreducible_state(
direction, mechanism, purview
)

def _find_tied_mips(purview, subsystem=None, direction=None, mechanism=None):
# TODO(4.0) refactor
# TODO(ties) refactor to use full 'Specification' object
Expand Down Expand Up @@ -1146,9 +1099,6 @@ def CurriedMapReduce(map_func):
max_mice = null_mice
else:
if config.IIT_VERSION == 4:
# TODO(4.0)
map_func = _find_maximally_irreducible_state
elif config.IIT_VERSION == "maximal-state-first":
map_func = _find_tied_mips
else:
map_func = _find_mip
Expand Down
2 changes: 1 addition & 1 deletion pyphi_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DISTINCTION_SUM_PHI_UPPER_BOUND: DISTINCT_AND_CONGRUENT_PURVIEWS
# The type of horizontal system partition scheme to use.
HORIZONTAL_PARTITION_CODE: "1210"
# The version of the theory to use.
IIT_VERSION: maximal-state-first
IIT_VERSION: 4.0
# The method of combining cause and effect integration values.
INTEGRATION_VALUE: MIN
# The path for the log file.
Expand Down

0 comments on commit ba0533c

Please sign in to comment.