pyphi.substrate_generator.create_substrate#
- pyphi.substrate_generator.create_substrate(node_params, labels=None)[source]#
Build a
Substratefrom per-node specifications.Each node names a
mechanism(a key inMECHANISMS), itsinputs, and aparamsdict. The resulting substrate TPM matches thedynamic_tpmof thesubstrate_modelerlibrary, in which the present state equals the past state.- Parameters:
node_params (Mapping[int, Mapping] or Sequence[Mapping]) –
Either an integer-keyed mapping (nodes taken in sorted key order) or an ordered iterable of node specs. Each spec is a dict with keys:
"mechanism"(str): mechanism name, or"composite"(list of sub-specs) plus optional"mechanism_combination"(str, default"selective") and"combination_params"(dict);"inputs"(tuple[int]): the unit’s input indices;"params"(dict): mechanism parameters (e.g.input_weights,determinism,threshold,weight_scale_mapping).
labels (Sequence[str] or NodeLabels, optional) – Node labels. Defaults to
A, B, C, ....
- Returns:
Substrate – A PyPhi substrate.
- Raises:
TypeError – If
node_paramsis a mapping whose keys are not all integers.- Return type:
Notes
The connectivity matrix is assembled in two passes: every input edge is first marked with weight 1, then the real edge weights of weighted mechanisms (
WEIGHTED) overwrite those markers. State-dependent mechanisms (STATE_DEPENDENT) read the unit’s own state, so a self-loop is inserted into the connectivity matrix when the spec does not already include one.