def make_plot(frame, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure()
    ax = fig.add_subplot(111, polar = True) 

    # Axis
    rmax = 1.0 # to match ApJL paper

    plot.xticks([], []) # Angles
    plot.yticks([rmax], ["%.1f" % rmax]) # Max Radius
    plot.ylim(0, rmax)

    # Data
    density = (fromfile("gasdens%d.dat" % frame).reshape(num_rad, num_theta))
    normalized_density = density / surface_density_zero

    ### Plot ###
    result = ax.pcolormesh(theta, rad, normalized_density, cmap = cmap)
    fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Annotate
    this_title = readTitle()
    plot.title("Gas Density Map at Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    # Save and Close
    plot.savefig("%s/innerDensityMap_%04d.png" % (save_directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #2
0
def make_plot():
    # Curves
    ys = sm_axes
    qs = np.array([a * (1 - e) for (a, e) in zip(ys, eccs)])

    # Data
    plot.plot(xs, ys, c = "blue", linewidth = linewidth, label = "a")
    plot.plot(xs, qs, c = "purple", alpha = alpha, linewidth = linewidth, label = "q")

    # Analytic
    plot.plot(xs, ys_analytic, c = "black", linewidth = linewidth, label = "ideal")

    # Annotate
    this_title = readTitle()
    plot.title("%s" % this_title, fontsize = fontsize + 2)
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Planet Distance ('a' or 'q')", fontsize = fontsize)

    plot.legend(loc = "upper left")

    # Limits
    mins = [min(ys), min(qs), min(ys_analytic)]
    maxes = [max(ys), max(qs), max(ys_analytic)]
    plot.ylim(min(mins)- 0.002, max(maxes) + 0.015)
    plot.xlim(0, xs[-1])

    # Save and Close
    plot.savefig("planetDistance.png", bbox_inches = 'tight')
    plot.show()

    plot.cla()
def make_plot():
    # Figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    # Curves
    plot.plot(frame_range, mass_over_time, linewidth = linewidth)
    #plot.plot(frame_range, peak_over_time, linewidth = linewidth - 1, label = "Peak")

    # Reference Lines
    plot.plot([0, frame_range[-1]], 0.10 * max_mass * np.ones(2), linewidth = 2, color = "black")
    #plot.plot([0, frame_range[-1]], 0.10 * max_peak * np.ones(2), linewidth = 1, color = "black")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Excess Mass", fontsize = fontsize)
    plot.title(this_title, fontsize = fontsize)

    #plot.legend(loc = "upper right")

    # Limits
    plot.xlim(0, frame_range[-1])
    #plot.ylim(0.0, 1.0)

    # Save + Close
    plot.savefig("excessMass.png")
    plot.show()

    plot.close()
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###

    for i, mode in enumerate(default_modes):
        alpha = 0.4
        if mode == 1:
            alpha = 1.0
        if mode == 3 or mode == 5:
            alpha = 0.7
        plot.plot(frame_range, modes_over_time[i, :], linewidth = linewidth, alpha = alpha, label = "%d" % mode)

    # Axis
    plot.xlim(0, frame_range[-1])
    plot.ylim(10**(-3.5), 10**(0.0))
    plot.yscale("log")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Vortensity Mode Amplitudes", fontsize = fontsize)
    plot.title("%s" % (this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right", bbox_to_anchor = (1.2, 1.0)) # outside of plot

    # Save and Close
    plot.savefig("fft_vortensity_modes.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot(frame, concentration_times, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###
    result = plot.pcolormesh(rad[1:], theta, np.transpose(np.log(concentration_times)), cmap = cmap)

    cbar = fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Axis
    plot.xlim(1.0, 2.5)
    
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize = fontsize + 2)
    plot.ylabel("Dust Concentration Maps", fontsize = fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    # Save and Close
    plot.savefig("%s/dust_concentration_map_%04d.png" % (directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #6
0
def make_plot(frame, radii, wave_locations, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    # Data
    #kernel_size = 5
    #smoothed_wave_locations = smooth(wave_locations, kernel_size)

    # Curves
    plot.plot(radii, wave_locations, linewidth = linewidth)

    # Axis
    plot.xlim(radii[0], radii[-1])

    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize = fontsize)
    plot.ylabel(r"$\phi$", fontsize = fontsize)
    plot.title("Sprial Wave Location at Orbit %d\n%s" % (orbit, this_title), fontsize = fontsize + 1)

    # Save and Close
    plot.savefig("%s/sprialWave_%04d.png" % (save_directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #7
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin1D"]) - 0.05, float(fargo_par["Rmax1D"]) + 0.05)
            plot.ylim(0, 5.0)
            xlabel = "Radius"
            
        # Data
        averagedDensity = (np.loadtxt("gasdens.ascii_rad.%d.dat" % frame))[:, 1] / surface_density

        ### Plot ###
        plot.plot(x, averagedDensity, linewidth = linewidth, label = "%d" % frame)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel("1-D Density", fontsize = fontsize)
        plot.title("%s" % this_title, fontsize = fontsize + 1)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            #plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]) - 0.05, float(fargo_par["Rmax"]) + 0.05)
            #plot.ylim(0, 5.0)
            xlabel = "Radius"
            
        # Data
        vrad = (fromfile("gasvrad%d.dat" % i).reshape(num_rad, num_theta))
        averaged_vrad = np.average(vrad, axis = 1)

        ### Plot ###
        plot.plot(x, averaged_vrad, linewidth = linewidth, label = "%d" % frame)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel(r"Azimuthally Averaged $V_{rad}$", fontsize = fontsize)
        plot.title("%s" % this_title, fontsize = fontsize + 1)
def make_radial_extent_plot():
    # Figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    # Curves
    plot.plot(frame_range, r_widths0, linewidth = linewidth, label = "0.05")
    plot.plot(frame_range, r_widths1, linewidth = linewidth, label = "0.1")
    plot.plot(frame_range, r_widths2, linewidth = linewidth, label = "0.2")
    plot.plot(frame_range, r_widths5, linewidth = linewidth, label = "0.5")
    plot.plot(frame_range, r_widths10, linewidth = linewidth, label = "1.0")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Radial Extents", fontsize = fontsize)
    plot.title(this_title, fontsize = fontsize)

    plot.legend(loc = "upper left")

    # Limits
    plot.xlim(0, frame_range[-1])
    #plot.ylim(0.0, 1.0)

    # Save + Close
    plot.savefig("radial_extents.png")
    plot.show()

    plot.close()
예제 #10
0
def make_plot():
    # Data
    xs = np.array(times)
    ys = np.array(vortex_masses)

    # Curves
    plot.plot(xs, ys, linewidth=linewidth)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel("Vortex Mass", fontsize=fontsize)
    plot.title("Mass Tapering: %d, Title: %s" % (mass_taper, this_title),
               fontsize=fontsize + 1)

    # Limits
    plot.xlim(xs[0], xs[-1])
    plot.xscale("log")
    plot.yscale("log")

    # Save + Close
    plot.savefig("vortexMass.png")
    plot.show()

    plot.close()
def make_plot():
    # Figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    # Curves
    plot.plot(frame_range, track99, linewidth=linewidth, label="99")
    plot.plot(frame_range, track90, linewidth=linewidth, label="90")
    plot.plot(frame_range, track75, linewidth=linewidth, label="75")
    plot.plot(frame_range, track50, linewidth=linewidth, label="50")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel("Dust Density", fontsize=fontsize)
    plot.title(this_title, fontsize=fontsize)

    plot.legend(loc="upper left")

    # Limits
    plot.xlim(0, frame_range[-1])
    #plot.ylim(0.0, 1.0)

    # Save + Close
    plot.savefig("quartiles.png")
    plot.show()

    plot.close()
예제 #12
0
def make_plot():
    # Curves
    ys = sm_axes
    qs = np.array([a * (1 - e) for (a, e) in zip(ys, eccs)])

    # Data
    plot.plot(xs, ys, c="blue", linewidth=linewidth, label="a")
    plot.plot(xs, qs, c="purple", alpha=alpha, linewidth=linewidth, label="q")

    # Analytic
    plot.plot(xs, ys_analytic, c="black", linewidth=linewidth, label="ideal")

    # Annotate
    this_title = readTitle()
    plot.title("%s" % this_title, fontsize=fontsize + 2)
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel("Planet Distance ('a' or 'q')", fontsize=fontsize)

    plot.legend(loc="upper left")

    # Limits
    mins = [min(ys), min(qs), min(ys_analytic)]
    maxes = [max(ys), max(qs), max(ys_analytic)]
    plot.ylim(min(mins) - 0.002, max(maxes) + 0.015)
    plot.xlim(0, xs[-1])

    # Save and Close
    plot.savefig("planetDistance.png", bbox_inches='tight')
    plot.show()

    plot.cla()
def make_aspect_ratio_plot():
    # Figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    # Collect Data
    aspect_ratios0 = (np.pi / 180.0) * np.nan_to_num(np.array(rs) * np.array(az_widths0) / np.array(r_widths0))
    aspect_ratios1 = (np.pi / 180.0) * np.nan_to_num(np.array(rs) * np.array(az_widths1) / np.array(r_widths1))
    aspect_ratios2 = (np.pi / 180.0) * np.nan_to_num(np.array(rs) * np.array(az_widths2) / np.array(r_widths2))
    aspect_ratios5 = (np.pi / 180.0) * np.nan_to_num(np.array(rs) * np.array(az_widths5) / np.array(r_widths5))
    aspect_ratios10 = (np.pi / 180.0) * np.nan_to_num(np.array(rs) * np.array(az_widths10) / np.array(r_widths10))

    # Curves
    plot.plot(frame_range, aspect_ratios0, linewidth = linewidth, label = "0.05")
    plot.plot(frame_range, aspect_ratios1, linewidth = linewidth, label = "0.1")
    plot.plot(frame_range, aspect_ratios2, linewidth = linewidth, label = "0.2")
    plot.plot(frame_range, aspect_ratios5, linewidth = linewidth, label = "0.5")
    plot.plot(frame_range, aspect_ratios10, linewidth = linewidth, label = "1.0")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Aspect Ratios", fontsize = fontsize)
    plot.title(this_title, fontsize = fontsize)

    plot.legend(loc = "upper left")

    # Limits
    plot.xlim(0, frame_range[-1])
    #plot.ylim(0.0, 1.0)

    # Save + Close
    plot.savefig("aspect_ratios.png")
    plot.show()

    plot.close()
예제 #14
0
def make_plot(frame, inner_pressure_gradients, outer_pressure_gradients, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###
    x = np.linspace(0, 360, num_theta)
    plot.plot(x, inner_pressure_gradients, linewidth = linewidth, label = "Inner")
    plot.plot(x, outer_pressure_gradients, linewidth = linewidth, label = "Outer")

    # Axis
    angles = np.linspace(0, 360, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xticks(angles)
    plot.xlim(0, 360)
    plot.ylim(0, 1.1 * np.max(inner_pressure_gradients))

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize = fontsize + 2)
    plot.ylabel("Pressure Gradient", fontsize = fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right") # outside of plot)

    # Save and Close
    plot.savefig("%s/pressure_gradient_%04d.png" % (directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###

    for i, mode in enumerate(default_modes):
        alpha = 0.4
        if mode == 1:
            alpha = 1.0
        if mode == 3 or mode == 5:
            alpha = 0.7
        plot.plot(frame_range, modes_over_time[i, :], linewidth = linewidth, alpha = alpha, label = "%d" % mode)

    plot.plot(frame_range, single_mode_strength, color = "black", linewidth = linewidth)
    plot.plot(frame_range, np.ones(len(frame_range)), color = "black", linewidth = 1) # Reference Line at 1.0

    # Axis
    plot.xlim(0, frame_range[-1])
    plot.ylim(10**(-3.5), 10**(1.0))
    plot.yscale("log")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel(r"$\Sigma (v - v_K)$ Mode Amplitudes", fontsize = fontsize)
    plot.title("%s" % (this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right", bbox_to_anchor = (1.2, 1.0)) # outside of plot

    # Save and Close
    plot.savefig("fft_combination_modes.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot(frame, azimuthal_radii, azimuthal_profiles, show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    for radius, azimuthal_profile in zip(azimuthal_radii, azimuthal_profiles):
        plot.plot(theta, azimuthal_profile, linewidth=linewidth, alpha=alpha, label="%.3f" % radius)

    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xlim(0, 2 * np.pi)
    plot.xticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize=fontsize + 2)
    plot.ylabel("Azimuthal Density", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right", bbox_to_anchor=(1.28, 1.0))  # outside of plot)

    # Save and Close
    plot.savefig("%s/azimuthal_density_%04d.png" % (directory, frame), bbox_inches="tight", dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #17
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            #plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(
                float(fargo_par["Rmin"]) - 0.05,
                float(fargo_par["Rmax"]) + 0.05)
            #plot.ylim(0, 5.0)
            xlabel = "Radius"

        # Data
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))
        averaged_vtheta = np.average(vtheta, axis=1)

        ### Plot ###
        plot.plot(x, averaged_vtheta, linewidth=linewidth, label="%d" % frame)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel(r"Azimuthally Averaged $V_{\phi}$", fontsize=fontsize)
        plot.title("%s" % this_title, fontsize=fontsize + 1)
def make_plot(rla = True):
    # Figure
    fig = plot.figure(figsize = (8, 6)) 

    # Curves
    plot.plot(xs, outer_disk_torque, color = "blue", linewidth = linewidth, alpha = alpha)
    plot.plot(xs[start : end], torque_deviations, color = "red", linewidth = linewidth)
    plot.plot(xs[start : end], (torque_deviations / smooth_torque[start : end]) * median_torque, color = "green", linewidth = linewidth)
    
    # Limits
    plot.xlim(0, xs[-1])

    plot.yscale('log')
    plot.ylim(10**(-11), 10**(-5))

    # Annotate
    this_title = readTitle()
    plot.title(this_title, fontsize = fontsize + 2)
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Torque", fontsize = fontsize)

    # Save and Close

    plot.savefig("torqueDeviation.png", bbox_inches = 'tight')
    plot.show()

    plot.close(fig)

    ### Second Plot with just sigma_torque / torque
    plot.plot(xs[start : end], (torque_deviations / smooth_torque[start : end]), color = "green", linewidth = linewidth)

    plot.savefig("relativeTorqueDeviation.png")
    plot.show()
    plot.close(fig)
def make_plot(frame, azimuthal_radii, azimuthal_profiles, avg_half, avg_full, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###
    xs = range(len(theta[:-1]))

    for radius, azimuthal_profile in zip(azimuthal_radii, azimuthal_profiles):
        plot.plot(xs, azimuthal_profile, linewidth = linewidth, alpha = alpha, label = "%.3f" % radius)

    plot.plot(xs, avg_half, color = "black", linewidth = linewidth, alpha = 0.7, linestyle = "--")
    plot.plot(xs, avg_full, color = "black", linewidth = linewidth + 2, linestyle = "--")

    # Axis
    plot.xlim(1, 6) # Only First Six m > 0 Modes
    plot.ylim(10**(-3.5), 10**(0.0))
    plot.yscale("log")

    # Annotate
    this_title = readTitle()
    plot.xlabel("m", fontsize = fontsize)
    plot.ylabel("Azimuthal Vortensity FFT", fontsize = fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right", bbox_to_anchor = (1.28, 1.0)) # outside of plot)

    # Save and Close
    plot.savefig("%s/fft_azimuthal_vortensity_%04d.png" % (directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot(frame,
              azimuthal_radii,
              azimuthal_profiles,
              avg_half,
              avg_full,
              show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    xs = range(len(theta[:-1]))

    for radius, azimuthal_profile in zip(azimuthal_radii, azimuthal_profiles):
        plot.plot(xs,
                  azimuthal_profile,
                  linewidth=linewidth,
                  alpha=alpha,
                  label="%.3f" % radius)

    plot.plot(xs,
              avg_half,
              color="black",
              linewidth=linewidth,
              alpha=0.7,
              linestyle="--")
    plot.plot(xs,
              avg_full,
              color="black",
              linewidth=linewidth + 2,
              linestyle="--")

    # Axis
    plot.xlim(1, 6)  # Only First Six m > 0 Modes
    plot.ylim(10**(-3.5), 10**(0.0))
    plot.yscale("log")

    # Annotate
    this_title = readTitle()
    plot.xlabel("m", fontsize=fontsize)
    plot.ylabel("Azimuthal Vortensity FFT", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right",
                bbox_to_anchor=(1.28, 1.0))  # outside of plot)

    # Save and Close
    plot.savefig("%s/fft_azimuthal_vortensity_%04d.png" % (directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #21
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)
        ax = fig.add_subplot(111)

        # Axis
        angles = np.linspace(0, 2 * np.pi, 7)
        degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

        plot.ylim(0, 2 * np.pi)
        plot.yticks(angles, degree_angles)
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]), float(fargo_par["Rmax"]))
            xlabel = "Radius"

        # Data
        density = (np.loadtxt(sys.argv[2]).reshape(num_rad,
                                                   num_theta,
                                                   order="F"))
        normalized_density = (density / density_unit) / surface_density_zero

        ### Plot ###
        result = ax.pcolormesh(x,
                               theta,
                               np.transpose(normalized_density),
                               cmap=cmap)
        fig.colorbar(result)
        result.set_clim(clim[0], clim[1])

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel(r"$\phi$", fontsize=fontsize)
        plot.title("Interpolated Dust Density Map at Orbit %d\n%s" %
                   (orbit, this_title),
                   fontsize=fontsize + 1)

        # Save and Close
        plot.savefig("%s/%sinterpolatedDustDensityMap_%04d.png" %
                     (save_directory, prefix, i),
                     bbox_inches='tight',
                     dpi=my_dpi)
        if show:
            plot.show()
        plot.close(fig)  # Close Figure (to avoid too many figures)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

        # Axis
        plot.ylim(0, 1.3)
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            #plot.ylim(0, 1.3)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]), float(fargo_par["Rmax"]))
            xlabel = "Radius"

        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        normalized_density = density / surface_density_zero

        vrad = (fromfile("gasvrad%d.dat" % i).reshape(num_rad, num_theta))
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))

        vorticity = util.velocity_curl(vrad,
                                       vtheta,
                                       rad,
                                       theta,
                                       average=True,
                                       frame=ref_frame)
        vortensity = vorticity / normalized_density[1:, 1:]
        averaged_w = np.average(vortensity, axis=1)

        ### Plot ###
        plot.plot(x[1:], averaged_w, linewidth=linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel("Azimuthally Averaged Vortensity", fontsize=fontsize)
        plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

        # Save and Close
        plot.savefig("%s/%saveragedVortensity_%03d.png" %
                     (save_directory, prefix, i),
                     bbox_inches='tight',
                     dpi=my_dpi)
        if show:
            plot.show()
        plot.close(fig)  # Close Figure (to avoid too many figures)
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
    ax1 = fig.add_subplot(111)
    ax2 = ax1.twinx()

    ### Hatched Region for Quartiles ###
    ax2.fill_between(frame_range, smoothed_lower_quartiles, smoothed_upper_quartiles, color = color[1], facecolor = "None", alpha = normal_alpha * offset / 1.3, hatch = "\\")

    ### Plot ###
    ax2.plot(frame_range, vortex_avg_densities, color = color[1], linewidth = linewidth - 2, alpha = normal_alpha * offset)
    ax2.plot(frame_range, smoothed_vortex_avg_densities, color = color[1], linewidth = linewidth - 1, alpha = smooth_alpha * offset)

    ax1.plot(frame_range, vortex_azimuthal_widths, color = color[0], linewidth = linewidth - 2, alpha = normal_alpha)
    ax1.plot(frame_range, smoothed_vortex_azimuthal_widths, color = color[0], linewidth = linewidth, alpha = smooth_alpha) # Dominant Line (that is why it is last)

    # Limits
    plot.xlim(frame_range[0], frame_range[-1])

    #if np.max(smoothed_vortex_azimuthal_widths) > 180:
    #    angles = np.linspace(0, 360, 7)
    #    ax1.set_ylim(0, 360)
    #    ax1.set_yticks(angles)
    #else:
    #    angles = np.linspace(0, 180, 7)
    #    ax1.set_ylim(0, 180)
    #    ax1.set_yticks(angles)
    angles = np.linspace(0, 360, 7)
    ax1.set_ylim(0, 360)
    ax1.set_yticks(angles)

    max_density = np.max(smoothed_upper_quartiles)
    max_y = np.ceil(2.0 * max_density) / 2.0 # round up to the nearest 0.5
    ax2.set_ylim(threshold, max_y)

    # Annotate
    this_title = readTitle()
    ax1.set_xlabel("Number of Planet Orbits", fontsize = fontsize)
    ax1.set_ylabel("Azimuthal Extent", fontsize = fontsize, color = color[0])
    ax2.set_ylabel("Mean Density", fontsize = fontsize, color = color[1])
    plot.title("Vortex Properties: %s" % (this_title), fontsize = fontsize + 1)

    for tick1 in ax1.get_yticklabels():
        tick1.set_color(color[0])

    for tick2 in ax2.get_yticklabels():
        tick2.set_color(color[1])

    # Save and Close
    plot.savefig("vortex_asymmetry77_v2.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #24
0
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Data ###
    xs = range(mass_taper)

    # Measure 1: Diff Mass Accretion
    data = np.loadtxt(planet_fn)
    masses = (data[:, 5]) # Planet Mass from 0 to Mass Taper
    tapering_accretion = np.diff(masses[:mass_taper + 1])

    # Measure 2: Viscosity
    viscous_accretion = 3.0 * np.pi * surface_density * viscosity

    # Measure 3: Radial Velocity
    near_planet = 1.0
    radius_near_planet = np.searchsorted(rad, near_planet)
    
    rate = 10
    xs_vrad = range(0, mass_taper, rate)
    radial_velocity_at_planet = np.zeros(len(xs_vrad))

    for i, frame in enumerate(xs_vrad):
        vrad = (fromfile("gasvrad%d.dat" % frame).reshape(num_rad, num_theta))
        radial_velocity_at_planet[i] = np.average(vrad[radius_near_planet, :])

    radius = 1.0
    radial_accretion = 2.0 * np.pi * radius * surface_density * radial_velocity_at_planet

    # Curves
    plot.plot(xs, tapering_accretion, color = "blue", label = "taper", linewidth = linewidth)
    plot.plot([xs[0], xs[-1]], [viscous_accretion, viscous_accretion], color = "black", label = "viscous", linewidth = linewidth)
    plot.plot(xs_vrad, radial_velocity_at_planet, color = "red", label = "v_rad (+)", linewidth = linewidth) # Positive
    plot.plot(xs_vrad, -radial_velocity_at_planet, color = "orange", label = "v_rad (-)", linewidth = linewidth) # Negative

    # Limits
    plot.xlim(xs[0], xs[-1])
    plot.yscale('log')

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Orbits", fontsize = fontsize)
    plot.ylabel("Accretion Rate", fontsize = fontsize)
    plot.title("Accretion for %s" % (this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right", bbox_to_anchor = (1.36, 1.0)) # outside of plot

    # Save + Close
    plot.savefig("accretion_diagnosis.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #25
0
def make_plot():
    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)
    ax1 = fig.add_subplot(111)
    ax2 = ax1.twinx()

    ### Plot ###
    ax2.plot(frame_range,
             minimum_vortensities,
             color=color[1],
             linewidth=linewidth - 2,
             alpha=normal_alpha * offset)
    ax2.plot(frame_range,
             smoothed_minimum_vortensities,
             color=color[1],
             linewidth=linewidth - 1,
             alpha=smooth_alpha * offset)

    ax1.plot(frame_range,
             maximum_densities,
             color=color[0],
             linewidth=linewidth - 2,
             alpha=normal_alpha)
    ax1.plot(frame_range,
             smoothed_maximum_densities,
             color=color[0],
             linewidth=linewidth,
             alpha=smooth_alpha)  # Dominant Line (that is why it is last)

    # Limits
    plot.xlim(frame_range[0], frame_range[-1])

    ax1.set_ylim(0, 3.5)  # Density Range
    ax2.set_ylim(0, 0.3)  # Vortensity Range

    # Annotate
    this_title = readTitle()
    ax1.set_xlabel("Number of Planet Orbits", fontsize=fontsize)
    ax1.set_ylabel("Maximum Density", fontsize=fontsize, color=color[0])
    ax2.set_ylabel("Minimum Vortensity", fontsize=fontsize, color=color[1])
    plot.title("Vortex Properties: %s" % (this_title), fontsize=fontsize + 1)

    for tick1 in ax1.get_yticklabels():
        tick1.set_color(color[0])

    for tick2 in ax2.get_yticklabels():
        tick2.set_color(color[1])

    # Save and Close
    plot.savefig("vortex_extrema.png", bbox_inches='tight', dpi=my_dpi)
    plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
def make_plot(frame,
              azimuthal_radii,
              azimuthal_profiles_a,
              azimuthal_profiles_b,
              show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    for i, (radius, azimuthal_profile_i, azimuthal_profile_j) in enumerate(
            zip(azimuthal_radii, azimuthal_profiles_a, azimuthal_profiles_b)):
        plot.plot(theta,
                  azimuthal_profile_i,
                  linewidth=linewidth,
                  alpha=alpha,
                  c=color[i],
                  linestyle="-",
                  label="%.3f" % radius)
        plot.plot(theta,
                  azimuthal_profile_j,
                  linewidth=linewidth,
                  alpha=alpha,
                  c=color[i],
                  linestyle="-.")

    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xlim(0, 2 * np.pi)
    plot.xticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize=fontsize + 2)
    plot.ylabel("Azimuthal Density", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right",
                bbox_to_anchor=(1.28, 1.0))  # outside of plot)

    # Save and Close
    plot.savefig("%s/azimuthal_density_%04d.png" % (directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #27
0
def make_plot(frame, radial_theta, radial_profiles, show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    x_min = 1.0
    x_max = 2.5
    x_min_i = np.searchsorted(rad, x_min)
    x_max_i = np.searchsorted(rad, x_max)

    max_density = 0

    for this_theta, radial_profile in zip(radial_theta, radial_profiles):
        print this_theta
        plot.plot(rad,
                  radial_profile,
                  linewidth=linewidth,
                  alpha=alpha,
                  label="%.1f" % this_theta)

        # Store max for ylim
        this_max_density = np.max(radial_profile[x_min_i:x_max_i])
        if this_max_density > max_density:
            max_density = this_max_density

    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xlim(x_min, x_max)
    plot.ylim(0, max_density + 0.3)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize=fontsize + 2)
    plot.ylabel("Density", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right",
                bbox_to_anchor=(1.28, 1.0))  # outside of plot)

    # Save and Close
    plot.savefig("%s/radial_density_%04d.png" % (directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #28
0
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
    ax1 = fig.add_subplot(111)
    ax2 = ax1.twinx()

    ### Hatched Region for Quartiles ###
    ax2.fill_between(frame_range, smoothed_lower_quartiles, smoothed_upper_quartiles, color = color[1], facecolor = "None", alpha = normal_alpha * offset / 1.3, hatch = "\\")

    ### Plot ###
    ax2.plot(frame_range, vortex_avg_densities, color = color[1], linewidth = linewidth - 2, alpha = normal_alpha * offset)
    ax2.plot(frame_range, smoothed_vortex_avg_densities, color = color[1], linewidth = linewidth - 1, alpha = smooth_alpha * offset)

    ax1.plot(frame_range, vortex_azimuthal_widths, color = color[0], linewidth = linewidth - 2, alpha = normal_alpha)
    ax1.plot(frame_range, smoothed_vortex_azimuthal_widths, color = color[0], linewidth = linewidth, alpha = smooth_alpha) # Dominant Line (that is why it is last)

    # Limits
    plot.xlim(frame_range[0], frame_range[-1])

    #if np.max(smoothed_vortex_azimuthal_widths) > 180:
    #    angles = np.linspace(0, 360, 7)
    #    ax1.set_ylim(0, 360)
    #    ax1.set_yticks(angles)
    #else:
    #    angles = np.linspace(0, 180, 7)
    #    ax1.set_ylim(0, 180)
    #    ax1.set_yticks(angles)
    angles = np.linspace(0, 360, 7)
    ax1.set_ylim(0, 360)
    ax1.set_yticks(angles)

    ax2.set_ylim(0.0, threshold)

    # Annotate
    this_title = readTitle()
    ax1.set_xlabel("Number of Planet Orbits", fontsize = fontsize)
    ax1.set_ylabel("Azimuthal Extent", fontsize = fontsize, color = color[0])
    ax2.set_ylabel("Mean Vortensity", fontsize = fontsize, color = color[1])
    plot.title("Vortex Properties: %s" % (this_title), fontsize = fontsize + 1)

    for tick1 in ax1.get_yticklabels():
        tick1.set_color(color[0])

    for tick2 in ax2.get_yticklabels():
        tick2.set_color(color[1])

    # Save and Close
    plot.savefig("vortex_vortensity_asymmetry.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
    gs = gridspec.GridSpec(2, 1, height_ratios = [5, 11])
    ax1 = fig.add_subplot(gs[0])
    ax2 = fig.add_subplot(gs[1], sharex = ax1)

    #fig.subplots_adjust(hspace = 1)

    ### Plot ###

    for i, mode in enumerate(default_modes):
        alpha = 0.4
        if mode == 1:
            alpha = 1.0
        if mode == 3 or mode == 5:
            alpha = 0.7
        ax2.plot(frame_range, modes_over_time[i, :], linewidth = linewidth, alpha = alpha, label = "%d" % mode)

    ax2.plot([0, frame_range[-1]], 0.1 * np.ones(2), color = "black", linewidth = 1) # Reference Line at 0.1

    ax1.plot(frame_range, single_mode_strength, color = "black", linewidth = linewidth)
    #ax1.plot(frame_range, vortex_highlighter, color = "orange", linewidth = linewidth)
    ax1.plot([0, frame_range[-1]], np.ones(2), color = "black", linewidth = 1) # Reference Line at 1.0

    ax1.plot(frame_range, single_mode_concentration, color = "red", linewidth = linewidth - 1)
    ax1.plot([0, frame_range[-1]], 0.1 * np.ones(2), color = "black", linewidth = 1) # Reference Line at 0.1

    # Limits
    ax2.set_xlim(0, frame_range[-1])
    ax2.set_ylim(10**(-3.5), 10**(0.0))
    ax2.set_yscale("log")

    ax1.set_ylim(10**(-1.5), 10**(1.0))
    ax1.set_yscale("log")

    # Annotate
    this_title = readTitle()
    ax2.set_xlabel("Number of Planet Orbits", fontsize = fontsize)
    ax2.set_ylabel("Density Mode Amplitudes", fontsize = fontsize)
    ax1.set_ylabel("m = 1 Strength", fontsize = fontsize)
    ax1.set_title("%s" % (this_title), fontsize = fontsize + 1)

    ax2.legend(loc = "upper right", bbox_to_anchor = (1.2, 1.0)) # outside of plot

    # Save and Close
    plot.savefig("fft_waveless_density_modes.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
    gs = gridspec.GridSpec(2, 1, height_ratios = [5, 11])
    ax1 = fig.add_subplot(gs[0])
    ax2 = fig.add_subplot(gs[1], sharex = ax1)

    #fig.subplots_adjust(hspace = 1)

    ### Plot ###

    for i, mode in enumerate(default_modes):
        alpha = 0.4
        if mode == 1:
            alpha = 1.0
        if mode == 3 or mode == 5:
            alpha = 0.7
        ax2.plot(frame_range, modes_over_time[i, :], linewidth = linewidth, alpha = alpha, label = "%d" % mode)

    ax2.plot([0, frame_range[-1]], 0.1 * np.ones(2), color = "black", linewidth = 1) # Reference Line at 0.1

    ax1.plot(frame_range, single_mode_strength, color = "black", linewidth = linewidth)
    #ax1.plot(frame_range, vortex_highlighter, color = "orange", linewidth = linewidth)
    ax1.plot([0, frame_range[-1]], np.ones(2), color = "black", linewidth = 1) # Reference Line at 1.0

    ax1.plot(frame_range, single_mode_concentration, color = "red", linewidth = linewidth - 1)
    ax1.plot([0, frame_range[-1]], 0.1 * np.ones(2), color = "black", linewidth = 1) # Reference Line at 0.1

    # Limits
    ax2.set_xlim(0, frame_range[-1])
    ax2.set_ylim(10**(-3.5), 10**(0.0))
    ax2.set_yscale("log")

    ax1.set_ylim(10**(-1.5), 10**(1.0))
    ax1.set_yscale("log")

    # Annotate
    this_title = readTitle()
    ax2.set_xlabel("Number of Planet Orbits", fontsize = fontsize)
    ax2.set_ylabel("Density Mode Amplitudes", fontsize = fontsize)
    ax1.set_ylabel("m = 1 Strength", fontsize = fontsize)
    ax1.set_title("%s" % (this_title), fontsize = fontsize + 1)

    ax2.legend(loc = "upper right", bbox_to_anchor = (1.2, 1.0)) # outside of plot

    # Save and Close
    plot.savefig("fft_density_modes.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
예제 #31
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
        ax = fig.add_subplot(111)

        # Axis
        angles = np.linspace(0, 2 * np.pi, 7)
        degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

        plot.ylim(0, 2 * np.pi)
        plot.yticks(angles, degree_angles)
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]), float(fargo_par["Rmax"]))
            xlabel = "Radius"

        # Data
        blank_density = (fromfile("gasdens%d.dat" % blank_frame).reshape(num_rad, num_theta))
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))

        normalized_density = (density - blank_density) / surface_density_zero # Diff

        ### Plot ###
        result = ax.pcolormesh(x, theta, np.transpose(normalized_density), cmap = cmap)
        fig.colorbar(result)
        result.set_clim(clim[0], clim[1])

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel(r"$\phi$", fontsize = fontsize)
        plot.title("Gas Difference Density Map at Orbit %d (- Orbit %d)\n%s" % (orbit, blank_frame, this_title), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%sdiff_densityMap_%04d-%04d.png" % (save_directory, prefix, blank_frame, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
예제 #32
0
def make_plot(frame, show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure()
    ax = fig.add_subplot(111)

    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    plot.xlim(float(fargo_par["Rmin"]), 1.0)

    # Data
    x = rad
    density = (fromfile("gasdens%d.dat" % frame).reshape(num_rad, num_theta))
    normalized_density = density / surface_density_zero

    vrad = (fromfile("gasvrad%d.dat" % frame).reshape(num_rad, num_theta))
    vtheta = (fromfile("gasvtheta%d.dat" % frame).reshape(num_rad, num_theta))

    vorticity = curl(vrad, vtheta, rad, theta) / normalized_density[1:, 1:]

    ### Plot ###
    result = ax.pcolormesh(x, theta, np.transpose(vorticity), cmap=cmap)

    fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize=fontsize)
    plot.ylabel(r"$\phi$", fontsize=fontsize)
    plot.title("Vortensity Map at Orbit %d: %s" % (orbit, this_title),
               fontsize=fontsize + 1)

    # Save and Close
    plot.savefig("%s/vorticityMap_%03d.png" % (save_directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

        # Axis
        plot.ylim(0, 1.3)
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            #plot.ylim(0, 1.3)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]), float(fargo_par["Rmax"]))
            xlabel = "Radius"

        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        normalized_density = density / surface_density_zero

        vrad = (fromfile("gasvrad%d.dat" % i).reshape(num_rad, num_theta))
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))

        vorticity = util.velocity_curl(vrad, vtheta, rad, theta, average = True, frame = ref_frame)
        vortensity = vorticity / normalized_density[1:, 1:]
        averaged_w = np.average(vortensity, axis = 1)

        ### Plot ###
        plot.plot(x[1:], averaged_w, linewidth = linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel("Azimuthally Averaged Vortensity", fontsize = fontsize)
        plot.title("Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%saveragedVortensity_%03d.png" % (save_directory, prefix, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot(frame, radial_theta, radial_profiles, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

    ### Plot ###
    x_min = 1.0
    x_max = 2.5
    x_min_i = np.searchsorted(rad, x_min)
    x_max_i = np.searchsorted(rad, x_max)

    max_pressure = 0

    for this_theta, radial_profile in zip(radial_theta, radial_profiles):
        print this_theta
        plot.plot(rad, radial_profile, linewidth = linewidth, alpha = alpha, label = "%.1f" % this_theta)

        # Store max for ylim
        this_max_pressure = np.max(radial_profile[x_min_i : x_max_i])
        if this_max_pressure > max_pressure:
            max_pressure = this_max_pressure


    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xlim(x_min, x_max)
    plot.ylim(0, 1.1 * max_pressure)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize = fontsize + 2)
    plot.ylabel("Pressure", fontsize = fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    plot.legend(loc = "upper right", bbox_to_anchor = (1.28, 1.0)) # outside of plot)

    # Save and Close
    plot.savefig("%s/radial_pressure_%04d.png" % (directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            #plot.xlim(0, x[-1])
            plot.xlim(0.5, 2.0)
            plot.ylim(0, 0.02)
            xlabel = "Radius"

        # Data
        density = (fromfile("gasddens%d.dat" % i).reshape(num_rad, num_theta))
        averagedDensity = np.average(density, axis=1) / surface_density

        ### Plot ###
        plot.plot(x, averagedDensity, linewidth=linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel("Azimuthally-Averaged\n Normalized Density",
                    fontsize=fontsize)
        #plot.title(r"$t = %d$ $\rm{orbits}$: %s" % (orbit, this_title), fontsize = fontsize + 1)
        plot.title(r"$t = %d$ $\rm{orbits}$" % (orbit), fontsize=fontsize + 1)

        # Save and Close
        plot.savefig("%s/%savg_dust_density_%04d.png" %
                     (save_directory, prefix, i),
                     bbox_inches='tight',
                     dpi=my_dpi)
        if show:
            plot.show()
        plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #36
0
def make_plot(rla=True):
    # Figure
    fig = plot.figure(figsize=(8, 6))

    # Curves
    plot.plot(xs,
              outer_disk_torque,
              color="blue",
              linewidth=linewidth,
              alpha=alpha)
    plot.plot(xs[start:end],
              torque_deviations,
              color="red",
              linewidth=linewidth)
    plot.plot(xs[start:end],
              (torque_deviations / smooth_torque[start:end]) * median_torque,
              color="green",
              linewidth=linewidth)

    # Limits
    plot.xlim(0, xs[-1])

    plot.yscale('log')
    plot.ylim(10**(-11), 10**(-5))

    # Annotate
    this_title = readTitle()
    plot.title(this_title, fontsize=fontsize + 2)
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel("Torque", fontsize=fontsize)

    # Save and Close

    plot.savefig("torqueDeviation.png", bbox_inches='tight')
    plot.show()

    plot.close(fig)

    ### Second Plot with just sigma_torque / torque
    plot.plot(xs[start:end], (torque_deviations / smooth_torque[start:end]),
              color="green",
              linewidth=linewidth)

    plot.savefig("relativeTorqueDeviation.png")
    plot.show()
    plot.close(fig)
예제 #37
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
        ax = fig.add_subplot(111, polar = True)

        # Axis
        if axis == "zoom":
            prefix = "zoom_"
            rmax = 2.4 # to match ApJL paper
        else:
            prefix = ""
            rmax = float(fargo_par["Rmax"])

        plot.xticks([], []) # Angles
        plot.yticks([rmax], ["%.1f" % rmax]) # Max Radius
        plot.ylim(0, rmax)

        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        normalized_density = density / surface_density_zero

        vrad = (fromfile("gasvrad%d.dat" % i).reshape(num_rad, num_theta))
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))

        vorticity = util.velocity_curl(vrad, vtheta, rad, theta) / normalized_density[1:, 1:]

        ### Plot ###
        result = ax.pcolormesh(theta, rad, vorticity, cmap = cmap)
    
        fig.colorbar(result)
        result.set_clim(clim[0], clim[1])

        # Annotate
        this_title = readTitle()
        plot.title("Vortensity Map at Orbit %d\n%s" % (orbit, this_title), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%svortensityMap_%03d.png" % (save_directory, prefix, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
예제 #38
0
def make_plot(frame, show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure()
    ax = fig.add_subplot(111)

    # Axis
    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    plot.xlim(float(fargo_par["Rmin"]), 1.0)

    # Data
    x = rad
    density = (fromfile("gasdens%d.dat" % frame).reshape(num_rad, num_theta))
    normalized_density = density / surface_density_zero

    vrad = (fromfile("gasvrad%d.dat" % frame).reshape(num_rad, num_theta))
    vtheta = (fromfile("gasvtheta%d.dat" % frame).reshape(num_rad, num_theta))

    vorticity = curl(vrad, vtheta, rad, theta) / normalized_density[1:, 1:]

    ### Plot ###
    result = ax.pcolormesh(x, theta, np.transpose(vorticity), cmap = cmap)

    fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize = fontsize)
    plot.ylabel(r"$\phi$", fontsize = fontsize)
    plot.title("Vortensity Map at Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    # Save and Close
    plot.savefig("%s/vorticityMap_%03d.png" % (save_directory, frame), bbox_inches = 'tight', dpi = my_dpi)
    if show:
        plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)
def make_plot():
    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###

    for i, mode in enumerate(default_modes):
        alpha = 0.4
        if mode == 1:
            alpha = 1.0
        if mode == 3 or mode == 5:
            alpha = 0.7
        plot.plot(frame_range,
                  modes_over_time[i, :],
                  linewidth=linewidth,
                  alpha=alpha,
                  label="%d" % mode)

    plot.plot(frame_range,
              single_mode_strength,
              color="black",
              linewidth=linewidth)
    plot.plot(frame_range,
              np.ones(len(frame_range)),
              color="black",
              linewidth=1)  # Reference Line at 1.0

    # Axis
    plot.xlim(0, frame_range[-1])
    plot.ylim(10**(-3.5), 10**(1.0))
    plot.yscale("log")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel(r"$\Sigma (v - v_K)$ Mode Amplitudes", fontsize=fontsize)
    plot.title("%s" % (this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right",
                bbox_to_anchor=(1.2, 1.0))  # outside of plot

    # Save and Close
    plot.savefig("fft_combination_modes.png", bbox_inches='tight', dpi=my_dpi)
    plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #40
0
def make_plot():
    # Curves
    ys = masses / float(fargo_par["PlanetMass"])
    plot.plot(xs, ys, linewidth = linewidth)

    # Annotate
    this_title = readTitle()
    plot.title("%s" % this_title, fontsize = fontsize + 2)
    plot.xlabel("Timestep", fontsize = fontsize)
    plot.ylabel("Planet Mass / Initial Mass", fontsize = fontsize)

    # Limits
    #plot.ylim(1, 1.05)

    # Save and Close
    plot.savefig("planetMass.png", bbox_inches = 'tight')
    plot.show()

    plot.cla()
예제 #41
0
def make_plot():
    # Curves
    ys = masses / float(fargo_par["PlanetMass"])
    plot.plot(xs, ys, linewidth = linewidth)

    # Annotate
    this_title = readTitle()
    plot.title("%s" % this_title, fontsize = fontsize + 2)
    plot.xlabel("Orbit", fontsize = fontsize)
    plot.ylabel("Planet Mass / Initial Mass", fontsize = fontsize)

    # Limits
    #plot.ylim(1, 1.05)

    # Save and Close
    plot.savefig("planetMass.png", bbox_inches = 'tight')
    plot.show()

    plot.cla()
예제 #42
0
def make_map_plot(frame):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Data
    inner_disk_index = np.searchsorted(rad, inner_disk_rad)
    outer_disk_index = np.searchsorted(rad, outer_disk_rad)

    xs = rad[inner_disk_index:outer_disk_index]
    vortex_map = map_one_vortex(frame) / surface_density_zero

    # Set up figure
    fig = plot.figure()
    ax = fig.add_subplot(111)

    # Curves
    result = ax.pcolormesh(xs, theta, np.transpose(vortex_map), cmap=cmap)
    fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Limits
    plot.xlim(inner_disk_rad, outer_disk_rad)

    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize=fontsize)
    plot.ylabel(r"$\phi$", fontsize=fontsize)
    plot.title("Vortex Map at Orbit %d: %s" % (orbit, this_title),
               fontsize=fontsize + 1)

    # Save + Close
    plot.savefig("%s/vortexMass_%04d.png" % (save_directory, frame))
    plot.show()

    plot.close(fig)
예제 #43
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            #plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            xlabel = "Radius"

        # Data
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))
        averaged_vtheta = np.average(vtheta, axis=1)

        ### Plot ###
        plot.plot(x, averaged_vtheta, linewidth=linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel(r"Azimuthally Averaged $V_{\phi}$", fontsize=fontsize)
        plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

        # Save and Close
        plot.savefig("%s/%savg_theta_velocity_%04d.png" %
                     (save_directory, prefix, i),
                     bbox_inches='tight',
                     dpi=my_dpi)
        if show:
            plot.show()
        plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #44
0
def make_map_plot(frame):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Data
    inner_disk_index = np.searchsorted(rad, inner_disk_rad)
    outer_disk_index = np.searchsorted(rad, outer_disk_rad)

    xs = rad[inner_disk_index : outer_disk_index]
    vortex_map = map_one_vortex(frame) / surface_density_zero

    # Set up figure
    fig = plot.figure()
    ax = fig.add_subplot(111)

    # Curves
    result = ax.pcolormesh(xs, theta, np.transpose(vortex_map), cmap = cmap)
    fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Limits
    plot.xlim(inner_disk_rad, outer_disk_rad)

    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize = fontsize)
    plot.ylabel(r"$\phi$", fontsize = fontsize)
    plot.title("Vortex Map at Orbit %d: %s" % (orbit, this_title), fontsize = fontsize + 1)

    # Save + Close
    plot.savefig("%s/vortexMass_%04d.png" % (save_directory, frame))
    plot.show()

    plot.close(fig)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(0, x[-1])
            xlabel = "Radius"
            
        # Data
        stoppingTimes = (fromfile("gasTStop%d.dat" % i).reshape(num_rad, num_theta))
        avgStoppingTimes = np.average(stoppingTimes, axis = 1)
        medianStoppingTimes = np.median(stoppingTimes, axis = 1)

        ### Plot ###
        plot.plot(x, avgStoppingTimes, linewidth = linewidth)
        plot.plot(x, medianStoppingTimes, linewidth = linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel("Mean and Median\n Stopping Times", fontsize = fontsize)
        plot.title("%s:\n" % (this_title) + "t = %d orbits" % (orbit), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%savg_stopping_times_%04d.png" % (save_directory, prefix, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
        ax = fig.add_subplot(111, polar = True) 

        # Axis
        if axis == "zoom":
            prefix = "zoom_"
            rmax = 2.4 # to match ApJL paper
        else:
            prefix = ""
            rmax = float(fargo_par["Rmax"])

        plot.xticks([], []) # Angles
        plot.yticks([rmax], ["%.1f" % rmax]) # Max Radius
        plot.ylim(0, rmax)

        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        normalized_density = density / surface_density_zero

        ### Plot ###
        result = ax.pcolormesh(theta, rad, normalized_density, cmap = cmap)
        fig.colorbar(result)
        result.set_clim(clim[0], clim[1])

        # Annotate
        this_title = readTitle()
        plot.title("Gas Density Map at Orbit %d\n%s" % (orbit, this_title), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%sdensityMap_%03d.png" % (save_directory, prefix, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
예제 #47
0
def make_plot():
    # Data
    xs = np.array(times)
    ys = np.array(strengths)

    # Curves
    plot.plot(xs, ys, linewidth=linewidth)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize=fontsize)
    plot.ylabel("Peak Strength", fontsize=fontsize)
    plot.title(this_title, fontsize=fontsize)

    # Limits
    plot.xlim(xs[0], xs[-1])

    # Save + Close
    plot.savefig("peakStrength.png")
    plot.show()

    plot.close()
예제 #48
0
def make_plot(frame,
              inner_pressure_gradients,
              outer_pressure_gradients,
              show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    x = np.linspace(0, 360, num_theta)
    plot.plot(x, inner_pressure_gradients, linewidth=linewidth, label="Inner")
    plot.plot(x, outer_pressure_gradients, linewidth=linewidth, label="Outer")

    # Axis
    angles = np.linspace(0, 360, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.xticks(angles)
    plot.xlim(0, 360)
    plot.ylim(0, 1.1 * np.max(inner_pressure_gradients))

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize=fontsize + 2)
    plot.ylabel("Pressure Gradient", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    plot.legend(loc="upper right")  # outside of plot)

    # Save and Close
    plot.savefig("%s/pressure_gradient_%04d.png" % (directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
예제 #49
0
def make_plot():
    # Data
    xs = np.array(times)
    ys = np.array(strengths)

    # Curves
    plot.plot(xs, ys, linewidth = linewidth)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Peak Strength", fontsize = fontsize)
    plot.title(this_title, fontsize = fontsize)

    # Limits
    plot.xlim(xs[0], xs[-1])

    # Save + Close
    plot.savefig("peakStrength.png")
    plot.show()

    plot.close()
예제 #50
0
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(0, x[-1])
            xlabel = "Radius"
            
        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        averagedDensity = np.average(density, axis = 1) / surface_density

        ### Plot ###
        plot.plot(x, averagedDensity, linewidth = linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel("Azimuthally-Averaged\n Normalized Density", fontsize = fontsize)
        plot.title(r"$t = %d$ $\rm{orbits}: %s" % (orbit, this_title), fontsize = fontsize + 1)

        # Save and Close
        plot.savefig("%s/%savg_density_%04d.png" % (save_directory, prefix, i), bbox_inches = 'tight', dpi = my_dpi)
        if show:
            plot.show()
        plot.close(fig) # Close Figure (to avoid too many figures)
예제 #51
0
def make_plot(frame, concentration_times, show=False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Set up figure
    fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

    ### Plot ###
    result = plot.pcolormesh(rad[1:],
                             theta,
                             np.transpose(np.log(concentration_times)),
                             cmap=cmap)

    cbar = fig.colorbar(result)
    result.set_clim(clim[0], clim[1])

    # Axis
    plot.xlim(1.0, 2.5)

    angles = np.linspace(0, 2 * np.pi, 7)
    degree_angles = ["%d" % d_a for d_a in np.linspace(0, 360, 7)]

    plot.ylim(0, 2 * np.pi)
    plot.yticks(angles, degree_angles)

    # Annotate
    this_title = readTitle()
    plot.xlabel(r"$\phi$", fontsize=fontsize + 2)
    plot.ylabel("Dust Concentration Maps", fontsize=fontsize)
    plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

    # Save and Close
    plot.savefig("%s/dust_concentration_map_%04d.png" % (directory, frame),
                 bbox_inches='tight',
                 dpi=my_dpi)
    if show:
        plot.show()
    plot.close(fig)  # Close Figure (to avoid too many figures)
def add_to_plot(frame, choice = "normal", show = False):
    # Orbit Number
    time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
    orbit = int(round(time / (2 * np.pi), 0)) * frame

    # Axis
    x = rad
    prefix = ""
    plot.xlim(float(fargo_par["Rmin1D"]) - 0.05, 1.0)
    plot.ylim(0, 5.0)
        
    # Data
    averagedDensity = (np.loadtxt("gasdens.ascii_rad.%d.dat" % frame))[:, 1] / surface_density

    ### Plot ###
    plot.plot(x, averagedDensity, linewidth = linewidth, label = "%d" % frame)

    # Annotate
    this_title = readTitle()
    plot.xlabel("Radius", fontsize = fontsize)
    plot.ylabel("1-D Density", fontsize = fontsize)
    plot.title("%s" % this_title, fontsize = fontsize + 1)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40) # to match the ApJL paper
            #plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            plot.xlim(float(fargo_par["Rmin"]) - 0.05, float(fargo_par["Rmax"]) + 0.05)
            #plot.ylim(0, 5.0)
            xlabel = "Radius"
            
        # Data
        density = (fromfile("gasdens%d.dat" % i).reshape(num_rad, num_theta))
        normalized_density = density / surface_density_zero

        vrad = (fromfile("gasvrad%d.dat" % i).reshape(num_rad, num_theta))
        vtheta = (fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta))

        vorticity = util.velocity_curl(vrad, vtheta, rad, theta, average = True, frame = ref_frame)
        vortensity = vorticity / normalized_density[1:, 1:]
        averaged_w = np.average(vortensity, axis = 1)

        ### Plot ###
        plot.plot(x, averaged_w, linewidth = linewidth, label = "%d" % frame)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize = fontsize)
        plot.ylabel(r"Azimuthally Averaged Vortensity", fontsize = fontsize)
        plot.title("%s" % this_title, fontsize = fontsize + 1)
    def choose_axis(i, axis):
        # Orbit Number
        time = float(fargo_par["Ninterm"]) * float(fargo_par["DT"])
        orbit = int(round(time / (2 * np.pi), 0)) * i

        # Set up figure
        fig = plot.figure(figsize=(700 / my_dpi, 600 / my_dpi), dpi=my_dpi)

        # Axis
        if axis == "zoom":
            x = (rad - 1) / scale_height
            prefix = "zoom_"
            plot.xlim(0, 40)  # to match the ApJL paper
            # plot.ylim(0, 1.2)
            xlabel = r"($r - r_p$) $/$ $h$"
        else:
            x = rad
            prefix = ""
            xlabel = "Radius"

        # Data
        vtheta = fromfile("gasvtheta%d.dat" % i).reshape(num_rad, num_theta)
        averaged_vtheta = np.average(vtheta, axis=1)

        ### Plot ###
        plot.plot(x, averaged_vtheta, linewidth=linewidth)

        # Annotate
        this_title = readTitle()
        plot.xlabel(xlabel, fontsize=fontsize)
        plot.ylabel(r"Azimuthally Averaged $V_{\phi}$", fontsize=fontsize)
        plot.title("Orbit %d: %s" % (orbit, this_title), fontsize=fontsize + 1)

        # Save and Close
        plot.savefig("%s/%savg_theta_velocity_%04d.png" % (save_directory, prefix, i), bbox_inches="tight", dpi=my_dpi)
        if show:
            plot.show()
        plot.close(fig)  # Close Figure (to avoid too many figures)
def make_plot():
    # Data
    xs = np.array(times)

    # Curves
    plot.plot(xs, peaks, c = "blue", linewidth = linewidth, label = r"$\rho_{peak}$")
    #plot.plot(xs, sigmas, c = "red", linewidth = linewidth - 1, alpha = alpha, label = r"$\sigma$")
    #plot.plot(xs, zone_sigmas, c = "green", linewidth = linewidth - 1, alpha = alpha, label = r"$\sigma_{zone}$")

    # Annotate
    this_title = readTitle()
    plot.xlabel("Number of Planet Orbits", fontsize = fontsize)
    plot.ylabel("Peak Density", fontsize = fontsize)
    plot.title(this_title, fontsize = fontsize)

    # Limits
    plot.xlim(xs[0], xs[-1])

    # Save + Close
    plot.savefig("peakDensityOverTime.png")
    plot.show()

    plot.close()
예제 #56
0
def make_plot():
    # Set up figure
    fig = plot.figure(figsize = (700 / my_dpi, 600 / my_dpi), dpi = my_dpi)
    ax1 = fig.add_subplot(111)
    ax2 = ax1.twinx()

    ### Plot ###
    ax2.plot(frame_range, minimum_vortensities, color = color[1], linewidth = linewidth - 2, alpha = normal_alpha * offset)
    ax2.plot(frame_range, smoothed_minimum_vortensities, color = color[1], linewidth = linewidth - 1, alpha = smooth_alpha * offset)

    ax1.plot(frame_range, maximum_densities, color = color[0], linewidth = linewidth - 2, alpha = normal_alpha)
    ax1.plot(frame_range, smoothed_maximum_densities, color = color[0], linewidth = linewidth, alpha = smooth_alpha) # Dominant Line (that is why it is last)

    # Limits
    plot.xlim(frame_range[0], frame_range[-1])

    ax1.set_ylim(0, 3.5) # Density Range
    ax2.set_ylim(0, 0.3) # Vortensity Range

    # Annotate
    this_title = readTitle()
    ax1.set_xlabel("Number of Planet Orbits", fontsize = fontsize)
    ax1.set_ylabel("Maximum Density", fontsize = fontsize, color = color[0])
    ax2.set_ylabel("Minimum Vortensity", fontsize = fontsize, color = color[1])
    plot.title("Vortex Properties: %s" % (this_title), fontsize = fontsize + 1)

    for tick1 in ax1.get_yticklabels():
        tick1.set_color(color[0])

    for tick2 in ax2.get_yticklabels():
        tick2.set_color(color[1])

    # Save and Close
    plot.savefig("vortex_extrema.png", bbox_inches = 'tight', dpi = my_dpi)
    plot.show()
    plot.close(fig) # Close Figure (to avoid too many figures)