pyphi.substrate_generator.build_substrate#

pyphi.substrate_generator.build_substrate(unit_functions, weights, node_labels=None, **kwargs)[source]#

Build a PyPhi substrate from a weight matrix and unit functions.

The connectivity matrix is derived from the nonzero entries of weights.

Parameters:
  • unit_functions (str or Callable or Iterable[str or Callable]) – A single unit function applied to every node, or an iterable of one function per node. Each function has signature f(element, weights, state, **kwargs) -> float returning a probability; a string names an entry in UNIT_FUNCTIONS.

  • weights (numpy.ndarray) – Square weight matrix describing the substrate’s connectivity.

  • node_labels (NodeLabels, optional) – Labels for the nodes. Defaults to A, B, C, ....

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

Returns:

Substrate – A PyPhi substrate whose TPM is built by build_tpm() and whose connectivity matrix marks the nonzero entries of weights.