Exemplo n.º 1
0
#params0 = copy.copy(g.default_params)
#params0 = {'sfr_sfms_sigma': 0.415595676119, 'mass_mstar_min': 6.0, 'opt_bands': ['u', 'g', 'r', 'i', 'z'], 'fpass_alpha0': 10.839733046599999, 'fpass_alpha1': 0.5, 'sfr_pass_pthres': 0.05, 'fpass_zeta': -0.95027169466200001, 'ms_cen_nu': -0.72, 'mass_mstar_max': 14.0, 'opt_pdf_sigma': [0.28122634653850337, 0.25232918833346546, 0.2468073941298409, 0.25273681573440887, 0.2724513351999828], 'extinction_alpha': -7.57886, 'extinction_beta': 5.3450337472999996, 'sfr_pass_beta': 0.37, 'extinction_diskfac': 10.2412022264, 'mass_mhalo_max': 16.0, 'ms_cen_sigma1': 0.56640755541800003, 'opt_offset': [-27.3176081, -25.9445857, -25.2836569, -24.981922, -24.8096689], 'opt_cross_amp': [-3.61194266, -2.70027825, -2.01635745, -1.72575487, -1.56393268], 'opt_mstar_beta': -0.000242854097, 'mhi_omegaHI': 0.0001, 'ms_cen_mu': 0.019, 'nsamp_mstar': 200, 'ms_cen_norm': 0.015185988130400001, 'opt_cross_beta': -0.262636097, 'ms_cen_gamma0': 0.56119468698499997, 'ms_cen_gamma1': -0.26, 'extinction_amp': 0.33240776116999998, 'mass_mhalo_min': 7.0, 'ms_cen_xi': 4.25, 'opt_cross_gamma': 0.290177366, 'opt_mstar_amp': 3876.55879, 'ms_cen_logM2': 11.8, 'ms_cen_logM1': 12.488922480999999, 'sfr_pass_gamma': 1.9, 'sfr_min': -9.0, 'sfr_pass_mshift': 0.0083967790705399992, 'ms_cen_sigmainf': 0.025222009908500001, 'sfr_pass_sfrmin': 1e-07, 'sfr_sfms_gamma': 1.9, 'sfr_pass_mscale': 1.0, 'sfr_sfms_mscale': 1.0, 'sfr_sfms_beta': 0.99195297218300005, 'nsamp_mhalo': 200, 'sfr_sfms_alpha1': 1.07, 'sfr_sfms_alpha0': -0.0581345697711, 'opt_pdf_mean': [-0.06587481168919591, -0.053777765775930214, -0.01854712885192855, -0.008538656095465969, -0.008732300503716532], 'nsamp_sfr': 200, 'sfr_pass_sigma': 0.011843956765499999, 'ms_cen_beta0': 1.2756497875999999, 'ms_cen_beta1': 0.17, 'opt_mstar_c': -1.0108709, 'sfr_max': 4.0, 'fpass_beta': -2.7139265055099999, 'sfr_pass_type': 'shifted sfms', 'sfr_pass_alpha1': 0.0, 'sfr_pass_alpha0': -5.0, 'mhi_vc1': 200.0, 'mhi_vc0': 50.0}

params0 = params_bf

# Set frequency scaling to be flat, so that resulting amplitude is
# band-independent (but set to be close to the current amplitude at that band)
scaled_tau0 = params0['extinction_tau0'] \
            * np.exp(-params0['extinction_kappa'] \
                     * (g.band_wavelength[BAND] - params0['extinction_lambda0']))
#params0['extinction_tau0'] = scaled_tau0
params0['extinction_kappa'] = 0.

# Load GAMA local optical LF data from Driver et al. (2012)
data_gama = []
mag_gama, Phi_gama, err_gama = like.load_gama_lf(band=BAND, h=HUBBLE)
# FIXME: Apply magnitude cut to avoid incompleteness effects
mag_gama = mag_gama[:-3]
Phi_gama = Phi_gama[:-3]
err_gama = err_gama[:-3]
#data_gama.append([mag_gama, Phi_gama, err_gama])

# Pre-calculate my halo model
pkfile = "camb_pk_z0.dat"
hm = g.HaloModel(pkfile, h=HUBBLE, om=OMEGA_M)

#-------------------------------------------------------------------------------


def optical_lumfn(obsmag, band, params, z=0.):
    """
Exemplo n.º 2
0
ax.append(P.subplot(gs[0, 0]))
ax.append(P.subplot(gs[0, 1]))
ax.append(P.subplot(gs[0, 2]))
ax.append(P.subplot(gs[1, 0]))
ax.append(P.subplot(gs[1, 1]))
ax.append(P.subplot(gs[1, 2]))
#gs.update(left=0.05, right=0.48, wspace=0.05)

for i in range(len(bands)):
    b = bands[i]
    col = colours[i]

    print "%s-band" % b

    # Load GAMA band binned luminosity fun. for this band
    gama_mag, gama_n, gama_err = like.load_gama_lf(band=b, h=0.67)

    # Calculate number density as a function of magnitude
    dndmag_sfms_dust, dndmag_pass_dust, dndmag_sfms, dndmag_pass = \
        g.optical_mag_fn_dust( hm, gama_mag, mag, band=b, z=0.,
                               params=params, include_intrinsic=True)

    # Results from my calculation
    #P.plot(mag, dndmag_sfms + dndmag_pass, color=col, lw=1.8,
    #       label="%s-band" % b)
    dndmag_th = scipy.interpolate.interp1d(mag,
                                           dndmag_sfms + dndmag_pass,
                                           kind='linear',
                                           bounds_error=False)

    #ax[i].errorbar(gama_mag, gama_n - dndmag_th(gama_mag), yerr=gama_err,
Exemplo n.º 3
0
# Set initial model parameters
#params0 = copy.copy(g.default_params)
#params0 = {'sfr_sfms_sigma': 0.38750005196600001, 'mass_mstar_min': 6.0, 'opt_bands': ['u', 'g', 'r', 'i', 'z'], 'fpass_alpha0': 10.8205970498, 'fpass_alpha1': 0.5, 'sfr_pass_pthres': 0.05, 'fpass_zeta': -1.5353087936700001, 'ms_cen_nu': -0.72, 'mass_mstar_max': 14.0, 'opt_pdf_sigma': [0.28122634653850337, 0.25232918833346546, 0.2468073941298409, 0.25273681573440887, 0.2724513351999828], 'extinction_alpha': -7.57886, 'extinction_beta': 5.4223162433100001, 'sfr_pass_beta': 0.37, 'extinction_diskfac': 13.516079320399999, 'mass_mhalo_max': 16.0, 'ms_cen_sigma1': 0.60802361084000001, 'opt_offset': [-27.3176081, -25.9445857, -25.2836569, -24.981922, -24.8096689], 'ms_cen_logM1': 12.489042828500001, 'mhi_omegaHI': 0.0001, 'ms_cen_mu': 0.019, 'nsamp_mstar': 300, 'ms_cen_norm': 0.015799159819799999, 'nsamp_mhalo': 200, 'opt_cross_beta': -0.262636097, 'ms_cen_gamma0': 0.54792407909100005, 'ms_cen_gamma1': -0.26, 'extinction_amp': 0.29403960120099998, 'mass_mhalo_min': 7.0, 'ms_cen_xi': 4.25, 'opt_cross_gamma': 0.290177366, 'opt_mstar_amp': 3876.55879, 'ms_cen_logM2': 11.8, 'opt_mstar_beta': -0.000242854097, 'sfr_pass_type': 'shifted sfms', 'sfr_min': -9.0, 'sfr_pass_mshift': 0.0053486148026400003, 'ms_cen_sigmainf': -0.031605451195699998, 'sfr_pass_alpha1': 0.0, 'sfr_sfms_gamma': 1.9, 'nsamp_sfr': 250, 'sfr_sfms_mscale': 1.0, 'sfr_sfms_beta': 1.0910253563500001, 'opt_cross_amp': [-3.61194266, -2.70027825, -2.01635745, -1.72575487, -1.56393268], 'sfr_sfms_alpha1': 1.07, 'sfr_sfms_alpha0': -0.10162165209600001, 'opt_pdf_mean': [-0.06587481168919591, -0.053777765775930214, -0.01854712885192855, -0.008538656095465969, -0.008732300503716532], 'sfr_pass_mscale': 1.0, 'sfr_pass_sigma': 0.012386348129800001, 'ms_cen_beta0': 1.29481129595, 'ms_cen_beta1': 0.17, 'opt_mstar_c': -1.0108709, 'sfr_max': 4.0, 'fpass_beta': -2.7709240453000001, 'sfr_pass_gamma': 1.9, 'sfr_pass_sfrmin': 1e-07, 'sfr_pass_alpha0': -5.0, 'mhi_vc1': 200.0, 'mhi_vc0': 50.0, 'extinction_tau0': 0.452}
from bestfit import *
params0 = params_bf

# Load 6dFGS local radio LF data from Mauch & Sadler (astro-ph/0612018)
L_radio, Phi_radio, errp_radio, errm_radio = \
               like.load_mauch_lf(fname="../lumfns/lumfunc_6dfgs.dat", h=HUBBLE)
logPhi_radio = np.log10(Phi_radio)

# Load GAMA local optical LF data from Driver et al. (2012)
data_gama = []
for BAND in BANDS:
    mag_gama, Phi_gama, err_gama = like.load_gama_lf(band=BAND, h=HUBBLE)
    # FIXME: Apply magnitude cut to avoid incompleteness effects
    mag_gama = mag_gama[:-3]
    Phi_gama = Phi_gama[:-3]
    err_gama = err_gama[:-3]
    data_gama.append([mag_gama, Phi_gama, err_gama])

# Load SDSS-GALEX stellar mass function
mstar_sdss, sf_phi_sdss, sf_errp_sdss, sf_errm_sdss, \
            qu_phi_sdss, qu_errp_sdss, qu_errm_sdss \
                             = like.load_sdss_smf(h=HUBBLE, mstar_min=MSTAR_MIN)
# Trim low-mass datapoints
mstar_sdss, sf_phi_sdss, sf_errp_sdss, sf_errm_sdss, \
qu_phi_sdss, qu_errp_sdss, qu_errm_sdss \
  = [var[4:] for var in (mstar_sdss, sf_phi_sdss, sf_errp_sdss, sf_errm_sdss,
                         qu_phi_sdss, qu_errp_sdss, qu_errm_sdss)]
Exemplo n.º 4
0
import matplotlib.cm as cm
import galaxy_model as g
import likelihoods as like
import copy, time

BAND = 'r'

# Set model parameters
params = {'sfr_sfms_sigma': 0.39597, 'mass_mstar_min': 6.0, 'opt_bands': ['u', 'g', 'r', 'i', 'z'], 'fpass_alpha0': 10.81015, 'fpass_alpha1': 0.5, 'sfr_pass_pthres': 0.05, 'fpass_zeta': -0.92929, 'ms_cen_nu': -0.72, 'mass_mstar_max': 14.0, 'opt_pdf_sigma': [0.28122634653850337, 0.25232918833346546, 0.2468073941298409, 0.25273681573440887, 0.2724513351999828], 'extinction_alpha': -7.57886, 'extinction_beta': 5.32513, 'sfr_pass_beta': 0.37, 'extinction_diskfac': 11.25638, 'mass_mhalo_max': 16.0, 'ms_cen_sigma1': 0.55174, 'opt_offset': [-27.3176081, -25.9445857, -25.2836569, -24.981922, -24.8096689], 'ms_cen_logM1': 12.49492, 'mhi_omegaHI': 0.0001, 'ms_cen_mu': 0.019, 'nsamp_mstar': 200, 'ms_cen_norm': 0.01591, 'nsamp_mhalo': 200, 'opt_cross_beta': -0.262636097, 'ms_cen_gamma0': 0.59821, 'ms_cen_gamma1': -0.26, 'extinction_amp': 0.32755, 'mass_mhalo_min': 5.0, 'ms_cen_xi': 4.25, 'opt_cross_gamma': 0.290177366, 'opt_mstar_amp': 3876.55879, 'ms_cen_logM2': 11.8, 'opt_mstar_beta': -0.000242854097, 'sfr_pass_type': 'shifted sfms', 'sfr_min': -5.0, 'sfr_pass_mshift': 0.00735, 'ms_cen_sigmainf': 0.03174, 'sfr_pass_alpha1': 0.0, 'sfr_sfms_gamma': 1.9, 'nsamp_sfr': 200, 'sfr_sfms_mscale': 1.0, 'sfr_sfms_beta': 1.03109, 'opt_cross_amp': [-3.61194266, -2.70027825, -2.01635745, -1.72575487, -1.56393268], 'sfr_sfms_alpha1': 1.07, 'sfr_sfms_alpha0': -0.05094, 'opt_pdf_mean': [-0.06587481168919591, -0.053777765775930214, -0.01854712885192855, -0.008538656095465969, -0.008732300503716532], 'sfr_pass_mscale': 1.0, 'sfr_pass_sigma': 0.16627, 'ms_cen_beta0': 1.25341, 'ms_cen_beta1': 0.17, 'opt_mstar_c': -1.0108709, 'sfr_max': 4.0, 'fpass_beta': -2.64471, 'sfr_pass_gamma': 1.9, 'sfr_pass_sfrmin': 1e-07, 'sfr_pass_alpha0': -5.0, 'mhi_vc1': 200.0, 'mhi_vc0': 50.0}

# Load my halo model
pkfile = "camb_pk_z0.dat"
hm = g.HaloModel(pkfile, h=0.67, om=0.32)

# Load GAMA luminosity function
mag_gama, Phi_gama, err_gama = like.load_gama_lf(band=BAND, h=0.67)
mag_gama = mag_gama[:-3]
Phi_gama = Phi_gama[:-3]
err_gama = err_gama[:-3]

def loglike_optical_lf(mag, phi, err, band, params, z, mphi):
    """
    Calculate log-likelihood for optical luminosity function.
    """
    #mphi = optical_lumfn(mag, band, params, z=z)
    logl = -0.5 * np.sum( (phi - mphi)**2. / err**2. )
    return logl

#-------------------------------------------------------------------------------
#P.subplot(111)
ax.append(P.subplot(gs[0, 0]))
ax.append(P.subplot(gs[0, 1]))
ax.append(P.subplot(gs[0, 2]))
ax.append(P.subplot(gs[1, 0]))
ax.append(P.subplot(gs[1, 1]))
ax.append(P.subplot(gs[1, 2]))
#gs.update(left=0.05, right=0.48, wspace=0.05)

for i in range(len(bands)):
    b = bands[i]
    col = colours[i]
    
    print "%s-band" % b
    
    # Load GAMA band binned luminosity fun. for this band
    gama_mag, gama_n, gama_err = like.load_gama_lf(band=b, h=0.67)
    
    # Calculate number density as a function of magnitude
    dndmag_sfms_dust, dndmag_pass_dust, dndmag_sfms, dndmag_pass = \
        g.optical_mag_fn_dust( hm, gama_mag, mag, band=b, z=0.,
                               params=params, include_intrinsic=True)

    # Results from my calculation
    #P.plot(mag, dndmag_sfms + dndmag_pass, color=col, lw=1.8, 
    #       label="%s-band" % b)
    dndmag_th = scipy.interpolate.interp1d(mag, dndmag_sfms + dndmag_pass, 
                                           kind='linear', bounds_error=False)
    
    #ax[i].errorbar(gama_mag, gama_n - dndmag_th(gama_mag), yerr=gama_err, 
    #           marker='.', color=col, ls='none')
    ax[i].errorbar(gama_mag, gama_n/dndmag_th(gama_mag) - 1., yerr=gama_err/dndmag_th(gama_mag),