예제 #1
0
def setup_axes():
    """
	Sets up the 3x1 axis grid with the proper axis labels and ranges

	Returns
	=======
	axes :: list
		The axes objects themselves
	"""
    axes = visuals.subplots(1, 3, figsize=(21, 7))
    axes[0].set_xlabel(r"Stellar Mass [$M_\odot$]")
    axes[0].set_ylabel(r"Sr Fractional Yield [$\times10^{-7}$]")
    axes[1].set_xlabel(r"$\log_{10}(Z/Z_\odot)$")
    axes[1].set_ylabel(r"$M_\text{Sr}/M_*\ [\times10^{-8}]$")
    axes[2].set_xlabel("Time [Gyr]")
    axes[2].set_ylabel(r"$M_\text{x}/M_\text{x,final}$")
    axes[2].set_xscale("log")
    axes[0].set_ylim([-0.5, 8.5])
    axes[0].set_xlim([0.8, 6.8])
    axes[0].xaxis.set_ticks(range(1, 7))
    axes[1].set_xlim([-4.2, 0.2])
    axes[1].set_ylim([-1, 11])
    axes[2].set_xlim([0.011, 15])
    axes[2].set_ylim([0.36, 1.04])
    return axes
예제 #2
0
def setup_axes():
	"""
	Sets up the 2x2 axis grid with the proper axis labels and ranges and the
	associated insets

	Returns
	=======
	axes :: list
		The axes, indexable via axes[row number][column number]
	insets :: list
		The insets, indexable via insets[row number]
	"""
	axes = visuals.subplots(2, 2, figsize = (14, 14))
	xlabels = [["Time [Gyr]", "[Fe/H]"], ["Time [Gyr]", "Time [Gyr]"]]
	ylabels = [[r"$\dot{M}_*$ [M$_\odot$ yr$^{-1}$]", "[O/Fe]"],
		["[X/H]", "[O/Fe]"]]
	xlims = [[[-1, 16], [-1.7, 0.2]], [[-1, 16], [-1, 16]]]
	ylims = [[[-1, 13], [0.0, 0.5]], [[-0.34, 0.14], [-0.1, 0.5]]]
	for i in range(2):
		for j in range(2):
			axes[i][j].set_xlabel(xlabels[i][j])
			axes[i][j].set_ylabel(ylabels[i][j])
			axes[i][j].set_xlim(xlims[i][j])
			axes[i][j].set_ylim(ylims[i][j])
	axes[1][0].yaxis.set_ticks([-0.3, -0.2, -0.1, 0.0, 0.1])
	return axes
예제 #3
0
def setup_axes():
    """
	Sets up the 3x2 axis grid with the proper axis labels and ranges

	Returns
	=======
	axes :: list
		The axes, indexable via axes[row number][column number]
	"""
    axes = visuals.subplots(2, 3, figsize=(21, 14))
    for i in range(2):
        axes[i][0].xaxis.set_ticks([0, 2, 4, 6, 8, 10])
        axes[i][0].set_xlim([-1, 11])
        axes[i][1].set_xlim([-1.7, 0.2])
        axes[i][1].set_ylim([-0.1, 0.5])
        axes[i][2].set_xlim([-0.1, 0.5])
        axes[i][2].set_ylim([0.2, 50])
    axes[0][1].set_ylim([0.0, 0.5])
    axes[0][2].set_xlim([0.0, 0.5])
    axes[1].insert(1, visuals.append_subplot_below(axes[1][0]))
    axes[0][0].set_ylim([-1, 15])
    axes[1][0].set_ylim([-1, 7])
    axes[1][1].set_ylim([0.8, 2.2])
    visuals.set_labels_3axes(axes[0], "O")
    visuals.set_labels_4axes(axes[1], "O")
    return axes
예제 #4
0
def main():
    """
	Produces the figure and saves it as a PDF.
	"""
    ax = visuals.subplots(1, 1)
    ax.set_xlabel(r"$\log_{10}(Z/Z_\odot)$")
    ax.set_ylabel(r"$y_\text{Sr}^\text{CC}$")
    ax.set_yscale("log")
    ax.set_xlim([-4.4, 0.6])
    ax.set_ylim([3.e-13, 3.e-6])
    plot_all_yields(ax, "sr")
    plot_functional(ax, lambda x: 3.5e-8 * 10**x)
    plot_functional(ax, lambda x: 1.e-7 * (1 - m.exp(-10**(x + 1))))
    plt.tight_layout()
    plt.savefig(sys.argv[1])
    plt.clf()
예제 #5
0
def setup_axes():
    """
	Sets up the 2x1 axis grid with the proper axis labels and ranges

	Returns
	=======
	axes :: list
		The axes objects themselves
	"""
    axes = visuals.subplots(1, 2, figsize=(14, 7))
    axes[1].set_yscale("log")
    axes[0].set_xlabel("[Fe/H]")
    axes[0].set_ylabel("[Sr/Fe]")
    axes[1].set_xlabel("[Sr/Fe]")
    axes[1].set_ylabel("Stellar Probability Density")
    axes[0].set_xlim([-2.2, 0.2])
    axes[0].set_ylim([-2.4, 0.4])
    axes[1].set_xlim([-1.4, 0.4])
    axes[1].set_ylim([0.05, 50])
    return axes
예제 #6
0
def setup_axes():
    """ 
	Sets up the 3x1 axis grid with the proper axis labels and ranges 

	Returns 
	======= 
	axes :: list 
		The axes objects themselves 
	"""
    axes = visuals.subplots(1, 3, figsize=(21, 7))
    xlabels = ["Time [Gyr]", "Time [Gyr]", "[O/Fe]"]
    ylabels = ["[Fe/H]", "[O/Fe]", "Stellar Probability Density"]
    xlim = [[-1, 11], [-1, 11], [0.08, 0.22]]
    ylim = [[-0.42, -0.08], [0, 0.5], [3, 300]]
    for i in range(3):
        axes[i].set_xlabel(xlabels[i])
        axes[i].set_ylabel(ylabels[i])
        axes[i].set_xlim(xlim[i])
        axes[i].set_ylim(ylim[i])
    for i in range(2):
        axes[i].xaxis.set_ticks(range(0, 12, 2))
    axes[2].set_yscale("log")
    return axes
예제 #7
0
def setup_axes():
    """ 
	Sets up the 3x2 axis grid with the proper axis labels and ranges and the 
	associated insets 

	Returns 
	======= 
	axes :: list 
		The axes, indexable via axes[row number][column number] 
	insets :: list 
		The insets, indexable via insets[row number] 
	"""
    inset_xlim = [-0.26, -0.06]
    inset_ylim = [0.06, 0.16]
    axes = visuals.subplots(2, 3, figsize=(21, 14))
    insets = 2 * [None]
    for i in range(2):
        axes[i][0].xaxis.set_ticks(list(range(0, 12, 2)))
        axes[i][0].set_xlim([-1, 11])
        axes[i][0].set_ylim([-1, 17])
        axes[i][1].set_xlim([-1.7, 0.2])
        axes[i][1].set_ylim([0.0, 0.5])
        axes[i][2].set_xlim([0.0, 0.5])
        axes[i][2].set_ylim([0.2, 50])
        axes[i][2].set_yscale("log")
        visuals.draw_box(axes[i][1], inset_xlim, inset_ylim)
        insets[i] = visuals.zoom_box(axes[i][1],
                                     inset_xlim,
                                     inset_ylim,
                                     zoom=3.5)
    axes[0].insert(1, visuals.append_subplot_below(axes[0][0]))
    visuals.set_labels_3axes(axes[1], "O")
    visuals.set_labels_4axes(axes[0], "O")
    axes[0][0].set_ylim([2.1, 3.7])
    axes[0][1].set_ylim([1.3, 2.7])
    axes[1][0].yaxis.set_ticks(list(range(0, 18, 2)))
    return axes, insets
예제 #8
0
def setup_axes():
    """ 
	Sets up the 3x2 axis grid with the proper axis labels and ranges and the 
	associated insets 

	Returns 
	======= 
	axes :: list 
		The axes, indexable via axes[row number][column number] 
	"""
    axes = visuals.subplots(1, 3, figsize=(21, 7))
    axes.insert(1, visuals.append_subplot_below(axes[0]))
    visuals.set_labels_4axes(axes, "O")
    visuals.hide_xticklabels(axes[0])
    axes[0].set_ylim([-1, 16])
    axes[0].set_xlim([-1, 11])
    axes[1].set_ylim([1.3, 2.5])
    axes[2].set_xlim([-1.7, 0.1])
    axes[2].set_ylim([0., 0.5])
    axes[3].set_xlim([-0.1, 0.5])
    axes[3].set_ylim([0.15, 50])
    axes[1].yaxis.set_ticks([1.4, 1.6, 1.8, 2.0, 2.2, 2.4])
    axes[1].xaxis.set_ticks(list(range(0, 12, 2)))
    return axes
예제 #9
0
def setup_axes(): 
	""" 
	Sets up the 3x1 axis grid with the proper axis labels and ranges 

	Returns 
	======= 
	axes :: list 
		The axes objects themselves 
	""" 
	axes = visuals.subplots(1, 3, figsize = (21, 7)) 
	for i in range(3): 
		axes[i].set_xlim([-1.6, 0.1]) 
	plt.subplots_adjust(top = 0.9, bottom = 0.15, right = 0.97, left = 0.08) 
	# line up the middle- and right-hand panels 
	pos1 = axes[1].get_position()
	pos2 = axes[2].get_position() 
	pos1.x0 += pos2.x0 - pos1.x1 
	pos1.x1 = pos2.x0 
	axes[1].set_position(pos1) 
	axes[0].set_xlabel("[O/H]") 
	axes[0].set_ylabel("[Sr/O]") 
	axes[1].set_ylabel("[Sr/O]") 
	visuals.hide_yticklabels(axes[2]) 
	# use dummy axes to put x-axis label between the middle and right panels 
	dummy = plt.gcf().add_subplot(122, facecolor = "white", zorder = -1)   
	posd = dummy.get_position()  
	posd.x0 = pos1.x0 
	dummy.set_position(posd) 
	dummy.set_xlabel("[O/H]", labelpad = 30)
	visuals.hide_xticklabels(dummy) 
	visuals.hide_yticklabels(dummy) 
	axes[0].set_ylim([-2.7, 0.2]) 
	for i in axes[1:]: 
		i.set_xlim([-0.65, 0.1]) 
		i.set_ylim([-0.8, 0.2]) 
	return axes
예제 #10
0
    axes[0].plot(out.history["time"],
                 out.history["sfr"],
                 c=visuals.colors()[color],
                 linestyle='-')
    axes[1].plot(out.history["[Fe/H]"],
                 out.history["[O/Fe]"],
                 c=visuals.colors()[color])
    axes[2].plot(list(
        map(lambda x, y: (x + y) / 2., out.mdf["bin_edge_left"],
            out.mdf["bin_edge_right"])),
                 out.mdf["dn/d[O/Fe]"],
                 c=visuals.colors()[color])


if __name__ == "__main__":
    axes = visuals.subplots(1, 3, figsize=(21, 7))
    axes[0].xaxis.set_ticks([0, 2, 4, 6, 8, 10])
    axes[0].yaxis.set_ticks([0, 2, 4, 6, 8, 10, 12, 14, 16, 18])
    axes[0].set_xlim([-1, 11])
    axes[0].set_ylim([-1, 17])
    axes[1].set_xlim([-1.7, 0.2])
    axes[1].set_ylim([-0.1, 0.5])
    axes[2].set_xlim([-0.1, 0.5])
    axes[2].set_ylim([0.2, 50])
    visuals.set_labels_3axes(axes, "O")
    inset_xlim = [-0.26, -0.06]
    inset_ylim = [0.06, 0.16]
    visuals.draw_box(axes[1], inset_xlim, inset_ylim)
    inset = visuals.zoom_box(axes[1], inset_xlim, inset_ylim, zoom=3.8)
    plot_output_3axes(axes, "../../simulations/SFRoscil_amp0p3_per4",
                      "crimson")
예제 #11
0
    lines = 3 * [None]
    linestyles = ['-', ':', '--']
    colors = ["red", "black", "black"]
    labels = [
        "Sr", r"Fe; $R_\text{Ia}\propto t^{-1.1}$",
        r"Fe; $R_\text{Ia}\propto e^{-t/\tau_\text{Ia}}$"
    ]
    for i in range(3):
        lines[i] = ax.plot([1, 2], [1, 2],
                           c=visuals.colors()[colors[i]],
                           linestyle=linestyles[i],
                           label=labels[i])[0]
    leg = ax.legend(loc=visuals.mpl_loc()["lower left"],
                    ncol=1,
                    bbox_to_anchor=(0.01, 0.01),
                    frameon=False)
    for i in range(3):
        lines[i].remove()


if __name__ == "__main__":
    ax = visuals.subplots(1, 1)
    ax.set_xlabel("[X/H]")
    ax.set_ylabel("[O/X]")
    plot_sr_fe_tracks(ax)
    ax.set_xlim([-1.7, 0.1])
    ax.set_ylim([0., 0.6])
    plt.tight_layout()
    plt.savefig(sys.argv[1])
    plt.clf()