Exemple #1
0
 def test_map_window_stepped(self):
     '''Test spatial averaging with non-unity row/column step sizes.'''
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (30, 60, 3), (70, 100, 4), border='shift')
     t = np.mean(X[32:35, 72:77].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[1, 1], t)
Exemple #2
0
 def test_map_window_shifted(self):
     '''Test spatial averaging near border with shifted window.'''
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (100, None), (100, None), border='shift')
     t = np.mean(X[-3:, -5:].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[-1, -1], t)
Exemple #3
0
 def test_map_window(self):
     '''Test computing spectra average over local window.'''
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (10, 50), (20, 40))
     t = np.mean(X[9:12, 18:23].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[0, 0], t)
 def test_map_window_stepped(self):
     '''Test spatial averaging with non-unity row/column step sizes.'''
     from spectral.algorithms.spatial import map_window
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (30, 60, 3), (70, 100, 4), border='shift')
     t = np.mean(X[32:35, 72:77].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[1, 1], t)
 def test_map_window_shifted(self):
     '''Test spatial averaging near border with shifted window.'''
     from spectral.algorithms.spatial import map_window
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (100, None), (100, None), border='shift')
     t = np.mean(X[-3:, -5:].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[-1, -1], t)
 def test_map_window(self):
     '''Test computing spectra average over local window.'''
     from spectral.algorithms.spatial import map_window
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (10, 50), (20, 40))
     t = np.mean(X[9:12, 18:23].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[0, 0], t)
Exemple #7
0
 def test_map_window_clipped(self):
     '''Test spatial averaging near border with clipped window.'''
     from spectral.algorithms.spatial import map_window
     f = lambda X, ij: np.mean(X.reshape((-1, X.shape[-1])), axis=0)
     X = self.data
     y = map_window(f, X, (3, 5), (100, None), (100, None), border='clip')
     t = np.mean(X[-2:, -3:].reshape((-1, X.shape[-1])), axis=0)
     assert_allclose(y[-1, -1], t)