MCPcopy
hub / github.com/mne-tools/mne-python / CrossSpectralDensity

Class CrossSpectralDensity

mne/time_frequency/csd.py:76–549  ·  view source on GitHub ↗

Cross-spectral density. Given a list of time series, the CSD matrix denotes for each pair of time series, the cross-spectral density. This matrix is symmetric and internally stored as a vector. This object can store multiple CSD matrices: one for each frequency. Use ``.get_data

Source from the content-addressed store, hash-verified

74
75
76class CrossSpectralDensity:
77 """Cross-spectral density.
78
79 Given a list of time series, the CSD matrix denotes for each pair of time
80 series, the cross-spectral density. This matrix is symmetric and internally
81 stored as a vector.
82
83 This object can store multiple CSD matrices: one for each frequency.
84 Use ``.get_data(freq)`` to obtain an CSD matrix as an ndarray.
85
86 Parameters
87 ----------
88 data : ndarray, shape ((n_channels**2 + n_channels) // 2, n_frequencies)
89 For each frequency, the cross-spectral density matrix in vector format.
90 ch_names : list of str
91 List of string names for each channel.
92 frequencies : float | list of float | list of list of float
93 Frequency or frequencies for which the CSD matrix was calculated. When
94 averaging across frequencies (see the :func:`CrossSpectralDensity.mean`
95 function), this will be a list of lists that contains for each
96 frequency bin, the frequencies that were averaged. Frequencies should
97 always be sorted.
98 n_fft : int
99 The number of FFT points or samples that have been used in the
100 computation of this CSD.
101 tmin : float | None
102 Start of the time window for which CSD was calculated in seconds. Can
103 be ``None`` (the default) to indicate no timing information is
104 available.
105 tmax : float | None
106 End of the time window for which CSD was calculated in seconds. Can be
107 ``None`` (the default) to indicate no timing information is available.
108 projs : list of Projection | None
109 List of projectors to apply to timeseries data when using this CSD
110 object to compute a DICS beamformer. Defaults to ``None``, which means
111 no projectors will be applied.
112
113 See Also
114 --------
115 csd_fourier
116 csd_multitaper
117 csd_morlet
118 csd_array_fourier
119 csd_array_multitaper
120 csd_array_morlet
121 """
122
123 def __init__(
124 self, data, ch_names, frequencies, n_fft, tmin=None, tmax=None, projs=None
125 ):
126 data = np.asarray(data)
127 if data.ndim == 1:
128 data = data[:, np.newaxis]
129 elif data.ndim > 2:
130 raise ValueError("`data` should be either a 1D or 2D array.")
131 self._data = data
132
133 if len(ch_names) != _n_dims_from_triu(len(data)):

Callers 11

_make_rand_csdFunction · 0.90
_cov_as_csdFunction · 0.90
test_plot_csdFunction · 0.90
_make_csdFunction · 0.90
test_csdFunction · 0.90
read_beamformerFunction · 0.85
sumMethod · 0.85
__getitem__Method · 0.85
read_csdFunction · 0.85
_execute_csd_functionFunction · 0.85
csd_tfrFunction · 0.85

Calls

no outgoing calls

Tested by 5

_make_rand_csdFunction · 0.72
_cov_as_csdFunction · 0.72
test_plot_csdFunction · 0.72
_make_csdFunction · 0.72
test_csdFunction · 0.72