pyphi.timescale.run_cm#

pyphi.timescale.run_cm(cm, time_scale)[source]#

Iterate a connectivity matrix the specified number of steps.

Raising the connectivity matrix to the time_scale power counts directed paths of that length between nodes; every nonzero entry is then clipped back to 1, so the result marks which node pairs are connected by a path of time_scale steps.

Parameters:
  • cm (np.ndarray) – A connectivity matrix.

  • time_scale (int) – The number of steps to run.

Returns:

np.ndarray – The connectivity matrix at the new timescale.

Notes

np.linalg.matrix_power returns its input unchanged (not a copy) when time_scale == 1, so a copy is made up front: without it, clipping values back to 1 would mutate the caller’s matrix in place and raise on a read-only one.