pybispectra.general.Threenorm#

class pybispectra.general.Threenorm(data: ndarray, freqs: ndarray, sampling_freq: int | float, verbose: bool = True)[source]#

Class for computing the threenorm.

Parameters:
datandarray, shape of [epochs, channels, frequencies]

Fourier coefficients.

freqsndarray, shape of [frequencies]

Frequencies (in Hz) in data. Frequencies are expected to be evenly spaced.

sampling_freqint | float

Sampling frequency (in Hz) of the data from which data was derived.

verbosebool (default True)

Whether or not to report the progress of the processing.

Attributes:
resultsResultsGeneral

Return the results.

datandarray of float, shape of [epochs, channels, frequencies]

Fourier coefficients.

freqsndarray of float, shape of [frequencies]

Frequencies (in Hz) in data.

sampling_freqint | float

Sampling frequency (in Hz) of the data from which data was derived.

verbosebool

Whether or not to report the progress of the processing.

Methods

compute([indices, f1s, f2s, n_jobs])

Compute the threenorm, averaged over epochs.

copy()

Return a copy of the object.

compute(indices: tuple[tuple[int]] | None = None, f1s: tuple[int | float] | None = None, f2s: tuple[int | float] | None = None, n_jobs: int = 1) None[source]#

Compute the threenorm, averaged over epochs.

Parameters:
indicestuple of tuple of int, length of 3 | None (default None)

Indices of the channels \(k\), \(m\), and \(n\), respectively, to compute the threenorm for. If None, the threenorm for all channel combinations is computed.

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

Start and end lower frequencies to compute the threenorm for, respectively. If None, all frequencies are used.

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

Start and end higher frequencies to compute the threenorm for, respectively. If None, all frequencies are used.

n_jobsint (default 1)

The number of jobs to run in parallel. If -1, all available CPUs are used.

Notes

The threenorm, \(\textbf{N}\), [1] has the general form

\(\textbf{N}_{kmn}(f_1,f_2)=(<|\textbf{k}(f_1)|^3><|\textbf{m} (f_2)|^3><|\textbf{n}(f_2+f_1)|^3>)^{\frac{1}{3}}\) ,

where \(kmn\) is a combination of signals with Fourier coefficients \(\textbf{k}\), \(\textbf{m}\), and \(\textbf{n}\), respectively; \(f_1\) and \(f_2\) correspond to a lower and higher frequency, respectively; and \(<>\) represents the average value over epochs.

The threenorm is computed between all values of f1s and f2s. If any value of f1s is higher than f2s, a numpy.nan value is returned.

References

copy()[source]#

Return a copy of the object.

property results: ResultsGeneral#

Return the results.

Returns:
resultsResultsGeneral

The computed threenorm.