pyphi.substrate_generator.build_tpm#

pyphi.substrate_generator.build_tpm(unit_functions, weights, **kwargs)[source]#

Build a binary state-by-node TPM from unit functions and a weight matrix.

Each unit function is evaluated at every one of the 2**N substrate states, returning the probability that its node is ON at the next step.

Parameters:
  • unit_functions (str or Callable or Iterable[str or Callable]) – A single unit function (a name in UNIT_FUNCTIONS or a callable with signature f(element, weights, state, **kwargs) -> float) applied to every node, or an iterable of N such functions, one per node.

  • weights (numpy.ndarray) – Square N × N connection weight matrix; weights[i, j] couples input i to node j.

  • **kwargs – Passed through to every unit function. Each keyword must be a named parameter of at least one of the unit functions.

Returns:

numpy.ndarray – A state-by-node TPM of shape (2,) * N + (N,); entry tpm[state + (j,)] is the probability that node j is ON given state.

Raises:
  • ValueError – If weights is not square, or if an iterable of unit functions does not have one entry per node.

  • TypeError – If a keyword argument is not a parameter of any unit function.