pybispectra.utils.ResultsGeneral#
- class pybispectra.utils.ResultsGeneral(data: ndarray, indices: tuple[tuple[int]], f1s: ndarray, f2s: ndarray, name: str = 'General')[source]#
Class for storing general bispectrum and threenorm results.
- Parameters:
- data
ndarray
, shape of [nodes, low frequencies, high frequencies] Results to store.
- indices
tuple
oftuple
ofint
, length of 3 Indices of the channels for each combination of the results. Should contain three tuples of equal length for the k, m, and n channel indices, respectively.
- f1s
ndarray
, shape of [low frequencies] Low frequencies (in Hz) in the results.
- f2s
ndarray
, shape of [high frequencies] High frequencies (in Hz) in the results.
- name
str
(default"General"
) Name of the results being stored.
- data
- Attributes:
- name
str
Name of the results.
- indices
tuple
oftuple
ofint
, 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.
- shape
tuple
ofint
Shape of the results i.e. [nodes, low frequencies, high frequencies].
- n_nodes
int
Number of connections in the the results.
- f1s
ndarray
, shape of [low frequencies] Low frequencies (in Hz) in the results.
- f2s
ndarray
, shape of [high frequencies] High frequencies (in Hz) in the results.
- name
Methods
get_results
([form])Return a copy of the results.
plot
([nodes, f1s, f2s, n_rows, n_cols, ...])Plot the results.
- get_results(form: str = 'raveled') ndarray | tuple[ndarray, tuple[tuple[int]]] [source]#
Return a copy of the results.
- Parameters:
- form
str
(default"raveled"
) How the results should be returned:
"raveled"
- results have shape [nodes, …];"compact"
- results have shape[k, m, n, ...]
, where...
represents the data dimensions (e.g. frequencies, times).
- form
- Returns:
- 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:
- nodes
int
|tuple
ofint
|None
(defaultNone
) Indices of results of channels to plot. If
None
, plot results of all channels.- f1s
tuple
ofint
orfloat
|None
(defaultNone
) Start and end low frequencies of the results to plot, respectively. If
None
, plot all low frequencies.- f2s
tuple
ofint
orfloat
|None
(defaultNone
) Start and end high frequencies of the results to plot, respectively. If
None
, plot all high frequencies.- n_rows
int
(default1
) Number of rows of subplots per figure.
- n_cols
int
(default1
) Number of columns of subplots per figure.
- major_tick_intervals
int
|float
(default5.0
) Intervals (in Hz) at which the major ticks of the x- and y-axes should occur.
- minor_tick_intervals
int
|float
(default1.0
) Intervals (in Hz) at which the minor ticks of the x- and y-axes should occur.
- plot_absolute
bool
(defaultFalse
) Whether or not to plot the absolute values of the real and imaginary parts of the results.
- mirror_cbar_range
bool
(defaultTrue
) Whether of not to mirror the colourbar ranges of the real and imaginary results around 0. Only applied if
plot_absolute
isFalse
, andcbar_range_real
andcbar_range_imag
are notNone
.- cbar_range_abs
tuple
offloat
|list
oftuple
offloat
|None
(defaultNone
) 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_real
tuple
offloat
|list
oftuple
offloat
|None
(defaultNone
) 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_imag
tuple
offloat
|list
oftuple
offloat
|None
(defaultNone
) 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_phase
tuple
offloat
|list
oftuple
offloat
|None
(defaultNone
) 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].- show
bool
(defaultTrue
) Whether or not to show the plotted results.
- nodes
- Returns:
- figures
list
of matplotlibFigure
Figures of the results in a list of length
ceil(n_nodes / (n_rows * n_cols))
.- axes
list
ofndarray
ofndarray
of matplotlib pyplotAxes
Subplot axes for the results in a list of length
ceil(n_nodes / (n_rows * n_cols))
where each entry is a 1Dndarray
of length(n_rows * n_cols)
, whose entries are themselves 1Dndarray
of length 4, corresponding to the absolute, real, imaginary, and phase plots, respectively.
- figures
Notes
n_rows
andn_cols
of1
will plot the results for each node on a new figure.