예제 #1
0
def plot():
    
    system                          =   'spiral_w_wave_sqr'
    nr, nphi, phiperiod             =   20, 40, pi/3
    
    from os import listdir
    
    input_file_folder_consts        =   '/space/tohekorh/Spiral/bender_input/calc/consts/' \
                                           + '%s/phiper=%.2f/nr-nphi=%i-%i/'  \
                                            %(system, phiperiod, nr, nphi)
        #input_file_folder_moldy     =   '/space/tohekorh/Spiral/bender_input/calc/moldy/'

    
    for input_folder in listdir(input_file_folder_consts):
        input_file_folder   = input_file_folder_consts + input_folder + '/'
        
        if input_folder != 'store':
            for input_file in listdir(input_file_folder):
                if input_file[-3:] == 'txt':
                    if has_been_calculated(input_file_folder + input_file, 'read'):
                        in_file =  input_file_folder + input_file
                        if query_yes_no("plot this " + input_file, 'no'):
                            #study_height_synopsis(in_file)
                            #plot_e_surfaces(in_file, show = True)
                            #study_height_synopsis(in_file)
                            study_consts_proximity(in_file, acc = 30)
                        #ue              =   parse_u_from_file(input_file_folder +  input_file)
                        #params          =   read_bender_output(input_file_folder +  input_file)[0]
                        #ue.set_const(params[("consts")])
                        #energies        =   deform_energies(ue)
                        #E_b, E_s, E_b_surf, E_s_surf, normals  = energies.calc_energies()
                        
    write_total_synopsis(nr, nphi, phiperiod, system, input_file_folder_consts)
    
    study_total_synopsis(nr, nphi, phiperiod, system)
예제 #2
0
파일: plots.py 프로젝트: TopiKo/Futurama
def plot_consts_proxm(x_mesh, A_mesh, E_b_surf, E_s_surf, folder, \
                      from_file = False, acc = 100):
    
    E_surf  =   E_b_surf + E_s_surf
    
    fig     =   plt.figure(figsize=plt.figaspect(0.5)*1.5)
    ax      =   fig.add_subplot(111)
    CS      =   plt.contour(x_mesh, A_mesh, E_surf, acc,
                 colors='k')
    plt.clabel(CS, fontsize=9, inline=1)
    plt.title('Energy contours in the proximity of optimal constants')
    
    ax.set_xlabel('x')
    ax.set_ylabel('Amplitude')
    #ax.set_zlabel('Energy')

    plt.savefig(folder + 'consts_prxm.png')
    
    
    if from_file:
    
        plt.show()
        plt.clf()
    
        if query_yes_no('separate plot', "no"):
            
            if not exists(folder + 'pictures/'):
                makedirs(folder + 'pictures/')
            
            for k in range(len(A_mesh[:,0])):
                fig     =   plt.figure(figsize=plt.figaspect(0.5)*1.5)
                ax      =   fig.add_subplot(111)
                x       =   x_mesh[0, k]
                ax.plot(A_mesh[:,k], E_surf[:,k]) 
                ax.plot(A_mesh[:,k], E_b_surf[:,k], label = 'E_b') 
                ax.plot(A_mesh[:,k], E_s_surf[:,k], label = 'E_s') 
                
                ax.set_xlabel('A')
                ax.set_ylabel('Energy, x = %f.2' %x )
                plt.legend()
                plt.savefig(folder + 'pictures/x=%f.2.png' %x)
                
                plt.clf()
                
            for k in range(len(A_mesh[0,:])):
                fig     =   plt.figure(figsize=plt.figaspect(0.5)*1.5)
                ax      =   fig.add_subplot(111)
                A       =   A_mesh[k,0]
                
                ax.plot(x_mesh[k,:], E_surf[k,:]) 
                ax.plot(x_mesh[k,:], E_b_surf[k,:], label = 'E_b') 
                ax.plot(x_mesh[k,:], E_s_surf[k,:], label = 'E_s') 
                
                ax.set_xlabel('x')
                ax.set_ylabel('Energy, A = %f.2' %A )
                plt.legend()
                
                plt.savefig(folder + 'pictures/A=%f.2.png' %A)
                plt.clf()
        
    plt.clf()