dirconn.Network#

class dirconn.Network(nodes: tuple[ChannelMeta, ...], edges: tuple[Edge, ...] = (), name: str = '')#

A directed network of cortical regions and direct (invasive) nodes.

Parameters:
  • nodes (sequence of ChannelMeta) – At least two nodes with unique names and node_kind "cortical" or "direct"; see dk_node() and direct_node().

  • edges (sequence of Edge) – Directed couplings between the nodes. The same pair may appear several times with different bands; exact duplicates are rejected.

  • name (str) – Optional label, for example the scenario name.

__init__(nodes: tuple[ChannelMeta, ...], edges: tuple[Edge, ...] = (), name: str = '') → None#

Methods

__init__(nodes[, edges, name])

adjacency()

Return a boolean matrix; [i, j] is True when any edge goes from node i to node j.

from_dict(data)

Build a network from a dictionary, for example loaded from YAML.

from_yaml(path)

Load a network from a YAML file; see from_dict() for the format.

to_dict()

Return a JSON/YAML-compatible dictionary that from_dict() restores exactly.

to_yaml(path)

Write the network to a YAML file.

truth([freqs, times])

Return the ground truth as a binary Connectivity.

Attributes

edges

has_intervals

Whether any edge acts only in some time intervals (see Edge.active).

n_nodes

Number of nodes.

name

names

Node names in order.

nodes