Exemple #1
0
 def setup_isochrone(self):
     isochrone = self.isochrone
     for b in self.bands:
         isochrone[b + 'flux'] = 10**(isochrone['hsc_' + b] / -2.5)
     # Select a minimum mass for the stochastic component
     self.minmass_stochastic = min(
         1.0, isochrone['initial_mass'][isochrone['phase'] < 0.1][-1])
     # Compute the fraction of the total mass in the stochastic component (the rest will be in the smooth component)
     self.imf = imf.Kroupa(mmin=0.1,
                           mmax=120,
                           p1=0.3,
                           p2=1.3,
                           p3=2.3,
                           break1=0.08,
                           break2=0.5)
     self.imf.normalize()
     mmax = 200
     self.stochastic_mass_fraction = (
         self.imf.m_integrate(self.minmass_stochastic, mmax)[0] /
         self.imf.m_integrate(self.imf.mmin, mmax)[0])
     m = isochrone['initial_mass']
     dn_dm = self.imf(m)
     self.smooth_flux = {}
     selection = isochrone['initial_mass'] <= self.minmass_stochastic
     for b in self.bands:
         self.smooth_flux[b] = integrate.simps(
             m[selection],
             isochrone[b + 'flux'][selection] * dn_dm[selection])
def make_plot_with_mw_and_gal_ocs(savefig=False):

    xmin=0.1
    xmax=3000

    plt.figure(figsize=(12, 5))
    ax1 = plt.gca()

    ax2 = ax1.twinx()
    import imf
    x = np.logspace(-3, 2, 100)
    kroupa = imf.Kroupa(mmin=1e-3, mmax=1e1)

    yk = kroupa(x) * x
    plt.loglog(x*0.5e3, yk, c="k", ls=":", alpha=0.3)
    plt.ylim(ymax=1)
    plt.gca().get_yaxis().set_visible(False)

    plt.sca(ax1)
    plot_notable_galaxy_distances(end=-1)
    plot_with_combined_mwocs_galocs_table()
    plt.semilogx()
    plt.xlim(0.1, 3000)
    plt.ylim(0, 3000)
    plt.legend(loc=2)

    ax3 = ax1.twiny()
    plot_spec_type_dropouts(xmin=xmin*1e3, xmax=xmax*1e3, lm=None)
    plt.tight_layout()

    if savefig:
        plt.savefig("young_clusters_within_2Mpc_incl_MW.pdf", format="pdf")
    plt.show()
Exemple #3
0
        pl.clf()
        cluster,yax,colors = coolplot(1000, massfunc=massfunc, log=False)
        pl.scatter(cluster, yax, c=colors, s=np.log10(cluster+3)*85,
                   linewidths=0.5, edgecolors=(0,0,0,0.25), alpha=0.95)
        pl.gca().set_xscale('log')

        masses = np.logspace(np.log10(cluster.min()), np.log10(cluster.max()),10000)

        pl.plot(masses,(massfunc(masses)),'r--',linewidth=2,alpha=0.5)
        pl.xlabel("Stellar Mass")
        pl.ylabel("dN(M)/dM")
        pl.gca().axis([min(cluster)/1.1,max(cluster)*1.1,min(yax)-0.2,max(yax)+0.5])
        pl.savefig("{0}_imf_figure_linear.png".format(name),bbox_inches='tight')

    # make one more plot, now showing a top-heavy (shallow-tail) IMF
    massfunc = imf.Kroupa(p3=1.75)
    name='KroupaTopHeavy'
    pl.figure(1, figsize=(10,8))
    pl.clf()
    cluster,yax,colors = coolplot(1000, massfunc=massfunc)
    pl.scatter(cluster, yax, c=colors, s=np.log10(cluster+3)*85,
               linewidths=0.5, edgecolors=(0,0,0,0.25), alpha=0.95)
    pl.gca().set_xscale('log')

    masses = np.logspace(np.log10(cluster.min()), np.log10(cluster.max()),10000)

    pl.plot(masses,np.log10(massfunc(masses)),'r--',linewidth=2,alpha=0.5)
    pl.xlabel("Stellar Mass")
    pl.ylabel("log(dN(M)/dM)")
    pl.gca().axis([min(cluster)/1.1,max(cluster)*1.1,min(yax)-0.2,max(yax)+0.5])
    pl.savefig("{0}_imf_figure_log.png".format(name),bbox_inches='tight', dpi=150)
Exemple #4
0
           25,
           linestyle='--',
           color='k',
           linewidth=2)
ax2.vlines(completeness_3mm * 1e3,
           0,
           25,
           linestyle='--',
           color='k',
           linewidth=2)

# now compare to a simple IMF...
import dust_emissivity
import imf
masses = np.logspace(-2, 2, 1000) * u.M_sun
probabilities = imf.Kroupa()(masses)
core_efficiency = 1 / 3.

beta = 1.5

model_fluxes_1mm_20K = dust_emissivity.dust.snuofmass(226 * u.GHz,
                                                      masses / core_efficiency,
                                                      distance=5.4 * u.kpc,
                                                      beta=beta,
                                                      temperature=20 * u.K)
model_fluxes_3mm_20K = dust_emissivity.dust.snuofmass(93 * u.GHz,
                                                      masses / core_efficiency,
                                                      distance=5.4 * u.kpc,
                                                      beta=beta,
                                                      temperature=20 * u.K)
# number not hii:
n_not_hii_gt_1pt5 = ((~hii) & (u.Quantity(core_phot_tbl['peak'], u.Jy/u.beam) > 1.5*u.mJy/u.beam)).sum()
# should be 140
print("Number of not-HII regions at flux >1.5 mJy: {0}".format(n_not_hii_gt_1pt5))
n_not_hii_mid = ((~hii) & (u.Quantity(core_phot_tbl['peak'], u.Jy/u.beam) > 1.5*u.mJy/u.beam) & ((u.Quantity(core_phot_tbl['peak'], u.Jy/u.beam) < 10*u.mJy/u.beam))).sum()
# should be 119
print("Number of not-HII regions at 10 mJy > flux >1.5 mJy: {0}".format(n_not_hii_mid))
nbright = (u.Quantity(core_phot_tbl['peak'], u.Jy/u.beam) > 10*u.mJy/u.beam).sum()
print("nbright = {0}".format(nbright))
nbright_hii = (hii & (u.Quantity(core_phot_tbl['peak'], u.Jy/u.beam) > 10*u.mJy/u.beam)).sum()
print("nbright,hii = {0}".format(nbright_hii))


# in order to produce a >10 mJy flux, a star must produce > 2e47 photons, which
# implies a star B1.5V or earlier, >10 Msun.
kroupa = imf.Kroupa()

mmax = 200
cutoff1 = 8
cutoff2 = 10
x = np.linspace(cutoff2,mmax,50000)
y = kroupa(x)
over10mean = (x*y).sum()/y.sum()
x = np.linspace(cutoff1,cutoff2,50000)
y = kroupa(x)
eighttotenmean = (x*y).sum()/y.sum()

over8fraction = (kroupa.m_integrate(cutoff1, mmax)[0] /
                 kroupa.m_integrate(kroupa.mmin, mmax)[0])
over10fraction = (kroupa.m_integrate(cutoff2, mmax)[0] /
                  kroupa.m_integrate(kroupa.mmin, mmax)[0])