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