Esempio n. 1
0
 def extract_rolling_PSD(self, seriesname='raw', window_size=512):
     """Extracts power spectral density (PSD) for the specified series"""
     new_feature_name = seriesname+'_rolling_PSD_'+str(window_size)
     self.series[new_feature_name]=rolling_windows.rolling_power_ratio(
         self.series[seriesname],
         window_size=window_size
     )
Esempio n. 2
0
except ImportError:
    print "Please create a dev_settings.py. Example: dev_settings.py.example"

data = pd.read_table(
    join(SAVE_URL, 'raw', '20101214163931.a.rawwave_label.csv'))
grouped = data.groupby(('taskid'))
taskids = grouped.size().keys()
ret = grouped.mean()
# add new columns, to populate below
ret['rolling_median'] = None
ret['rolling_PSD'] = None

for taskid in taskids:
    eeg_signal = grouped.get_group(taskid)[' Value']
    # TODO remove space from name

    ret.set_value(
        taskid, 'rolling_median',
        rolling_windows.downsampled_rolling_median(eeg_signal,
                                                   window_size=128))

    window_size = 512
    if len(eeg_signal) >= window_size:
        ret.set_value(
            taskid, 'rolling_PSD',
            rolling_windows.rolling_power_ratio(eeg_signal, window_size=512))

outfilename = 'features.pickle'
ret.save(outfilename)
print 'saved features as pickle in file "%s"' % outfilename
Esempio n. 3
0
try: # Import config params
   from dev_settings import *
except ImportError:
   print "Please create a dev_settings.py. Example: dev_settings.py.example"

data = pd.read_table(join(SAVE_URL,'raw','20101214163931.a.rawwave_label.csv'))
grouped = data.groupby(('taskid'))
taskids = grouped.size().keys()
ret = grouped.mean()
# add new columns, to populate below
ret['rolling_median'] = None
ret['rolling_PSD'] = None

for taskid in taskids:
    eeg_signal = grouped.get_group(taskid)[' Value']
    # TODO remove space from name

    ret.set_value(taskid, 'rolling_median',
                  rolling_windows.downsampled_rolling_median(eeg_signal,
                                                             window_size=128))

    window_size = 512
    if len(eeg_signal) >= window_size:
        ret.set_value(taskid, 'rolling_PSD',
                      rolling_windows.rolling_power_ratio(eeg_signal,
                                                          window_size=512))

outfilename = 'features.pickle'
ret.save(outfilename)
print 'saved features as pickle in file "%s"' % outfilename