Example #1
0
def make_plot(radius_profile, brunt_profile, mass, age):
    figure = pyplot.figure()
    semilogy(radius_profile, -brunt_profile, 'g-', label = r'convective, $N^2$ < 0')
    semilogy(radius_profile, brunt_profile, 'r-', label = r'radiative, $N^2$ > 0')
    xlabel('Radius')
    ylabel(r'$\|N^2\|$')
    pyplot.title('Brunt-Vaisala frequency squared of a {0} star at {1}'.format(mass, age))
    pyplot.legend(loc=3)
    pyplot.show()   
Example #2
0
def internal_energy_comparison_plot(radii_SE, u_SE, radii_SPH, u_SPH, figname):
    if not HAS_MATPLOTLIB:
        return
    pyplot.figure(figsize = (7, 5))
    semilogy(radii_SE.as_quantity_in(units.RSun), u_SE, 
        label='stellar evolution model')
    semilogy(radii_SPH, u_SPH, 'go', label='SPH model')
    xlabel('radius')
    ylabel('internal energy')
    pyplot.legend()
    pyplot.savefig(figname)
    print "\nPlot of internal energy profiles was saved to: ", figname
    pyplot.close()
Example #3
0
def internal_energy_comparison_plot(radii_SE, u_SE, radii_SPH, u_SPH, figname):
    if not HAS_MATPLOTLIB:
        return
    pyplot.figure(figsize=(7, 5))
    semilogy(radii_SE.as_quantity_in(units.RSun), u_SE,
             label='stellar evolution model')
    semilogy(radii_SPH, u_SPH, 'go', label='SPH model')
    xlabel('radius')
    ylabel('internal energy')
    pyplot.legend()
    pyplot.savefig(figname)
    print("\nPlot of internal energy profiles was saved to: ", figname)
    pyplot.close()
Example #4
0
def make_plot(radius_profile, brunt_profile, mass, age):
    figure = pyplot.figure()
    semilogy(radius_profile,
             -brunt_profile,
             'g-',
             label=r'convective, $N^2$ < 0')
    semilogy(radius_profile,
             brunt_profile,
             'r-',
             label=r'radiative, $N^2$ > 0')
    xlabel('Radius')
    ylabel(r'$\|N^2\|$')
    pyplot.title('Brunt-Vaisala frequency squared of a {0} star at {1}'.format(
        mass, age))
    pyplot.legend(loc=3)
    pyplot.show()
Example #5
0
def temperature_density_plot(data, mass, age):
    figure = pyplot.figure(figsize=(8, 10))
    pyplot.subplot(2, 1, 1)
    ax = pyplot.gca()
    plotT = semilogy(data["radius"], data["temperature"],
                     'r-', label=r'$T(r)$')
    xlabel('Radius')
    ylabel('Temperature')
    ax.twinx()
    plotrho = semilogy(data["radius"], data["density"],
                       'g-', label=r'$\rho(r)$')
    plots = plotT + plotrho
    labels = [one_plot.get_label() for one_plot in plots]
    ax.legend(plots, labels, loc=3)
    ylabel('Density')
    pyplot.subplot(2, 1, 2)
    semilogy(
            data["radius"], data["composition"][0],
            label=data["species_names"][0])
    semilogy(
            data["radius"], data["composition"][1],
            label=data["species_names"][1])
    semilogy(
            data["radius"], data["composition"][2],
            label=data["species_names"][2])
    semilogy(
            data["radius"], data["composition"][3],
            label=data["species_names"][3])
    semilogy(
            data["radius"], data["composition"][4],
            label=data["species_names"][4])
    pyplot.ylim(0.0, 1.0)
    xlabel('Radius')
    ylabel('Mass fraction')
    pyplot.legend()
    pyplot.suptitle('Structure of a {0} star at {1}'.format(mass, age))
    pyplot.show()
Example #6
0
def temperature_density_plot(data, mass, age):
    figure = pyplot.figure(figsize=(8, 10))
    pyplot.subplot(2, 1, 1)
    ax = pyplot.gca()
    plotT = semilogy(data["radius"],
                     data["temperature"],
                     'r-',
                     label=r'$T(r)$')
    xlabel('Radius')
    ylabel('Temperature')
    ax.twinx()
    plotrho = semilogy(data["radius"],
                       data["density"],
                       'g-',
                       label=r'$\rho(r)$')
    plots = plotT + plotrho
    labels = [one_plot.get_label() for one_plot in plots]
    ax.legend(plots, labels, loc=3)
    ylabel('Density')
    pyplot.subplot(2, 1, 2)
    semilogy(data["radius"],
             data["composition"][0],
             label=data["species_names"][0])
    semilogy(data["radius"],
             data["composition"][1],
             label=data["species_names"][1])
    semilogy(data["radius"],
             data["composition"][2],
             label=data["species_names"][2])
    semilogy(data["radius"],
             data["composition"][3],
             label=data["species_names"][3])
    semilogy(data["radius"],
             data["composition"][4],
             label=data["species_names"][4])
    pyplot.ylim(0.0, 1.0)
    xlabel('Radius')
    ylabel('Mass fraction')
    pyplot.legend()
    pyplot.suptitle('Structure of a {0} star at {1}'.format(mass, age))
    pyplot.show()