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(freq)
to obtain an CSD matrix as an ndarray.
ndarray
, shape ((n_channels**2 + n_channels) // 2, n_frequencies)For each frequency, the cross-spectral density matrix in vector format.
list
of str
List of string names for each channel.
float
| list
of float
| list
of list
of float
Frequency or frequencies for which the CSD matrix was calculated. When
averaging across frequencies (see the CrossSpectralDensity.mean()
function), this will be a list of lists that contains for each
frequency bin, the frequencies that were averaged. Frequencies should
always be sorted.
int
The number of FFT points or samples that have been used in the computation of this CSD.
float
| None
Start of the time window for which CSD was calculated in seconds. Can
be None
(the default) to indicate no timing information is
available.
float
| None
End of the time window for which CSD was calculated in seconds. Can be
None
(the default) to indicate no timing information is available.
list
of Projection
| None
List of projectors to apply to timeseries data when using this CSD
object to compute a DICS beamformer. Defaults to None
, which means
no projectors will be applied.
See also
n_channels
Number of time series defined in this CSD object.
Methods
|
Subselect frequencies. |
|
Return number of frequencies. |
|
Return copy of the CrossSpectralDensity object. |
|
Get the CSD matrix for a given frequency as NumPy array. |
|
Calculate the mean CSD in the given frequency range(s). |
|
Pick channels from this cross-spectral density matrix. |
|
Get a CrossSpectralDensity object with only the given frequency. |
|
Plot CSD matrices. |
|
Save the CSD to an HDF5 file. |
|
Calculate the sum CSD in the given frequency range(s). |
Subselect frequencies.
ndarray
Array of frequency indices to subselect.
CrossSpectralDensity
A new CSD instance with the subset of frequencies.
Return copy of the CrossSpectralDensity object.
CrossSpectralDensity
A copy of the object.
Get the CSD matrix for a given frequency as NumPy array.
If there is only one matrix defined in the CSD object, calling this
method without any parameters will return it. If multiple matrices are
defined, use either the frequency
or index
parameter to select
one.
float
| None
Return the CSD matrix for a specific frequency. Only available when no averaging across frequencies has been done.
int
| None
Return the CSD matrix for the frequency or frequency-bin with the given index.
Whether to return the data as a numpy array (False
, the default),
or pack it in a mne.Covariance
object (True
).
New in version 0.20.
ndarray
, shape (n_channels, n_channels) | instance of Covariance
The CSD matrix corresponding to the requested frequency.
See also
Calculate the mean CSD in the given frequency range(s).
float
| list
of float
| None
Lower bound of the frequency range in Hertz. Defaults to the lowest frequency available. When a list of frequencies is given, these are used as the lower bounds (inclusive) of frequency bins and the mean is taken for each bin.
float
| list
of float
| None
Upper bound of the frequency range in Hertz. Defaults to the highest frequency available. When a list of frequencies is given, these are used as the upper bounds (inclusive) of frequency bins and the mean is taken for each bin.
CrossSpectralDensity
The CSD matrix, averaged across the given frequency range(s).
Examples using mean
:
Compute a cross-spectral density (CSD) matrix
Compute source power using DICS beamformer
Number of time series defined in this CSD object.
Pick channels from this cross-spectral density matrix.
The modified cross-spectral density object.
Notes
Operates in-place.
New in version 0.20.0.
Get a CrossSpectralDensity object with only the given frequency.
CrossSpectralDensity
A CSD object containing a single CSD matrix that corresponds to the requested frequency or frequency-bin.
See also
Plot CSD matrices.
A sub-plot is created for each frequency. If an info object is passed to the function, different channel types are plotted in different figures.
mne.Info
| None
The mne.Info
object with information about the sensors and methods of measurement.
Used to split the figure by channel-type, if provided.
By default, the CSD matrix is plotted as a whole.
Whether to plot the cross-spectral density (‘csd’, the default), or the coherence (‘coh’) between the channels.
Whether to show a colorbar. Defaults to True
.
str
| None
The matplotlib colormap to use. Defaults to None, which means the colormap will default to matplotlib’s default.
int
| None
CSD matrices are plotted in a grid. This parameter controls how many matrix to plot side by side before starting a new row. By default, a number will be chosen to make the grid as square as possible.
Whether to show the figure. Defaults to True
.
Save the CSD to an HDF5 file.
str
The name of the file to save the CSD to. The extension ‘.h5’ will be appended if the given filename doesn’t have it already.
If True (default False), overwrite the destination file if it exists.
New in version 1.0.
str
| int
| None
Control verbosity of the logging output. If None
, use the default
verbosity level. See the logging documentation and
mne.verbose()
for details. Should only be passed as a keyword
argument.
New in version 1.0.
See also
read_csd
For reading CSD objects from a file.
Calculate the sum CSD in the given frequency range(s).
If the exact given frequencies are not available, the nearest frequencies will be chosen.
float
| list
of float
| None
Lower bound of the frequency range in Hertz. Defaults to the lowest frequency available. When a list of frequencies is given, these are used as the lower bounds (inclusive) of frequency bins and the sum is taken for each bin.
float
| list
of float
| None
Upper bound of the frequency range in Hertz. Defaults to the highest frequency available. When a list of frequencies is given, these are used as the upper bounds (inclusive) of frequency bins and the sum is taken for each bin.
CrossSpectralDensity
The CSD matrix, summed across the given frequency range(s).
mne.time_frequency.CrossSpectralDensity
#Compute a cross-spectral density (CSD) matrix
Compute source power using DICS beamformer