def initialise_model(redshift, model_name='zheng07'):

    print('Initialising HOD model: {}...'.format(model_name))

    # Default is ‘halo_mvir’
    if model_name == 'zheng07':
        model = PrebuiltHodModelFactory('zheng07',
                                        redshift=redshift,
                                        threshold=-18,
                                        prim_haloprop_key=halo_m_prop)
        model.param_dict['logMmin'] = 13.3
        model.param_dict['sigma_logM'] = 0.8
        model.param_dict['alpha'] = 1
        model.param_dict['logM0'] = 13.3
        model.param_dict['logM1'] = 13.8

    elif model_name == 'leauthaud11':
        model = PrebuiltHodModelFactory('leauthaud11',
                                        redshift=redshift,
                                        threshold=11,
                                        prim_haloprop_key=halo_m_prop)
        model.param_dict['smhm_m0_0'] = 11.5  # 10.72
        model.param_dict['smhm_m0_a'] = 0.59
        model.param_dict['smhm_m1_0'] = 13.4  # 12.35
        model.param_dict['smhm_m1_a'] = 0.3
        model.param_dict['smhm_beta_0'] = 2  # 0.43
        model.param_dict['smhm_beta_a'] = 0.18
        model.param_dict['smhm_delta_0'] = 0.1  # 0.56
        model.param_dict['smhm_delta_a'] = 0.18
        model.param_dict['smhm_gamma_0'] = 1  # 1.54
        model.param_dict['smhm_gamma_a'] = 2.52
        model.param_dict['scatter_model_param1'] = 0.2
        model.param_dict['alphasat'] = 1
        model.param_dict['betasat'] = 1.1  # 0.859
        model.param_dict['bsat'] = 11  # 10.62
        model.param_dict['betacut'] = 6  # -0.13
        model.param_dict['bcut'] = 0.01  # 1.47

    elif model_name == 'tinker13':
        model = PrebuiltHodModelFactory(
            'tinker13',
            redshift=redshift,
            threshold=11,
            prim_haloprop_key=halo_m_prop,
            quiescent_fraction_abscissa=[1e12, 1e13, 1e14, 1e15],
            quiescent_fraction_ordinates=[0.25, 0.5, 0.75, 0.9])

        model.param_dict['smhm_m0_0_active'] = 11
        model.param_dict['smhm_m0_0_quiescent'] = 10.8
        model.param_dict['smhm_m1_0_active'] = 12.2
        model.param_dict['smhm_m1_0_quiescent'] = 11.8
        model.param_dict['smhm_beta_0_active'] = 0.44
        model.param_dict['smhm_beta_0_quiescent'] = 0.32
        # model.param_dict['alphasat_active'] = 1
        # model.param_dict['alphasat_quiescent'] = 1
        # model.param_dict['betacut_active'] = 0.77
        # model.param_dict['betacut_quiescent'] = -0.12
        # model.param_dict['bcut_active'] = 0.2
        # model.param_dict['bcut_quiescent'] = 0.2
        # model.param_dict['betasat_active'] = 1.5
        # model.param_dict['betasat_quiescent'] = 0.62
        model.param_dict['bsat_active'] = 13
        model.param_dict['bsat_quiescent'] = 8

    elif model_name == 'hearin15':
        model = PrebuiltHodModelFactory('hearin15',
                                        redshift=redshift,
                                        threshold=11)
    elif model_name == 'zu_mandelbaum15':
        model = PrebuiltHodModelFactory('zheng07',
                                        redshift=redshift,
                                        threshold=-1)
    elif model_name == 'zu_mandelbaum16':
        model = PrebuiltHodModelFactory('zheng07',
                                        redshift=redshift,
                                        threshold=-1)
    elif model_name == 'cacciato09':
        model = PrebuiltHodModelFactory('cacciato09',
                                        redshift=redshift,
                                        threshold=10,
                                        prim_haloprop_key=halo_m_prop)

        model.param_dict['log_L_0'] = 9.935
        model.param_dict['log_M_1'] = 12.9  # 11.07
        model.param_dict['gamma_1'] = 0.3  # 3.273
        model.param_dict['gamma_2'] = 0.255
        model.param_dict['sigma'] = 0.143
        model.param_dict['a_1'] = 0.501
        model.param_dict['a_2'] = 2.106
        model.param_dict['log_M_2'] = 14.28
        model.param_dict['b_0'] = -0.5  # -0.766
        model.param_dict['b_1'] = 1.008
        model.param_dict['b_2'] = -0.094
        model.param_dict['delta_1'] = 0
        model.param_dict['delta_2'] = 0

    # add useful model properties here
    model.model_name = model_name  # add model_name field

    return model
Пример #2
0
def initialise_model(redshift, model_name, halo_m_prop='halo_m'):
    '''
    create an instance of halotools model class

    logMcut : The cut-off mass for the halo to host in a central galaxy. Given
    in solar mass.

    sigma_lnM : Parameter that modulates the shape of the number of
    central galaxies.

    logM1 : The scale mass for the number of satellite galaxies.

    kappa : Parameter that affects the cut-off mass for satellite galaxies.
    A detailed discussion and best-fit values of these parameters can be found
    in Zheng+2009.

    alpha : The power law index of the number of satellite galaxies.

    alpha_c : float. The central velocity bias parameter. Modulates the
    peculiar velocity of the central galaxy. The larger the absolute value of
    the parameter, the larger the peculiar velocity of the central. The sign
    of the value does not matter.

    s : The satellite profile modulation parameter. Modulates how the radial
    distribution of satellite galaxies within halos deviate from the radial
    profile of the halo. Positive value favors satellite galaxies to populate
    the outskirts of the halo whereas negative value favors satellite galaxy
    to live near the center of the halo. |s| must be < 1.

    s_v : float. The satellite velocity bias parameter. Modulates how the
    satellite galaxy peculiar velocity deviates from that of the local dark
    matter particle. Positive value favors high peculiar velocity satellite
    galaxies and vice versa. Note that our implementation preserves the
    Newton's second law of the satellite galaxies. |s| must be < 1.

    s_p : float. The perihelion distance modulation parameter. A positive
    value favors satellite galaxies to have larger distances to the halo
    center upon their closest approach to the center and vice versa. This can
    be regarded as a "fancier" satellite profile modulation parameter.
    |s| must be < 1.

    A : float. The assembly bias parameter. Introduces the effect of assembly
    bias. A positive value favors higher concentration halos to host galaxies
    whereas a negative value favors lower concentration halos to host galaxies.
    If you are invoking assembly bias decoration, i.e. a non-zero A parameter,
    you need to run gen_medianc.py first. A detailed discussion of these
    parameters can be found in Yuan et al. in prep. To turn off any of the five
    decorations, just set the corresponding parameter to 0.

    '''

    # print('Initialising HOD model: {}...'.format(model_name))

    # halotools prebiult models
    if model_name == 'matter':
        model_type = 'matter'
        model = PrebuiltHodModelFactory('zheng07',
                                        redshift=redshift,
                                        threshold=-18,
                                        prim_haloprop_key=halo_m_prop)
        model.param_dict['logMmin'] = 13.3
        model.param_dict['sigma_logM'] = 0.8
        model.param_dict['alpha'] = 1
        model.param_dict['logM0'] = 13.3
        model.param_dict['logM1'] = 13.8
    elif model_name in PrebuiltHodModelFactory.prebuilt_model_nickname_list:
        model_type = 'prebuilt'
        if model_name == 'zheng07':
            model = PrebuiltHodModelFactory('zheng07',
                                            redshift=redshift,
                                            threshold=-18,
                                            prim_haloprop_key=halo_m_prop)
            model.param_dict['logMmin'] = 13.3
            model.param_dict['sigma_logM'] = 0.8
            model.param_dict['alpha'] = 1
            model.param_dict['logM0'] = 13.3
            model.param_dict['logM1'] = 13.8

        elif model_name == 'cacciato09':
            model = PrebuiltHodModelFactory('cacciato09',
                                            redshift=redshift,
                                            threshold=10,
                                            prim_haloprop_key=halo_m_prop)

            model.param_dict['log_L_0'] = 9.935
            model.param_dict['log_M_1'] = 12.9  # 11.07
            model.param_dict['gamma_1'] = 0.3  # 3.273
            model.param_dict['gamma_2'] = 0.255
            model.param_dict['sigma'] = 0.143
            model.param_dict['a_1'] = 0.501
            model.param_dict['a_2'] = 2.106
            model.param_dict['log_M_2'] = 14.28
            model.param_dict['b_0'] = -0.5  # -0.766
            model.param_dict['b_1'] = 1.008
            model.param_dict['b_2'] = -0.094
            model.param_dict['delta_1'] = 0
            model.param_dict['delta_2'] = 0

        elif model_name == 'leauthaud11':
            model = PrebuiltHodModelFactory('leauthaud11',
                                            redshift=redshift,
                                            threshold=11,
                                            prim_haloprop_key=halo_m_prop)
            model.param_dict['smhm_m0_0'] = 11.5  # 10.72
            model.param_dict['smhm_m0_a'] = 0.59
            model.param_dict['smhm_m1_0'] = 13.4  # 12.35
            model.param_dict['smhm_m1_a'] = 0.3
            model.param_dict['smhm_beta_0'] = 2  # 0.43
            model.param_dict['smhm_beta_a'] = 0.18
            model.param_dict['smhm_delta_0'] = 0.1  # 0.56
            model.param_dict['smhm_delta_a'] = 0.18
            model.param_dict['smhm_gamma_0'] = 1  # 1.54
            model.param_dict['smhm_gamma_a'] = 2.52
            model.param_dict['scatter_model_param1'] = 0.2
            model.param_dict['alphasat'] = 1
            model.param_dict['betasat'] = 1.1  # 0.859
            model.param_dict['bsat'] = 11  # 10.62
            model.param_dict['betacut'] = 6  # -0.13
            model.param_dict['bcut'] = 0.01  # 1.47

        elif model_name == 'tinker13':
            model = PrebuiltHodModelFactory(
                'tinker13',
                redshift=redshift,
                threshold=11,
                prim_haloprop_key=halo_m_prop,
                quiescent_fraction_abscissa=[1e12, 1e13, 1e14, 1e15],
                quiescent_fraction_ordinates=[0.25, 0.5, 0.75, 0.9])

            model.param_dict['smhm_m0_0_active'] = 11
            model.param_dict['smhm_m0_0_quiescent'] = 10.8
            model.param_dict['smhm_m1_0_active'] = 12.2
            model.param_dict['smhm_m1_0_quiescent'] = 11.8
            model.param_dict['smhm_beta_0_active'] = 0.44
            model.param_dict['smhm_beta_0_quiescent'] = 0.32
            # model.param_dict['alphasat_active'] = 1
            # model.param_dict['alphasat_quiescent'] = 1
            # model.param_dict['betacut_active'] = 0.77
            # model.param_dict['betacut_quiescent'] = -0.12
            # model.param_dict['bcut_active'] = 0.2
            # model.param_dict['bcut_quiescent'] = 0.2
            # model.param_dict['betasat_active'] = 1.5
            # model.param_dict['betasat_quiescent'] = 0.62
            model.param_dict['bsat_active'] = 13
            model.param_dict['bsat_quiescent'] = 8

        elif model_name == 'hearin15':
            model = PrebuiltHodModelFactory('hearin15',
                                            redshift=redshift,
                                            threshold=11)
        elif model_name == 'zu_mandelbaum15':
            model = PrebuiltHodModelFactory('zheng07',
                                            redshift=redshift,
                                            threshold=-1)
        elif model_name == 'zu_mandelbaum16':
            model = PrebuiltHodModelFactory('zheng07',
                                            redshift=redshift,
                                            threshold=-1)
    # generalised HOD models with 5-parameter zheng07 as base model
    else:  # 'gen_base1'
        model_type = 'general'
        model = PrebuiltHodModelFactory('zheng07',
                                        redshift=redshift,
                                        threshold=-18,
                                        prim_haloprop_key=halo_m_prop)
        # five baseline parameters
        model.param_dict['logMcut'] = 13.35
        model.param_dict['sigma_lnM'] = 0.85
        model.param_dict['kappa'] = 1
        model.param_dict['logM1'] = 13.8
        model.param_dict['alpha'] = 1
        # decoration parameters
        model.param_dict['s'] = 0  # sat ranking by halo centric distance
        model.param_dict['s_v'] = 0  # sat ranking by relative speed
        model.param_dict['s_p'] = 0  # sat ranking perihelion distance
        model.param_dict['alpha_c'] = 0  # centrals velocity bias
        model.param_dict['A_cen'] = 0  # centrals assembly bias, pseudomass
        model.param_dict['A_sat'] = 0  # satellites assembly bias, pseudomass
        ''' BOOKKEEPING: DO NOT MODIFY EXISTING MODELS, CREATE NEW ONES '''

        if model_name == 'gen_base2':  # params are tweaked to produce same ND
            model.param_dict['logM1'] = 13.85
            model.param_dict['alpha'] = 1.377
        elif model_name == 'gen_base3':
            model.param_dict['logM1'] = 13.9
            model.param_dict['alpha'] = 1.663
        elif model_name == 'gen_base4':
            model.param_dict['logM1'] = 13.796
            model.param_dict['alpha'] = 0.95
        elif model_name == 'gen_base5':
            model.param_dict['logM1'] = 13.805
            model.param_dict['alpha'] = 1.05
        elif model_name == 'gen_base6':
            model.param_dict['logM1'] = 13.770
            model.param_dict['alpha'] = 0.75
        elif model_name == 'gen_base7':
            model.param_dict['logM1'] = 13.848
            model.param_dict['alpha'] = 1.25
        elif model_name == 'gen_ass1':
            model.param_dict['A_cen'] = 1
            model.param_dict['A_sat'] = 0
        elif model_name == 'gen_ass2':
            model.param_dict['A_cen'] = 0
            model.param_dict['A_sat'] = 1
        elif model_name == 'gen_ass3':
            model.param_dict['A_cen'] = 1
            model.param_dict['A_sat'] = 1
        elif model_name == 'gen_ass1_n':
            model.param_dict['A_cen'] = -1
            model.param_dict['A_sat'] = 0
        elif model_name == 'gen_ass2_n':
            model.param_dict['A_cen'] = 0
            model.param_dict['A_sat'] = -1
        elif model_name == 'gen_ass3_n':
            model.param_dict['A_cen'] = -1
            model.param_dict['A_sat'] = -1
        elif model_name == 'gen_vel1':
            model.param_dict['alpha_c'] = 1
        elif model_name == 'gen_vel2':
            model.param_dict['alpha_c'] = 0.2
        elif model_name == 'gen_s1':
            model.param_dict['s'] = 0.9
        elif model_name == 'gen_sv1':
            model.param_dict['s_v'] = 0.9
        elif model_name == 'gen_sp1':
            model.param_dict['s_p'] = 0.9
        elif model_name == 'gen_s1_n':
            model.param_dict['s'] = -0.9
        elif model_name == 'gen_sv1_n':
            model.param_dict['s_v'] = -0.9
        elif model_name == 'gen_sp1_n':
            model.param_dict['s_p'] = -0.9
        elif model_name == 'gen_allbiases':
            model.param_dict['A_cen'] = 1
            model.param_dict['A_sat'] = 1
            model.param_dict['alpha_c'] = 1
            model.param_dict['s'] = 0.9
            model.param_dict['s_v'] = 0.9
            model.param_dict['s_p'] = 0.9
        elif model_name == 'gen_allbiases_n':
            model.param_dict['A_cen'] = -1
            model.param_dict['A_sat'] = -1
            model.param_dict['alpha_c'] = 1
            model.param_dict['s'] = -0.9
            model.param_dict['s_v'] = -0.9
            model.param_dict['s_p'] = -0.9

    # add useful model properties here
    model.model_name = model_name
    model.model_type = model_type
    model.halo_m_prop = halo_m_prop

    return model