libs/data/mass.py
def _load_from_source(self):
        """Loads the data from files and transforms it appropriately."""
        data_paths = self._get_file_paths()
        data = {}
        n_data = len(data_paths)
        start = time.time()
        for i, subject_id in enumerate(data_paths.keys()):
            print('\nLoading ID %d' % subject_id)
            path_dict = data_paths[subject_id]

            # Read data
            signal_eeg_frontal = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_FRONTAL)
            signal_eeg_central = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_CENTRAL)
            signal_eeg_occipital = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_OCCIPITAL)

            signal_eog_left = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EOG_LEFT)
            signal_eog_right = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EOG_RIGHT)

            signal_emg = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EMG)

            signal_len = signal_eeg_frontal.shape[0]
            hypnogram = self._read_states(
                path_dict[KEY_FILE_STATES], signal_len)
            print('Hypnogram pages: %d' % hypnogram.shape[0])

            # Save data
            ind_dict = {
                KEY_EEG_FRONTAL: signal_eeg_frontal,
                KEY_EEG_CENTRAL: signal_eeg_central,
                KEY_EEG_OCCIPITAL: signal_eeg_occipital,
                KEY_EOG_LEFT: signal_eog_left,
                KEY_EOG_RIGHT: signal_eog_right,
                KEY_EMG: signal_emg,
                KEY_HYPNOGRAM: hypnogram
            }
            data[subject_id] = ind_dict
            print('Loaded ID %d (%02d/%02d ready). Time elapsed: %1.4f [s]'
                  % (subject_id, i+1, n_data, time.time()-start))
        print('%d records have been read.' % len(data))
        return data
Loads the data from files and transforms it appropriately.
Loads the data from files and transforms it appropriately.
Loads the data from files and transforms it appropriately .
def _load_from_source(self):
        data_paths = self._get_file_paths()
        data = {}
        n_data = len(data_paths)
        start = time.time()
        for i, subject_id in enumerate(data_paths.keys()):
            print('\nLoading ID %d' % subject_id)
            path_dict = data_paths[subject_id]
            signal_eeg_frontal = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_FRONTAL)
            signal_eeg_central = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_CENTRAL)
            signal_eeg_occipital = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EEG_OCCIPITAL)
            signal_eog_left = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EOG_LEFT)
            signal_eog_right = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EOG_RIGHT)
            signal_emg = self._read_eeg(
                path_dict[KEY_FILE_EEG], KEY_EMG)
            signal_len = signal_eeg_frontal.shape[0]
            hypnogram = self._read_states(
                path_dict[KEY_FILE_STATES], signal_len)
            print('Hypnogram pages: %d' % hypnogram.shape[0])
            ind_dict = {
                KEY_EEG_FRONTAL: signal_eeg_frontal,
                KEY_EEG_CENTRAL: signal_eeg_central,
                KEY_EEG_OCCIPITAL: signal_eeg_occipital,
                KEY_EOG_LEFT: signal_eog_left,
                KEY_EOG_RIGHT: signal_eog_right,
                KEY_EMG: signal_emg,
                KEY_HYPNOGRAM: hypnogram
            }
            data[subject_id] = ind_dict
            print('Loaded ID %d (%02d/%02d ready). Time elapsed: %1.4f [s]'
                  % (subject_id, i+1, n_data, time.time()-start))
        print('%d records have been read.' % len(data))
        return data
def _load_from_source ( self ) : data_paths = self . _get_file_paths ( ) data = { } n_data = len ( data_paths ) start = time . time ( ) for i , subject_id in enumerate ( data_paths . keys ( ) ) : print ( '\nLoading ID %d' % subject_id ) path_dict = data_paths [ subject_id ] signal_eeg_frontal = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EEG_FRONTAL ) signal_eeg_central = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EEG_CENTRAL ) signal_eeg_occipital = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EEG_OCCIPITAL ) signal_eog_left = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EOG_LEFT ) signal_eog_right = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EOG_RIGHT ) signal_emg = self . _read_eeg ( path_dict [ KEY_FILE_EEG ] , KEY_EMG ) signal_len = signal_eeg_frontal . shape [ 0 ] hypnogram = self . _read_states ( path_dict [ KEY_FILE_STATES ] , signal_len ) print ( 'Hypnogram pages: %d' % hypnogram . shape [ 0 ] ) ind_dict = { KEY_EEG_FRONTAL : signal_eeg_frontal , KEY_EEG_CENTRAL : signal_eeg_central , KEY_EEG_OCCIPITAL : signal_eeg_occipital , KEY_EOG_LEFT : signal_eog_left , KEY_EOG_RIGHT : signal_eog_right , KEY_EMG : signal_emg , KEY_HYPNOGRAM : hypnogram } data [ subject_id ] = ind_dict print ( 'Loaded ID %d (%02d/%02d ready). Time elapsed: %1.4f [s]' % ( subject_id , i + 1 , n_data , time . time ( ) - start ) ) print ( '%d records have been read.' % len ( data ) ) return data
Loads the data from files and transforms it appropriately.
Loads the data from files and transforms it appropriately .
"""Loads the data from files and transforms it appropriately.""" # Read data # Save data
self