spectral_connectivity.connectivity.SidednessWarning#

exception SidednessWarning[source]#

A result is one-sided now, unlike in spectral_connectivity 2.x.

Emitted by Connectivity.power() when it is called without one_sided on two-sided coefficients. Since 3.0 it returns the one-sided density, with the interior frequency bins doubled, where 2.x returned the two-sided density, so code written for 2.x keeps running and gets values twice as large away from 0 Hz and Nyquist. Pass one_sided=True or one_sided=False to the call to silence it.

Also emitted by Connectivity.global_coherence() on two-sided coefficients: since 3.0 it returns only the non-negative frequencies, labelled by Connectivity.frequencies, where 2.x returned every bin of the two-sided transform, labelled by Connectivity.all_frequencies.

This warning is temporary. Each of the two notices appears once per Python session; warnings.simplefilter("always", SidednessWarning) shows them at every call, and a call made while it is ignored does not count as shown. Silence them with warnings.filterwarnings("ignore", category=SidednessWarning).

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