pyphi.substrate_generator.unit_functions.boolean_function#
- pyphi.substrate_generator.unit_functions.boolean_function(element, weights, state, on_inputs=(), **kwargs)[source]#
An arbitrary boolean function of the element’s inputs.
The element is ON exactly when the tuple of its (weighted) input states is one of
on_inputs. All weights must be 0 or 1.- Parameters:
element (int) – Index of the element whose output is being computed.
weights (numpy.ndarray) – The weight matrix (entries restricted to 0 or 1).
state (numpy.ndarray) – The state of the substrate.
on_inputs (tuple of tuple, optional) – The input patterns for which the element is ON. All patterns must have the same length, which must equal the number of nonzero input weights.
- Returns:
bool – The output of the element.
- Raises:
NotImplementedError – If any weight is neither 0 nor 1.
ValueError – If the
on_inputspatterns differ in length, or their length does not match the number of nonzero input weights.