@requires_sklearn
def test_spatio_temporal_tris_connectivity():
 tris = np.array([[0, 1, 2], [3, 4, 5]])
 connectivity = spatio_temporal_tris_connectivity(tris, 2)
 x = [1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
 components = stats.cluster_level._get_components(np.array(x), connectivity)
 old_fmt = [0, 0, (-2), (-2), (-2), (-2), 0, (-2), (-2), (-2), (-2), 1]
 new_fmt = np.array(old_fmt)
 new_fmt = [np.nonzero((new_fmt == v))[0] for v in np.unique(new_fmt[(new_fmt >= 0)])]
 assert_true(len(new_fmt), len(components))
 for (c, n) in zip(components, new_fmt):
  assert_array_equal(c, n)

@ requires_sklearn def test_spatio_temporal_tris_connectivity ( ) : tris = np . array ( [ [ 0 , 1 , 2 ] , [ 3 , 4 , 5 ] ] ) connectivity = spatio_temporal_tris_connectivity ( tris , 2 ) x = [ 1 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 ] components = stats . cluster_level . _get_components ( np . array ( x ) , connectivity ) old_fmt = [ 0 , 0 , ( - 2 ) , ( - 2 ) , ( - 2 ) , ( - 2 ) , 0 , ( - 2 ) , ( - 2 ) , ( - 2 ) , ( - 2 ) , 1 ] new_fmt = np . array ( old_fmt ) new_fmt = [ np . nonzero ( ( new_fmt == v ) ) [ 0 ] for v in np . unique ( new_fmt [ ( new_fmt >= 0 ) ] ) ] assert_true ( len ( new_fmt ) , len ( components ) ) for ( c , n ) in zip ( components , new_fmt ) : assert_array_equal ( c , n )
test spatio-temporal connectivity from triangles .