예제 #1
0
def preprocessing(dat, MRK_DEF, JUMPING_MEANS_IVALS):
    dat = proc.sort_channels(dat)
    
    fs_n = dat.fs / 2
    b, a = proc.signal.butter(5, [30 / fs_n], btype='low')
    dat = proc.lfilter(dat, b, a)
    b, a = proc.signal.butter(5, [.4 / fs_n], btype='high')
    dat = proc.lfilter(dat, b, a)
    
    dat = proc.subsample(dat, 60)
    epo = proc.segment_dat(dat, MRK_DEF, SEG_IVAL)
    
    fv = proc.jumping_means(epo, JUMPING_MEANS_IVALS)
    fv = proc.create_feature_vectors(fv)
    return fv, epo
예제 #2
0
def preprocessing(dat, MRK_DEF, JUMPING_MEANS_IVALS):
    dat = proc.sort_channels(dat)

    fs_n = dat.fs / 2
    b, a = proc.signal.butter(5, [30 / fs_n], btype='low')
    dat = proc.lfilter(dat, b, a)
    b, a = proc.signal.butter(5, [.4 / fs_n], btype='high')
    dat = proc.lfilter(dat, b, a)

    dat = proc.subsample(dat, 60)
    epo = proc.segment_dat(dat, MRK_DEF, SEG_IVAL)

    fv = proc.jumping_means(epo, JUMPING_MEANS_IVALS)
    fv = proc.create_feature_vectors(fv)
    return fv, epo
예제 #3
0
 def test_sort_channels_copy(self):
     """sort_channels must not modify argument."""
     cpy = self.dat.copy()
     sort_channels(self.dat)
     self.assertEqual(self.dat, cpy)
예제 #4
0
 def test_sort_channels_swapaxis(self):
     """sort_channels must workt with nonstandard chanaxis."""
     sorted_ = sort_channels(swapaxes(self.dat, 1, -1), 1)
     sorted_ = swapaxes(sorted_, 1, -1)
     sorted2 = sort_channels(self.dat)
     self.assertEqual(sorted_, sorted2)
예제 #5
0
 def test_sort_channels_with_unknown_channel(self):
     """Unknown channels move to the back."""
     self.dat.axes[-1][7] = 'XX'
     dat = sort_channels(self.dat)
     self.assertEqual(dat.axes[-1][-1], 'XX')
예제 #6
0
 def test_sort_channels(self):
     """sort_channels must sort correctly."""
     dat = sort_channels(self.dat)
     np.testing.assert_array_equal(dat.axes[-1], self.sorted_channels)
예제 #7
0
 def test_sort_channels_copy(self):
     """sort_channels must not modify argument."""
     cpy = self.dat.copy()
     sort_channels(self.dat)
     self.assertEqual(self.dat, cpy)
예제 #8
0
 def test_sort_channels_swapaxis(self):
     """sort_channels must workt with nonstandard chanaxis."""
     sorted_ = sort_channels(swapaxes(self.dat, 1, -1), 1)
     sorted_ = swapaxes(sorted_, 1, -1)
     sorted2 = sort_channels(self.dat)
     self.assertEqual(sorted_, sorted2)
예제 #9
0
 def test_sort_channels_with_unknown_channel(self):
     """Unknown channels move to the back."""
     self.dat.axes[-1][7] = 'XX'
     dat = sort_channels(self.dat)
     self.assertEqual(dat.axes[-1][-1], 'XX')
예제 #10
0
 def test_sort_channels(self):
     """sort_channels must sort correctly."""
     dat = sort_channels(self.dat)
     np.testing.assert_array_equal(dat.axes[-1], self.sorted_channels)