def test_transform_data():
 (n_sensors, n_vertices, n_times) = (10, 20, 4)
 kernel = rng.randn(n_vertices, n_sensors)
 sens_data = rng.randn(n_sensors, n_times)
 vertices = np.arange(n_vertices)
 data = np.dot(kernel, sens_data)
 for (idx, tmin_idx, tmax_idx) in zip([None, np.arange((n_vertices // 2), n_vertices)], [None, 1], [None, 3]):
  if (idx is None):
   idx_use = slice(None, None)
  else:
   idx_use = idx
  (data_f, _) = _my_trans(data[idx_use, tmin_idx:tmax_idx])
  for stc_data in (data, (kernel, sens_data)):
   stc = VolSourceEstimate(stc_data, vertices=vertices, tmin=0.0, tstep=1.0)
   stc_data_t = stc.transform_data(_my_trans, idx=idx, tmin_idx=tmin_idx, tmax_idx=tmax_idx)
   assert_allclose(data_f, stc_data_t)

def test_transform_data ( ) : ( n_sensors , n_vertices , n_times ) = ( 10 , 20 , 4 ) kernel = rng . randn ( n_vertices , n_sensors ) sens_data = rng . randn ( n_sensors , n_times ) vertices = np . arange ( n_vertices ) data = np . dot ( kernel , sens_data ) for ( idx , tmin_idx , tmax_idx ) in zip ( [ None , np . arange ( ( n_vertices // 2 ) , n_vertices ) ] , [ None , 1 ] , [ None , 3 ] ) : if ( idx is None ) : idx_use = slice ( None , None ) else : idx_use = idx ( data_f , _ ) = _my_trans ( data [ idx_use , tmin_idx : tmax_idx ] ) for stc_data in ( data , ( kernel , sens_data ) ) : stc = VolSourceEstimate ( stc_data , vertices = vertices , tmin = 0.0 , tstep = 1.0 ) stc_data_t = stc . transform_data ( _my_trans , idx = idx , tmin_idx = tmin_idx , tmax_idx = tmax_idx ) assert_allclose ( data_f , stc_data_t )
test applying linear transform to data .