@testing.requires_testing_data
def test_label_sign_flip():
 src = read_source_spaces(src_fname)
 label = Label(vertices=src[0]['vertno'][:5], hemi='lh')
 src[0]['nn'][label.vertices] = np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0, 0, 1.0], [(1.0 / np.sqrt(2)), (1.0 / np.sqrt(2)), 0.0], [(1.0 / np.sqrt(2)), (1.0 / np.sqrt(2)), 0.0]])
 known_flips = np.array([1, 1, np.nan, 1, 1])
 idx = [0, 1, 3, 4]
 flip = label_sign_flip(label, src)
 assert_array_almost_equal(np.abs(np.dot(flip[idx], known_flips[idx])), len(idx))

@ testing . requires_testing_data def test_label_sign_flip ( ) : src = read_source_spaces ( src_fname ) label = Label ( vertices = src [ 0 ] [ 'vertno' ] [ : 5 ] , hemi = 'lh' ) src [ 0 ] [ 'nn' ] [ label . vertices ] = np . array ( [ [ 1.0 , 0.0 , 0.0 ] , [ 0.0 , 1.0 , 0.0 ] , [ 0 , 0 , 1.0 ] , [ ( 1.0 / np . sqrt ( 2 ) ) , ( 1.0 / np . sqrt ( 2 ) ) , 0.0 ] , [ ( 1.0 / np . sqrt ( 2 ) ) , ( 1.0 / np . sqrt ( 2 ) ) , 0.0 ] ] ) known_flips = np . array ( [ 1 , 1 , np . nan , 1 , 1 ] ) idx = [ 0 , 1 , 3 , 4 ] flip = label_sign_flip ( label , src ) assert_array_almost_equal ( np . abs ( np . dot ( flip [ idx ] , known_flips [ idx ] ) ) , len ( idx ) )
test label sign flip computation .