def test4_1():
    """
    This functions builds a planar mesh and checks that the weights of the
    middle vertex is correct. Here is the mesh (with the non-zero weights):
        ________________
        |\      |      /|
        |  \   0.5   /  |
        |    \  |  /    |
        |_0.5__\|/__0.5_|   sum(wi) = 2
        |      /|\      |
        |    /  |  \    |
        |  /   0.5   \  |
        |/______|______\|
    
    
    It also checks that the Laplace-Beltrami operator is correctly defined
    """
    # create vertices
    x = np.array([0., 1., 2.])
    x = np.repeat(x, 3)
    y = np.array([0., 1., 2.])
    y = np.tile(y ,3)
    z = np.zeros(9)
    vertices = np.vstack((x, y, z)).T
    
    # create polygons
    polygons = np.array([[0, 3, 4], [0, 4, 1], [1, 4, 2], [2, 4, 5],
                         [3, 6, 4], [4, 6, 7], [4, 7, 8], [4, 8, 5]])
    
    # get edges
    nb_edges = 3 * polygons.shape[0]
    edges = np.zeros((nb_edges, 2))
    # get the polygons edges as tuples
    permutator = np.array([(0,0,1),(1,0,0),(0,1,0)], dtype=int)
    edges[:,0] = np.ravel(polygons)
    edges[:,1] = np.ravel(np.dot(polygons, permutator))
    ind = np.lexsort((edges[:,1], edges[:,0]))
    edges = edges[ind]

    weights_matrix = smooth.compute_weights_matrix(polygons, vertices, edges)
    LB_operator = smooth.define_LB_operator(weights_matrix)

    assert (LB_operator[4,0] == 0. and LB_operator[4,2] == 0. and
            LB_operator[4,6] == 0. and LB_operator[4,8] == 0.)
    assert (LB_operator[4,1] == 0.5 and LB_operator[4,3] == 0.5 and
            LB_operator[4,5] == 0.5 and LB_operator[4,7] == 0.5)
    assert (LB_operator[4,4] == -2.)
 
 ### Get information from input texture
 # /!\ fixme : check that input_tex corresponds to the mesh
 print "  * Getting information from input texture"
 sys.stdout.flush()
 input_tex = tio.Texture(orig_tex_path).read(orig_tex_path)
 activation_data = input_tex.data
 activation_data[np.isnan(activation_data)] = 0
     
 ### Construct the weights matrix
 print "  * Computing the weights matrix"
 sys.stdout.flush()
 weights_matrix = smooth.compute_weights_matrix(polygons, vertices, edges)
     
 ### Define the Laplace-Beltrami operator
 LB_operator = smooth.define_LB_operator(weights_matrix)
     
 ### Compute the number of iterations needed
 N, dt = smooth.compute_smoothing_parameters(weights_matrix, FWHM)
     
 ### Apply smoothing
 print "  * Smoothing...(FWHM = %g)" %FWHM
 sys.stdout.flush()
 smoothed_activation_data = smooth.diffusion_smoothing(
     activation_data, LB_operator, N, dt)
 
 ### Write smoothed data into a new texture file
 print "  * Writing output texture"
 sys.stdout.flush()
 output_tex = tio.Texture(smoothed_tex_path, data=smoothed_activation_data)
 output_tex.write()