src/features/utils.py
def convert_to_array(epoch, trial, config):
    """Converts the edf files in eeg and robot dataset into arrays.

    Parameters
    ----------
    subject : string
        Subject ID e.g. 7707.
    trial : string
        e.g. HighFine, HighGross, LowFine, LowGross, AdoptComb, HighComb etc.

    Returns
    -------
    tensors
        x and y arrays corresponding to the subject and trial.

    """
    # Parameters
    n_electrodes = config['n_electrodes']

    try:
        x = epoch.get_data()
    except Exception:
        x = epoch

    y = np.zeros((x.shape[0], config['n_classes']))

    # Convert class targets to one_hot
    if (trial == 'HighFine') or (trial == 'LowGross'):
        y[:, 0] = 1  # [1, 0]
    if (trial == 'HighGross') or (trial == 'LowFine'):
        y[:, 1] = 1  # [0, 1]

    x_array = np.float32(x[:, 0:n_electrodes, :])
    y_array = y

    return x_array, y_array
Converts the edf files in eeg and robot dataset into arrays.

    Parameters
    ----------
    subject : string
        Subject ID e.g. 7707.
    trial : string
        e.g. HighFine, HighGross, LowFine, LowGross, AdoptComb, HighComb etc.

    Returns
    -------
    tensors
        x and y arrays corresponding to the subject and trial.

    
Converts the edf files in eeg and robot dataset into arrays.
Parameters

subject : string
Subject ID e.g. 7707.

Returns

tensors
x and y arrays corresponding to the subject and trial.
Converts the edf files in eeg and robot dataset into arrays . Parameters subject : string Subject ID e . g . 7707 . Returns tensors x and y arrays corresponding to the subject and trial .
def convert_to_array(epoch, trial, config):
    n_electrodes = config['n_electrodes']
    try:
        x = epoch.get_data()
    except Exception:
        x = epoch
    y = np.zeros((x.shape[0], config['n_classes']))
    if (trial == 'HighFine') or (trial == 'LowGross'):
        y[:, 0] = 1  
    if (trial == 'HighGross') or (trial == 'LowFine'):
        y[:, 1] = 1  
    x_array = np.float32(x[:, 0:n_electrodes, :])
    y_array = y
    return x_array, y_array
def convert_to_array ( epoch , trial , config ) : n_electrodes = config [ 'n_electrodes' ] try : x = epoch . get_data ( ) except Exception : x = epoch y = np . zeros ( ( x . shape [ 0 ] , config [ 'n_classes' ] ) ) if ( trial == 'HighFine' ) or ( trial == 'LowGross' ) : y [ : , 0 ] = 1 if ( trial == 'HighGross' ) or ( trial == 'LowFine' ) : y [ : , 1 ] = 1 x_array = np . float32 ( x [ : , 0 : n_electrodes , : ] ) y_array = y return x_array , y_array
Converts the edf files in eeg and robot dataset into arrays.
Converts the edf files in eeg and robot dataset into arrays .
"""Converts the edf files in eeg and robot dataset into arrays.

    Parameters
    ----------
    subject : string
        Subject ID e.g. 7707.
    trial : string
        e.g. HighFine, HighGross, LowFine, LowGross, AdoptComb, HighComb etc.

    Returns
    -------
    tensors
        x and y arrays corresponding to the subject and trial.

    """ # Parameters # Convert class targets to one_hot # [1, 0] # [0, 1]
epoch
trial
config