frites.dataset.SubjectEphy#
- class frites.dataset.SubjectEphy(x, y=None, z=None, roi=None, times=None, agg_ch=True, multivariate=False, name=None, attrs=None, sfreq=None, verbose=None)[source]#
Single-subject electrophysiological data container.
This class can be used to convert the data from different types (e.g NumPy, MNE-Python, Xarray) into a single format (xarray.DataArray).
- Parameters
- xnumpy:array_like
The electrophysiological data of a single subject. Several data types are supported :
3d NumPy array of shape (n_epochs, n_channels, n_times)
4d NumPy array of shape (n_epochs, n_channels, n_freqs, n_times)
4d NumPy array of shape (n_epochs, n_channels, mv, n_times) where ‘mv’ refers to an axis to consider as multi-variate
mne.Epochs or mne.EpochsArray
mne.EpochsTFR (i.e. non-averaged power)
xarray.DataArray. In that case y, z, roi and times inputs can be strings that refer to the coordinate name to use in the DataArray
- y, z
python:list
,sting
|python:None
Task-related variables (e.g discret stimulus, learning rate etc.) The y and z variables must be vectors of shapes (n_epochs,). The MI is then going to be computed between the data (x) and those task related variables. The type of MI depends on the type of this two variables :
y=continuous, z=None : I(x; y) and mi_type should be ‘cc’
y=discrete, z=None : I(x; y) and mi_type should be ‘cd’
y=continuous, z=discrete : I(x; y | z) and mi_type should be ‘ccd’
Note that if y (or z) are multi-dimensional discrete variables, the categories inside are going to be automatically remapped to a single vector. Several input types are supported :
A NumPy array of shape (n_epochs,)
If x is a DataArray, the dimension name to use to infer the task-related variable
- roi
python:list
|python:None
Anatomical informations of each channel / electrodes. Several input types are supported :
A NumPy array of shape (n_channels). If None, unique ROI are defined (‘roi_0’, ‘roi_1’ etc.)
If None, and if input type is coming from MNE, it’s using the ch_names (info[‘ch_names’])
If x is a DataArray, the dimension name to use to infer the anatomical informations
- timesnumpy:array_like |
python:None
The time vector to use. Several types are supported :
A NumPy array of length (n_times,)
If MNE object are passed, the time vector is automatically inferred from it
If x is a DataArray, the dimension name to use to infer to the time vector
- agg_chbool |
python:True
If multiple channels belong to the same ROI, specify whether if the data should be aggregated across channels (True) or if the information per channel have to be take into account (False - conditional mutual information).
- multivariatebool |
python:False
If 4d input is provided, this parameter specifies whether this axis should be considered as multi-variate (True) or uni-varariate (False)
- name
python:str
|python:None
Subject name
- attrs
python:dict
| {} Dictionary of additional attributes about the data
- sfreq
python:float
|python:None
The sampling frequency. If None, it could be inferred if the time vector is provided or if the input x is an MNE object
- Returns
- da
xarray.DataArray
A formatted DataArray representing the subject with all the task-related variables inside
- da
Methods
clear
()get
(k[,d])items
()keys
()merge
(list_attrs)Merge a list of multiple attributes.
pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
setdefault
(k[,d])update
(attrs[, check])Update internal with external attributes.
values
()wrap_xr
(da[, name])Wrap a data array / set with internal attributes.
copy
fromkeys
- __hash__ = None#
- pop(k[, d]) v, remove specified key and return the corresponding value. [source]#
If key is not found, d is returned if given, otherwise KeyError is raised.