pyeeg.simulate.NeuralMassNetwork

class pyeeg.simulate.NeuralMassNetwork(N, W, delay=0, node_dynamics=None, dt=0.001, seed=42, node_kwargs=None, coupling='linear')

Abstract base class for a network of coupled neural-mass nodes.

A network is made of N nodes, each instantiated from a node-dynamics class (e.g. Phasor, HopfOscillator, WilsonCowan), coupled through a connectivity matrix W and a coupling function. Each step, the scalar readout of every node is combined through the coupling function into an input that is fed back to the nodes.

Parameters:
  • N (int) – The number of nodes in the network.

  • W (array_like) – The connectivity matrix. Shape (N, N). Entry W[i, j] is the coupling strength from node j to node i.

  • delay (float) – The delay between nodes in seconds. Stored for compatibility; not used by the default coupling scheme.

  • node_dynamics (class, optional) – The class of the node dynamics used to instantiate the N nodes. Must accept dt and seed keyword arguments. If None, no nodes are instantiated and step() will raise a RuntimeError.

  • dt (float) – The integration time step in seconds.

  • seed (int) – The random seed used to initialise the network’s random number generator and the per-node seeds.

  • node_kwargs (dict, optional) – Extra keyword arguments passed to the node_dynamics constructor. Cannot override dt or seed.

  • coupling (str or callable) – Either a supported coupling name ("linear", "diffusive", "kuramoto") or a callable with signature f(readouts, connectivity, phases=None) returning the coupling input to each node. Default is "linear".

Raises:

ValueError – If W does not have shape (N, N), or if node_kwargs attempts to override dt or seed.

Methods

NeuralMassNetwork.reset()

Reset the network to its initial state.

NeuralMassNetwork.simulate()

Simulate the network and return its outputs.

NeuralMassNetwork.step()

Advance the network by one integration step.