nnmt.lif.exp._match_eigenvalues_across_frequencies

nnmt.lif.exp._match_eigenvalues_across_frequencies(eigenvalues, margin=1e-05)[source]

Resorts the eigenvalues of the effective connectivity matrix.

The eigenvalues of the effective connectivity are calculated once per frequency. To link the eigenvalues/eigenmodes across frequencies this utility function calculates the distance between subsequent (in frequency) eigenvalues and matches them if the distance is smaller equal the margin.

This is done to obtain eigenvalue trajectories as in Fig. 4 of Bos et al. [2016].

If just two eigenvalue have a larger distance than the margin, they can be immediately swapped. If more eigenvalues have a larger distance, the resorting is more complicated (multi-swaps).

The default value for the margin is chosen from experience. The smaller the frequency step in in the analysis frequencies, the smaller the margin needs to be chosen. It is recommended to cross-check the resorting by plotting the eigenvalues across frequencies in the complex plane.

Parameters:
eigenvaluesnp.ndarray

Eigenvalues of the effective connectivity matrix Shape: (num analysis freqs, num populations)

marginfloat

Maximal allowed distance between the eigenvalues of the effective connectivity matrix at two subsequent frequencies.

Returns:
np.ndarray

Resorted eigenvalues.

np.ndarray

Mapping from old to new indices (e.g. for resorting the eigenmodes). Shape: (num analysis freqs, num populations)