dirconn.WDTF#
- class dirconn.WDTF(window: float | None = None, step: float | None = None, segments: Any = None, order: int | str = 'bic', max_order: int = 5, n_freqs: int = 64, fmax: float | None = None, freqs: Any = None, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, standardize: bool = True)#
Windowed directed transfer function: one DTF per window or per segment.
values[i, j, f, k]is the DTF of windowk. Windows are either sliding (windowandstep) or named by the caller (segments); exactly one ofwindowandsegmentsis required. The time axis holds window or segment centres in seconds. With several trials the samples of the same window of all trials are pooled into one regression, which assumes that the non-stationarity is time-locked to the trial start.- Parameters:
window (float, optional) – Window length in seconds, a multiple of the sampling interval. Windows start at the first sample and move by
step; a window that does not fit is not used.step (float, optional) – Distance between window starts in seconds (a multiple of the sampling interval); default half a window. Only with
window.segments (sequence of (float, float), optional) –
(start, stop)pairs in seconds on the time axis of the data, both ends included, ascending and not overlapping. Every segment is fitted on its own.order (int or {"aic", "bic", "hqc", "cv"}) – Fixed VAR order, or the criterion that picks it once, on the whole recording; a window then uses that order whatever its own data would prefer.
max_order (int) – Largest candidate order; the default is 5, as for the other time-resolved methods.
n_freqs – Frequency axis, as for
DTF; the default is 64 points from 0 to the Nyquist frequency.fmax – Frequency axis, as for
DTF; the default is 64 points from 0 to the Nyquist frequency.freqs – Frequency axis, as for
DTF; the default is 64 points from 0 to the Nyquist frequency.ridge – As for
dirconn.fit_var()(demeanremoves the mean of each window) anddirconn.select_order().demean – As for
dirconn.fit_var()(demeanremoves the mean of each window) anddirconn.select_order().n_folds – As for
dirconn.fit_var()(demeanremoves the mean of each window) anddirconn.select_order().standardize (bool) – Divide every channel by its standard deviation over the whole recording first (one scale for all windows), because the result depends on the relative scale of the channels.
samples (A window fit that fails (too few)
are (collinear channels) raises; diagnostics warn and)
recorded (a window with fewer than 50 regression rows per coefficient of an equation, and a)
unstable. (share of windows above 5 % whose model is)
- __init__(window: float | None = None, step: float | None = None, segments: Any = None, order: int | str = 'bic', max_order: int = 5, n_freqs: int = 64, fmax: float | None = None, freqs: Any = None, ridge: float = 0.0, demean: bool = True, n_folds: int = 5, standardize: bool = True) None#
Methods
__init__([window, step, segments, order, ...])fit(data)Estimate directed connectivity.
get_params()Return the constructor parameters as a dictionary.
Attributes
demeanfmaxfreqsinfomax_ordern_foldsn_freqsorderridgesegmentsstandardizestepwindow