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**Nsubstrate 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_FUNCTIONSor a callable with signaturef(element, weights, state, **kwargs) -> float) applied to every node, or an iterable ofNsuch functions, one per node.weights (numpy.ndarray) – Square
N × Nconnection weight matrix;weights[i, j]couples inputito nodej.**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,); entrytpm[state + (j,)]is the probability that nodejis ON givenstate.- Raises:
ValueError – If
weightsis 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.