API reference#
All names in this page are importable from dirconn unless a module is given.
Data structures#
Multichannel time series with explicit segmentation. |
|
Description of one channel (or node) of a time series. |
|
Directed connectivity with fixed dimensions |
|
Everything needed to understand and reproduce a result. |
|
An ordered set of assumption checks with unique names. |
|
Outcome of one assumption diagnostic. |
Simulation#
A directed network of cortical regions and direct (invasive) nodes. |
|
A directed coupling from |
|
Return a cortical node for a Desikan-Killiany label such as |
|
Return a direct node: an invasive channel used as recorded, for example |
|
Own dynamics of a network node. |
|
Simulate sensor data generated by a directed network. |
|
Output of |
|
Three channels where X drives Y through a chosen function and Z is independent. |
Estimators#
Base class for all directed-connectivity estimators. |
|
Structured description of a method, enforced at run time. |
|
Granger causality |
|
Directed transfer function (Kaminski and Blinowska), a predictive spectral measure. |
|
Partial directed coherence (Baccala and Sameshima), a predictive spectral measure. |
|
Generalised partial directed coherence (Baccala et al. 2007). |
|
Renormalised partial directed coherence (Schelter et al. 2009), a predictive measure. |
|
Spectral Granger causality from the state-space form of the VAR (Barnett and Seth 2015). |
|
Adaptive directed transfer function: the DTF at every time point. |
|
Time-varying partial directed coherence: the PDC at every time point. |
|
Windowed directed transfer function: one DTF per window or per segment. |
|
Time-reversed Granger causality, difference-based (Haufe et al. 2013; Winkler et al. 2016). |
|
Imaginary part of coherency (Nolte et al. 2004), per frequency. |
|
Phase slope index (Nolte et al. 2008) in one or more frequency bands. |
|
Pairwise spectral Granger causality from multitaper spectra, without a fitted model. |
|
PCMCI with the partial-correlation (ParCorr) test, lagged links only. |
|
Transfer entropy with the KSG estimator: multivariate (default), pairwise or conditional. |
|
Fit a VAR model by pooled least squares. |
|
Choose the VAR order with an information criterion or by cross-validation. |
|
A fitted VAR model. |
|
Result of |
Every estimator class has a lower-case shorthand that builds the estimator and fits it in one call:
- dirconn.gc(data: TimeSeries, **params: Any) Connectivity#
Granger causality of
data; shorthand forGC(**params).fit(data).See
GCfor the parameters.
- dirconn.dtf(data: TimeSeries, **params: Any) Connectivity#
Directed transfer function of
data; shorthand forDTF(**params).fit(data).
- dirconn.pdc(data: TimeSeries, **params: Any) Connectivity#
Partial directed coherence of
data; shorthand forPDC(**params).fit(data).
- dirconn.gpdc(data: TimeSeries, **params: Any) Connectivity#
Generalised PDC of
data; shorthand forGPDC(**params).fit(data).
- dirconn.rpdc(data: TimeSeries, **params: Any) Connectivity#
Renormalised PDC of
data; shorthand forRPDC(**params).fit(data).
- dirconn.ssgc(data: TimeSeries, **params: Any) Connectivity#
State-space spectral GC of
data; shorthand forSSGC(**params).fit(data).
- dirconn.adtf(data: TimeSeries, **params: Any) Connectivity#
Adaptive DTF of
data; shorthand forADTF(**params).fit(data).
- dirconn.tpdc(data: TimeSeries, **params: Any) Connectivity#
Time-varying PDC of
data; shorthand forTPDC(**params).fit(data).
- dirconn.wdtf(data: TimeSeries, **params: Any) Connectivity#
Windowed DTF of
data; shorthand forWDTF(**params).fit(data).
- dirconn.trgc(data: TimeSeries, **params: Any) Connectivity#
Time-reversed Granger causality of
data; shorthand forTRGC(**params).fit(data).
- dirconn.imcoh(data: TimeSeries, **params: Any) Connectivity#
Imaginary coherence of
data; shorthand forImCoh(**params).fit(data).
- dirconn.psi(data: TimeSeries, **params: Any) Connectivity#
Phase slope index of
data; shorthand forPSI(**params).fit(data).
- dirconn.mtgc(data: TimeSeries, **params: Any) Connectivity#
Multitaper Granger causality of
data; shorthand forMTGC(**params).fit(data).
- dirconn.pcmci(data: TimeSeries, **params: Any) Connectivity#
PCMCI of
data; shorthand forPCMCI(**params).fit(data).
- dirconn.te(data: TimeSeries, **params: Any) Connectivity#
Transfer entropy of
data; shorthand forTE(**params).fit(data).
The state-space form behind GC(method="state_space") and SSGC, for VAR
coefficients known in advance (for example the truth of a simulation):
Write a VAR model in innovations form. |
|
Return the innovations form of a subset of the observed channels of |
|
Time-domain Granger causality of a VAR model from its state-space form. |
|
Spectral (Geweke) Granger causality of a VAR model from its state-space form. |
|
A state-space model in innovations form. |
A heuristic that compares any estimator with itself on time-reversed data (not an estimator, not a test):
Compare an estimator's result on the data with its result on the time-reversed data. |
|
Result of |
Statistics#
Test the significance of an estimator's result. |
|
Test an estimator's result against surrogates of the data. |
|
Outcome of a surrogate test, with the premise it rests on. |
|
Test Granger causality with the F distribution of nested least-squares models. |
|
F-test p-values of a Granger result, with the premise they rest on. |
|
Test PDC at every frequency with its asymptotic distribution (Schelter et al. 2006). |
|
Test rPDC at every frequency with its asymptotic distribution (Schelter et al. 2009). |
|
Per-frequency p-values and thresholds of PDC or rPDC, with the premise they rest on. |
|
Fit PCMCI and return its own MCI p-values as a test result. |
|
PCMCI's own MCI p-values, as a test result that the correction code can use. |
|
Bootstrap an estimator's result. |
|
Percentile bands of the magnitude of a connectivity result. |
|
Test whether connectivity differs between two conditions or two segments of the same trials. |
|
Outcome of a condition contrast, with the premise it rests on. |
|
Adjust p-values so that |
|
Express the connectivity of |
Figures#
Connectivity.plot(kind=...) draws the result alone (matrices, spectra, panels and small graphs;
see dirconn.Connectivity.plot()). The functions of dirconn.viz need more than a result:
several results side by side, a grouping of the nodes, or the cortical surface.
Draw several results side by side, one panel each, on one shared colour scale. |
|
Draw the connectivity between groups of nodes as a directed chord diagram (pyCirclize). |
|
Colour the cortical surface by |
|
Summarise a result between groups of nodes. |
|
Return the network of every Desikan-Killiany region, computed from the vertex overlap. |
|
Return |
|
Return |
|
Assign every region to the network that holds most of its vertices. |
Files and data#
Read one recording from a BIDS dataset as a |
|
Write region-level time series as a BIDS-Derivatives dataset (dirconn convention v0). |
|
Read a simulation written by |
|
Write a simulation as a raw BIDS dataset plus a derivatives dataset. |
|
A simulation read back from BIDS by |
|
Return the root of the MNE |
Modules the tutorials use#
Load a scenario from a YAML file or by the name of a shipped one. |
|
Return the names of the shipped scenarios, sorted. |
|
Simulate sensor data of a network through a realistic head model. |
|
Load the head model of the MNE |
|
Return the time courses of regions estimated from sensor data. |
|
Measure the leakage between regions of a head model for an inverse method and region mode. |
|
Return the distances in mm between the centre sources of all regions. |
Modules#
The package is split into eight subpackages of dirconn (see
0002 — Package layout: eight subpackages and a fixed dependency direction). The old top-level module paths (such as dirconn.granger
or dirconn.plotting) are deprecated shims that warn on import and are removed in dirconn 0.4.0.
The data model: time series, channels, networks, results, provenance, bands, RNG, exceptions. |
|
Reading and writing data. |
|
Connectivity estimators: autoregressive, spectral, information-theoretic, causal discovery. |
|
Statistical inference: surrogates, bootstrap, analytic tests, contrasts, correction. |
|
Diagnostics: model-order stability, leakage and region handling. |
|
Synthetic data: network simulation, scenario library, head model, inverse and empty-room. |
|
Validation: protocols, sweeps, benchmark, metrics, studies and the method-validation runner. |
|
Figures of connectivity results. |