예제 #1
0
def plot_probe(ProbeFileName,output_dir=None):

    load_probe(ProbeFileName)
    
    if PROBE_DIM == 0:
        x = [np.cos(2*np.pi*i_site/N_SITES) for i_site in xrange(N_SITES)]
        y = [np.sin(2*np.pi*i_site/N_SITES) for i_site in xrange(N_SITES)] 
    elif PROBE_DIM == 1:
        x = [site.x for site in PROBE_SITES]
        y = [0 for site in PROBE_SITES]
    elif PROBE_DIM == 2:
        x = [site.x for site in PROBE_SITES]
        y = [site.y for site in PROBE_SITES]

    #if max2min(x) > max2min(y):
        #figsize = (6,1+max2min(y)/max2min(x)*6)
    #else:
        #figsize = (1+max2min(x)/max2min(y)*6,6)        
               
    plt.plot(x,y,'go')
    ax = plt.gca()
    ax.set_xticks([])
    ax.set_yticks([])
    
    for ind_src,ind_targ in edges(PROBE_GRAPH):
        ax.add_line(matplotlib.lines.Line2D([x[ind_src],x[ind_targ]],[y[ind_src],y[ind_targ]],lw=1))
    
    for ind_node in nodes(PROBE_GRAPH):
        site = PROBE_SITES[ind_node]
        ax.text(x[ind_node],y[ind_node],site.name,color='r')
            
    
    img_filename = join(output_dir or dirname(ProbeFileName),switch_ext(basename(ProbeFileName),"png"))
    print("Saving figure as %s"%abspath(img_filename))
    plt.savefig(img_filename)
예제 #2
0
def plot_probe(ProbeFileName, output_dir=None):

    load_probe(ProbeFileName)

    if PROBE_DIM == 0:
        x = [
            np.cos(2 * np.pi * i_site / N_SITES) for i_site in xrange(N_SITES)
        ]
        y = [
            np.sin(2 * np.pi * i_site / N_SITES) for i_site in xrange(N_SITES)
        ]
    elif PROBE_DIM == 1:
        x = [site.x for site in PROBE_SITES]
        y = [0 for site in PROBE_SITES]
    elif PROBE_DIM == 2:
        x = [site.x for site in PROBE_SITES]
        y = [site.y for site in PROBE_SITES]

    #if max2min(x) > max2min(y):
    #figsize = (6,1+max2min(y)/max2min(x)*6)
    #else:
    #figsize = (1+max2min(x)/max2min(y)*6,6)

    plt.plot(x, y, 'go')
    ax = plt.gca()
    ax.set_xticks([])
    ax.set_yticks([])

    for ind_src, ind_targ in edges(PROBE_GRAPH):
        ax.add_line(
            matplotlib.lines.Line2D([x[ind_src], x[ind_targ]],
                                    [y[ind_src], y[ind_targ]],
                                    lw=1))

    for ind_node in nodes(PROBE_GRAPH):
        site = PROBE_SITES[ind_node]
        ax.text(x[ind_node], y[ind_node], site.name, color='r')

    img_filename = join(output_dir or dirname(ProbeFileName),
                        switch_ext(basename(ProbeFileName), "png"))
    print("Saving figure as %s" % abspath(img_filename))
    plt.savefig(img_filename)
예제 #3
0
def get_edge_lines():  return ["%s %s"%(PROBE_SITES[src].name,PROBE_SITES[targ].name) for (src,targ) in edges(PROBE_GRAPH) if src<targ]
def get_group_lines(): return [string.join([PROBE_SITES[i_site].name for i_site in group]," ")
예제 #4
0
def get_edge_lines():
    return [
        "%s %s" % (PROBE_SITES[src].name, PROBE_SITES[targ].name)
        for (src, targ) in edges(PROBE_GRAPH) if src < targ
    ]