Ejemplo n.º 1
0
    def func_wrapper(data, sep, savepdf):

        ### generate the save folder path to store the figure

        savefolder = sep.savefolderbase + \
            "SINGLE_SIM_INSTANCE/"
        os.system("mkdir -p " + savefolder)

        ### plot the figure

        updated_fig = plot_specific(data, sep, savepdf, fig, ax0)

        ### generate the save file path address to store the figure

        data_separator.assign_physicalvalues(sep.fixed_param, data.sim)
        savefilepath = (savefolder + data_separator.gen_path(sep.fixed_param))
        if savepdf:
            savefilepath += ".pdf"
        else:
            savefilepath += ".png"
        print "Saving the figure: ", savefilepath

        ### store the figure

        plt.savefig(savefilepath,
                    dpi=300,
                    bbox_inches='tight',
                    pad_inches=0.08)
        fig.clf()

        return
Ejemplo n.º 2
0
    def func_wrapper(data, sep, savepdf):

        ### generate the save folder path to store the figure

        savefolder = sep.savefolderbase + \
            sep.control_param[0].physicalparamname.upper() + "/"
        os.system("mkdir -p " + savefolder)

        ### plot the figure

        updated_fig = plot_specific(data, sep, savepdf, fig, ax0)

        ### generate the save file path address to store the figure

        data_separator.assign_physicalvalues(sep.fixed_param,
                                             data[data.keys()[0]].sim)
        savefilepath = savefolder + \
            sep.control_param[1].physicalparamname.upper() + "_" + data_separator.gen_path(sep.fixed_param)
        if savepdf:
            savefilepath += ".pdf"
        else:
            savefilepath += ".png"
        print "Saving the figure: ", savefilepath

        ### store the figure

        plt.savefig(savefilepath,
                    dpi=300,
                    bbox_inches='tight',
                    pad_inches=0.08)
        fig.clf()

        return
Ejemplo n.º 3
0
def plot_analysis(data, sep, savepdf, *args):
    """ plot the analysis data specific for this analysis"""

    fig = args[0]  # figure handle
    ax0 = args[1]  # axes handle

    ### normalize or select data

    keys = np.sort(data.keys())
    xd, yd, simd = select_data(data, keys)
    gsim = simd[simd.keys()[0]]
    avg_radius = gsim.avg_radius
    data_separator.assign_physicalvalues(sep.fixed_param, gsim)

    ### plot the data

    down = 35
    up = -10
    for key in keys:

        x = xd[key]
        y = yd[key]
        sim = simd[key]

        ### curve fitting

        popt, pcov = curve_fit(power_law, x[down:up], y[down:up])
        yfit = power_law(x[down:up], popt[0], popt[1])
        print popt[1]

        sep.legend_param.assign_physicalvalue(sim)
        label = data_separator.gen_label(sep.legend_param)
        line0 = ax0.plot(x[1:], y[1:], label=label, \
                         linewidth=3.0)
        line1 = ax0.plot(x[down:up], yfit, '--', label='_nolegend_', \
                         linewidth=2.0, c='grey')

    ### scales

    ax0.set_xscale('log')
    ax0.set_yscale('log')

    ### title

    title = data_separator.gen_title(sep.fixed_param)
    ax0.set_title(title, fontsize=20)

    ### side labels

    ax0.set_xlabel(r'$k/k_{2R}$', fontsize=30)
    ax0.set_ylabel(r'$E(k)$', fontsize=30)

    ### limits

    #ax0.set_xlim((0, gsim.lx/2./avg_radius))
    #ax0.set_ylim(())

    ### ticks

    #ax0.xaxis.set_ticks(np.linspace(0, 15, num_ticks, endpoint=True))
    #ax0.yaxis.set_ticks(np.linspace(0, uplim, num_ticks, endpoint=True))
    ax0.tick_params(axis='both', which='major', labelsize=20)

    ### legend

    ax0.legend(bbox_to_anchor=(0.65, 0., 0.65, 1.), loc=2, borderaxespad=0., \
        prop={'size': 20}, mode="expand", frameon=False)

    return fig
Ejemplo n.º 4
0
def plot_analysis(data, sep, savepdf, *args):
    """ plot the analysis data specific for this analysis"""

    fig = args[0]  # figure handle
    ax0 = args[1]  # axes handle

    ### normalize or select data

    keys = np.sort(data.keys())
    xd, yd, simd = select_data(data, keys)
    gsim = simd[simd.keys()[0]]
    avg_radius = gsim.avg_radius
    data_separator.assign_physicalvalues(sep.fixed_param, gsim)

    ### perform extra analysis

    #extract_vortex_size(xd, yd, simd, keys)

    ### plot the data

    for key in keys:

        x = xd[key]
        y = yd[key]
        sim = simd[key]

        ### curve fitting

        #popt, pcov = curve_fit(two_thirds, x[10:-300], y[10:-300])
        #yfit = two_thirds(x[10:-300], popt[0])
        #print popt[0]

        sep.legend_param.assign_physicalvalue(sim)
        label = data_separator.gen_label(sep.legend_param)
        line0 = ax0.plot(x, y, label=label, \
                         linewidth=3.0)
        #line1 = ax0.plot(x[10:-300], yfit, "--", c='grey', \
        #                 label="_nolegend_", linewidth=2.0)

    ### scales

    #ax0.set_xscale('log')
    #ax0.set_yscale('log')

    ### title

    title = data_separator.gen_title(sep.fixed_param)
    ax0.set_title(title, fontsize=20)

    ### side labels

    ax0.set_xlabel(r'r/R', fontsize=30)
    ax0.set_ylabel(r'g(r)', fontsize=30)

    ### limits

    ax0.set_xlim((0, 15.0))
    #ax0.set_xlim((0, gsim.lx/2./avg_radius))
    #ax0.set_ylim(())

    ### ticks

    #ax0.xaxis.set_ticks(np.linspace(0, 15, num_ticks, endpoint=True))
    #ax0.yaxis.set_ticks(np.linspace(0, uplim, num_ticks, endpoint=True))
    ax0.tick_params(axis='both', which='major', labelsize=20)

    ### legend

    ax0.legend(bbox_to_anchor=(0.65, 0., 0.65, 1.), loc=2, borderaxespad=0., \
        prop={'size': 20}, mode="expand", frameon=False)

    return fig