pybispectra.utils.ResultsWaveShape#

class pybispectra.utils.ResultsWaveShape(data: ndarray, indices: tuple[int], f1s: ndarray, f2s: ndarray, name: str = 'Waveshape')[source]#

Class for storing wave shape results.

Parameters:
datandarray, shape of [nodes, low frequencies, high frequencies]

Results to store.

indicestuple of int

Indices of the channels in the results.

f1sndarray, shape of [low frequencies]

Low frequencies (in Hz) in the results.

f2sndarray, shape of [high frequencies]

High frequencies (in Hz) in the results.

namestr (default "Waveshape")

Name of the results being stored.

Attributes:
namestr

Name of the results.

indicestuple of int

Indices of the channels in the results.

shapetuple of int

Shape of the results i.e. [nodes, low frequencies, high frequencies].

n_nodesint

Number of channels in the results.

f1sndarray, shape of [low frequencies]

Low frequencies (in Hz) in the results.

f2sndarray, shape of [high frequencies]

High frequencies (in Hz) in the results.

Methods

get_results()

Return a copy of the results.

plot([nodes, f1s, f2s, n_rows, n_cols, ...])

Plot the results.

get_results() ndarray[source]#

Return a copy of the results.

Returns:
resultsndarray, shape of [nodes, low frequencies, high frequencies]

The results.

plot(nodes: int | tuple[int] | None = None, f1s: tuple[int | float] | None = None, f2s: tuple[int | float] | None = None, n_rows: int = 1, n_cols: int = 1, major_tick_intervals: int | float = 5.0, minor_tick_intervals: int | float = 1.0, plot_absolute: bool = False, mirror_cbar_range: bool = True, cbar_range_abs: tuple[float] | list[tuple[float]] | None = None, cbar_range_real: tuple[float] | list[tuple[float]] | None = None, cbar_range_imag: tuple[float] | list[tuple[float]] | None = None, cbar_range_phase: tuple[float] | list[tuple[float]] | None = None, show: bool = True) tuple[list[Figure], list[ndarray]][source]#

Plot the results.

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

Indices of results of channels to plot. If None, plot results of all channels.

f1stuple of int or float | None (default None)

Start and end low frequencies of the results to plot, respectively. If None, plot all low frequencies.

f2stuple of int or float | None (default None)

Start and end high frequencies of the results to plot, respectively. If None, plot all high frequencies.

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 5.0)

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

minor_tick_intervalsint | float (default 1.0)

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

plot_absolutebool (default False)

Whether or not to plot the absolute values of the real and imaginary parts of the results.

mirror_cbar_rangebool (default True)

Whether of not to mirror the colourbar ranges of the real and imaginary results around 0. Only applied if plot_absolute is False, and cbar_range_real and cbar_range_imag are not None.

cbar_range_abstuple of float | list of tuple of float | None (default None)

Range (in units of the data) for the colourbars of the absolute value of the results, consisting of the lower and upper limits, respectively. If None, the range is computed automatically. If a tuple of float, this range is used for all plots. If a tuple of tuple of float, the ranges are used for each individual plot.

cbar_range_realtuple of float | list of tuple of float | None (default None)

Range (in units of the data) for the colourbars of the real value of the results, consisting of the lower and upper limits, respectively. If None, the range is computed automatically. If a tuple of float, this range is used for all plots. If a tuple of tuple of float, the ranges are used for each individual plot.

cbar_range_imagtuple of float | list of tuple of float | None (default None)

Range (in units of the data) for the colourbars of the imaginary value of the results, consisting of the lower and upper limits, respectively. If None, the range is computed automatically. If a tuple of float, this range is used for all plots. If a tuple of tuple of float, the ranges are used for each individual plot.

cbar_range_phasetuple of float | list of tuple of float | None (default None)

Range (in units of the data) for the colourbars of the phase of the results, consisting of the lower and upper limits, respectively. If None, the range is computed automatically. If a tuple of float, this range is used for all plots. If a tuple of tuple of float, the ranges are used for each individual plot. Note that results are limited to the range (-pi, pi].

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 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), whose entries are themselves 1D ndarray of length 4, corresponding to the absolute, real, imaginary, and phase plots, respectively.

Notes

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