pybispectra.utils.ResultsTDE#

class pybispectra.utils.ResultsTDE(data: ndarray, indices: tuple[tuple[int]], times: ndarray, freq_bands: tuple[tuple[int | float]] | None = None, name: str = 'TDE')[source]#

Class for storing time delay estimation (TDE) results.

Parameters:
datandarray, shape of [nodes, frequency bands, times]

Results to store.

indicestuple of tuple of int, length of 2

Indices of the channels for each connection of the results. Should contain two tuples of equal length for the seed and target indices, respectively.

timesndarray, shape of [times]

Timepoints in the results (in ms).

freq_bandstuple of tuple of int or float, length of 2 | None (default None)

Lower and higher frequencies (in Hz) of each frequency band used to compute the results.

namestr (default "TDE")

Name of the results being stored.

Attributes:
namestr

Name of the results.

indicestuple of tuple of int, length of 2

Indices of the channels for each connection in the results. Contains two tuples of equal length for the seed and target indices, respectively.

shapetuple of int

Shape of the results i.e. [nodes, frequency bands, times].

n_nodesstr

Number of connections in the results.

timesndarray, shape of [times]

Timepoints in the results (in ms).

freq_bandstuple of tuple of int or float, length of 2 | None

Lower and higher frequencies (in Hz) of each frequency band used to compute the results.

taundarray, shape of [nodes, frequency bands]

Return the estimated time delay for each connection (in ms).

Methods

get_results([form])

Return a copy of the results.

plot([nodes, freq_bands, times, n_rows, ...])

Plot the results.

get_results(form: str = 'raveled') ndarray | tuple[ndarray, tuple[tuple[int]]][source]#

Return a copy of the results.

Parameters:
formstr (default "raveled")

How the results should be returned: "raveled" - results have shape [nodes, …]; "compact" - results have shape [seeds, targets, ...], where ... represents the data dimensions (e.g. frequencies, times).

Returns:
resultsndarray

The results.

indicestuple of tuple of int, length of 2

Channel indices of the seeds and targets. Only returned if form is "compact".

plot(nodes: int | tuple[int] | None = None, freq_bands: int | tuple[int] | None = None, times: tuple[int | float] | None = None, n_rows: int = 1, n_cols: int = 1, major_tick_intervals: int | float = 500.0, minor_tick_intervals: int | float = 100.0, show: bool = True) tuple[list[Figure], list[ndarray]][source]#

Plot the results.

Parameters:
nodesint | tuple of int | None (default None)

Indices of connections to plot. If None, all connections are plotted.

freq_bandsint | tuple of int | None (default None)

Indices of frequency bands to plot. If None, all frequency bands are plotted.

timestuple of int or float | None (default None)

Start and end times of the results to plot. If None, plot all times.

n_rowsint (default 1)

Number of rows of subplots per figure.

n_colsint (default 1)

Number of columns of subplots per figure.

major_tick_intervalsint | float (default 500.0)

Intervals (in ms) at which the major ticks of the x- and y-axes should occur.

minor_tick_intervalsint | float (default 100.0)

Intervals (in ms) at which the minor ticks of the x- and y-axes should occur.

showbool (default True)

Whether or not to show the plotted results.

Returns:
figureslist of matplotlib Figure

Figures of the results in a list of length ceil(n_nodes / (n_rows * n_cols)).

axeslist of ndarray of matplotlib pyplot Axes

Subplot axes for the results in a list of length ceil(n_nodes / (n_rows * n_cols)) where each entry is a 1D ndarray of length (n_rows * n_cols).

Notes

n_rows and n_cols of 1 will plot the results for each connection on a new figure.

property tau: ndarray#

Return the estimated time delay for each connection (in ms).