pyphi.substrate_generator.mechanism_combinations.composite#

pyphi.substrate_generator.mechanism_combinations.composite(sub_specs, combination='selective', **combination_kwargs)[source]#

Build a composite unit function from sub-mechanism specs.

Parameters:
  • sub_specs (Iterable[Mapping]) – An iterable of dicts, each {"mechanism": name | callable, "inputs": tuple[int] | None, "params": dict}. Each sub-mechanism is evaluated at the full from-state and reads its own inputs.

  • combination (str or Callable, optional) – A name in MECHANISM_COMBINATIONS or a callable mapping a sequence of probabilities to a single probability. Defaults to "selective".

  • **combination_kwargs – Passed to the combination strategy (e.g. steepness / offset for first_necessary).

Returns:

Callable – A unit function f(element, weights, state, **kwargs) -> float whose value is the combined probability of its sub-mechanisms.

Raises:

TypeError – If a sub-spec has a key other than mechanism, inputs and params, or params or combination_kwargs names an option the mechanism or combination does not take. A callable that accepts any keyword is not checked.