MultiSessEEGData#

class dpeeg.MultiSessEEGData(data: list[EEGData])[source]#
class dpeeg.MultiSessEEGData(data: dict[str, EEGData])

Multi-session eegdata.

The multi-session EEGData is actually equivalent to the EEGData collection wrapped by the Python built-in dict. It does not have to be multi- session data, it can be any other EEGData collection. This name is only used here to indicate this type of data. The actual format is similar to:

multi_sess_eegdata = { ‘session_id’: EEGData }

Warning

Do not set the key value to the keywords “train” or “test”; otherwise, please use SplitEEGData.

Parameters:

data (list or dict of EEGData) – Initialize EEG data. If it is a list of EEGData, add a key to each data in the order of the list. If it is a dict of EEGData, use the dict to initialize.

Examples

Data type is list:

>>> eegdata = dpeeg.EEGData(edata=np.random.randn(16, 3, 10),
...                         label=np.random.randint(0, 3, 16))
>>> dpeeg.MultiSessEEGData([eegdata.copy(), eegdata.copy()])
{'session_1': [edata=(16, 3, 10), label=(16,)],
 'session_2': [edata=(16, 3, 10), label=(16,)]}

or the data type is custom dict:

>>> dpeeg.MultiSessEEGData({'xx': eegdata.copy(), 'yy': eegdata.copy()})
{'xx': [edata=(16, 3, 10), label=(16,)],
 'yy': [edata=(16, 3, 10), label=(16,)]}

Methods

clear

copy

Creates a deep copy of the current object.

fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Return the value for key if key is in the dictionary, else default.

items

keys

pop

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem

Remove and return a (key, value) pair as a 2-tuple.

setdefault

Insert key with a value of default if key is not in the dictionary.

trials

Returns the sum of the number of trials for all data or the number of trials for each data.

update

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

trials(sum: bool = True) list[int] | int[source]#

Returns the sum of the number of trials for all data or the number of trials for each data.