def plot_refine_stats(base_file, I):
    plt.figure(3)
    plt.clf()
    (nodes,faces) = read_shewchuk(base_file + '.' + str(I))
    F = faces.shape[0]
    unarch = Unarchiver(base_file + '.' + str(I+1) + '.stats')

    number_of_vects = len(unarch.data)
    R = int(np.ceil(np.sqrt(number_of_vects)))
    C = int(np.ceil(float(number_of_vects) / float(R)))
    assert R*(C-1) < number_of_vects <= R*C
    for (i,(name,f)) in enumerate(unarch.data.items()):
        plt.subplot(R,C,i+1)
        assert((F,) == f.shape)
        tmv.plot_faces(nodes,faces,f)
        plt.title(name)
    plt.suptitle(base_file + '.' + str(I))
def plot_solution_mesh(mesh_filename,soln_filename,mode,
                       log=False,three_d=False,dual=False):
    (nodes,faces) = read_shewchuk(mesh_filename)
    (N,nd) = nodes.shape

    unarch = Unarchiver(soln_filename)
    if dual:
        (fn_data,cmap) = get_solution(nodes,faces,unarch.d,mode)
    else:
        (fn_data,cmap) = get_solution(nodes,faces,unarch.p,mode)
 
    if log:
        fn_data = np.log(np.abs(fn_data) + 1e-15)        
    assert(N == fn_data.size)

    if three_d:
        plot_vertices_3d(nodes,faces,fn_data,cmap)
    else:
        plot_vertices(nodes,faces,fn_data,cmap)
def plot_archive_mesh(mesh_filename,arch_filename,field,log,three_d):
    (nodes,faces) = read_shewchuk(mesh_filename)
    (N,nd) = nodes.shape
    (F,fd) = faces.shape
    unarch = Unarchiver(arch_filename)
    assert field in unarch.data
    
    f = unarch.data[field]
    cmap = plt.get_cmap('jet')
    
    if (N+1,) == f.shape:
        f = f[:-1]
    if log:
        f = np.log(np.abs(f))
    
    if (N,) == f.shape:
        if three_d:
            plot_vertices_3d(nodes,faces,f,cmap)
        else:
            plot_vertices(nodes,faces,f,cmap)
    else:
        assert (F,) == f.shape
        plot_faces(nodes,faces,f,cmap)
def plot_bare_mesh(filename):
    fig = plt.gca()
    (nodes,faces) = read_shewchuk(filename)
    plt.triplot(nodes[:,0],nodes[:,1],faces,'-k')
    plt.plot(nodes[:,0],nodes[:,1],'.k')
Exemple #5
0
        jitter.append(jit)

    
    group = np.argmax(np.abs(basis),1)
    idx = np.argsort(group)
    residual = np.array(residual).T
    jitter = np.array(jitter).T

    np.savez("tmp.npz",
             residual=residual,
             jitter=jitter)
    
    Cor1 = np.cov(residual[idx,:])
    Cor2 = np.cov(residual[idx,:]*jitter[idx,:])
    cmap = plt.get_cmap('jet')
    (nodes,faces) = read_shewchuk(base_file)
    for (i,c) in enumerate([Cor1,Cor2]):
        plt.figure(1);
        plt.subplot(1,2,i+1)
        tmv.plot_vertices(nodes,faces,np.diag(c),
                          cmap=cmap,interp='nearest');
        plt.colorbar()
        
        plt.figure(2);
        plt.subplot(1,2,i+1)
        plt.imshow(c,
                   cmap=cmap,interpolation='nearest');
        plt.colorbar()


    plt.show()