spectral_connectivity.connectivity.DirectedOrientationWarning#

exception DirectedOrientationWarning[source]#

A directed measure’s orientation differs from spectral_connectivity 2.x.

Emitted by the Connectivity methods that returned [..., target, source] in 2.x and now return [..., source, target], and by multitaper_connectivity() and connectivity_to_xarray() when they compute pairwise or subset spectral Granger prediction, whose sel(source=a, target=b) was b -> a in 2.x (the 2.x wrapper rejected the transfer-function measures). Code written for 2.x keeps running but reads the opposite direction. This warning is temporary. It appears once per Python session for each measure: once for calls through the wrappers (about sel(source, target)) and once for calls to the Connectivity method (about the array’s axes). warnings.simplefilter("always", DirectedOrientationWarning) shows it at every call; a call made while it is ignored does not count as shown. Silence it, without hiding other warnings, with warnings.filterwarnings("ignore", category=DirectedOrientationWarning).

By design, a bare warnings.catch_warnings(record=True) with no filter records nothing once the notice has been shown; add warnings.simplefilter("always", DirectedOrientationWarning) inside it (pytest.warns does the equivalent).