Skip to content

Commit

Permalink
subsystem: Comment on missing TPM ufunc implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wmayner committed Dec 6, 2022
1 parent 849f8e7 commit 319305c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyphi/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,11 @@ def _single_node_effect_repertoire(
# TODO(4.0) remove reference to TPM
# Marginalize-out the inputs that aren't in the mechanism.
nonmechanism_inputs = purview_node.inputs - set(condition)
tpm = tpm.marginalize_out(nonmechanism_inputs).tpm
tpm = tpm.marginalize_out(nonmechanism_inputs)
# Reshape so that the distribution is over next states.
return tpm.reshape(
repertoire_shape(self.network.node_indices, (purview_node_index,))
)
).tpm

@cache.method("_repertoire_cache", Direction.EFFECT)
def _effect_repertoire(
Expand All @@ -397,6 +397,9 @@ def _effect_repertoire(
joint = np.ones(repertoire_shape(self.network.node_indices, purview))
# The effect repertoire is the product of the effect repertoires of the
# individual nodes.
# TODO(tpm) Currently the single-node repertoires need to be bare numpy
# arrays here because reducing with np.multiply throws an error; this
# should be fixed
return joint * functools.reduce(
np.multiply,
[self._single_node_effect_repertoire(condition, p) for p in purview],
Expand Down

0 comments on commit 319305c

Please sign in to comment.