eeg_tools.load_data

eeg_tools.load_data(h5file, nodes=None)[source]

Load data from HDF5 container generated with read_eeg

Parameters:

h5file : str or h5py.File instance

String specifying file name (or path + filename) or h5py.File instance of HDF5 container to be accessed

nodes : list or NumPy 1darray

Python list or NumPy array of electrodes to be read. Can be either an array/list of strings or indices. By default nodes=None and all electrodes are read from file

Returns:

data : NumPy 2darray

A #nodes-by-#samples array holding the data in float64 format

See also

read_eeg
Read raw EEG data from binary .EEG/.eeg and *.21E files

Notes

The raw iEEG data are stored as int16. This routine normalizes (divides by max(int16)) and rescales the data based on the original channel sensitivity (read from the HDF5 container).

Examples

Suppose we want to read data stored in the file iEEG.h5. To access all of its contents use

>>> data = load_data('iEEG.h5')
>>> data.shape
>>> (84, 9000000)

If the HDF5 container is already open and only electrodes RFA1 and RFB1 should be read use

>>> import h5py
>>> f = h5py.File('iEEG.h5')
>>> data = load_data(f,nodes=['RFA1','RFB1'])
>>> data.shape
>>> (2, 9000000)

Alternatively, nodes can be specified using their indices in the file

>>> data = load_data(f,nodes=np.array([12,33]))
>>> data.shape
>>> (2, 9000000)