diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/behroozi10_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/behroozi10_composite_model.rst index a792a15c4..1011a6130 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/behroozi10_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/behroozi10_composite_model.rst @@ -6,22 +6,22 @@ Behroozi et al. (2010) Composite Model .. currentmodule:: halotools.empirical_models -This section of the documentation describes the basic behavior of -the ``behroozi10`` composite subhalo model. To see how this composite -model is built by the `~halotools.empirical_models.PrebuiltSubhaloModelFactory` class, -see `~halotools.empirical_models.behroozi10_model_dictionary`. +This section of the documentation describes the basic behavior of +the ``behroozi10`` composite subhalo model. To see how this composite +model is built by the `~halotools.empirical_models.PrebuiltSubhaloModelFactory` class, +see `~halotools.empirical_models.behroozi10_model_dictionary`. Overview of the Behroozi et al. (2010) Model Features ======================================================== -This subhalo-based model is an implementation of -Behroozi et al. (2010), arXiv:1001.0015. -There is a one-to-one mapping between stellar mass and subhalo mass -governed by a parameterized form for the stellar-to-halo-mass relation (SMHM). -The class where the SMHM behavior is defined is `Behroozi10SmHm`. +This subhalo-based model is an implementation of +Behroozi et al. (2010), arXiv:1001.0015. +There is a one-to-one mapping between stellar mass and subhalo mass +governed by a parameterized form for the stellar-to-halo-mass relation (SMHM). +The class where the SMHM behavior is defined is `Behroozi10SmHm`. -Building the Behroozi et al. (2010) Model +Building the Behroozi et al. (2010) Model ============================================ -You can build an instance of this model using the +You can build an instance of this model using the `~halotools.empirical_models.PrebuiltSubhaloModelFactory` class as follows: >>> from halotools.empirical_models import PrebuiltSubhaloModelFactory @@ -31,48 +31,48 @@ You can build an instance of this model using the Customizing the Behroozi et al. (2010) Model ================================================= -There are several keyword arguments you can use to customize +There are several keyword arguments you can use to customize the instance returned by the factory: -First, the ``redshift`` keyword argument must be set to the redshift of the -halo catalog you might populate with this model. +First, the ``redshift`` keyword argument must be set to the redshift of the +halo catalog you might populate with this model. >>> model = PrebuiltSubhaloModelFactory('behroozi10', redshift = 2) -It is not permissible to dynamically change the ``redshift`` -of the ``behroozi10`` composite model instance. -If you want to explore the model variations with redshift, -you should instantiate multiple models. -Or, alternatively, if you only want to study -the underlying analytical SMHM relation, and not populate mocks, -you can just build an instance of the `Behroozi10SmHm` component model -class without specifying a redshift, in which case you can -call the methods of the `Behroozi10SmHm` instance for any redshift. - -Second, the ``prim_haloprop_key`` keyword argument allows you to choose -which subhalo property regulates mean stellar mass. -In principle, you can choose any column name in the halo catalog you will -be populating, but this key should be a mass-like variable in order to get -sensible results, e.g., ``halo_mpeak``, ``halo_macc``, etc. -It is not permissible to dynamically change the ``prim_haloprop_key`` -of the ``behroozi10`` composite model instance. -If you want to explore the effects of choosing different -halo properties, you should instantiate multiple models. - -Finally, you can choose how stochasticity between halo and stellar mass is modeled -with the ``scatter_abscissa`` and ``scatter_ordinates`` keywords. -These arguments determine the level of scatter in stellar mass, given in dex. -The abscissa serve as control points and the ordinates the values of the scatter -at those control points. So, for example, if you wanted to have 0.3 dex of -scatter at :math:`M_{\rm halo} = 10^{12}M_{\odot}` and 0.1 dex of scatter +It is not permissible to dynamically change the ``redshift`` +of the ``behroozi10`` composite model instance. +If you want to explore the model variations with redshift, +you should instantiate multiple models. +Or, alternatively, if you only want to study +the underlying analytical SMHM relation, and not populate mocks, +you can just build an instance of the `Behroozi10SmHm` component model +class without specifying a redshift, in which case you can +call the methods of the `Behroozi10SmHm` instance for any redshift. + +Second, the ``prim_haloprop_key`` keyword argument allows you to choose +which subhalo property regulates mean stellar mass. +In principle, you can choose any column name in the halo catalog you will +be populating, but this key should be a mass-like variable in order to get +sensible results, e.g., ``halo_mpeak``, ``halo_macc``, etc. +It is not permissible to dynamically change the ``prim_haloprop_key`` +of the ``behroozi10`` composite model instance. +If you want to explore the effects of choosing different +halo properties, you should instantiate multiple models. + +Finally, you can choose how stochasticity between halo and stellar mass is modeled +with the ``scatter_abscissa`` and ``scatter_ordinates`` keywords. +These arguments determine the level of scatter in stellar mass, given in dex. +The abscissa serve as control points and the ordinates the values of the scatter +at those control points. So, for example, if you wanted to have 0.3 dex of +scatter at :math:`M_{\rm halo} = 10^{12}M_{\odot}` and 0.1 dex of scatter at :math:`M_{\rm halo} = 10^{15}M_{\odot}`: >>> model = PrebuiltSubhaloModelFactory('behroozi10', scatter_abscissa = [1e12, 1e15], scatter_ordinates = [0.3, 0.1]) -For constant scatter, use a one-element python list. -It is not permissible to dynamically change the abscissa after instantiation, -though you can vary the ordinates by changing the appropriate values in the ``param_dict``. -For example, in the above model, the following line will change the +For constant scatter, use a one-element python list. +It is not permissible to dynamically change the abscissa after instantiation, +though you can vary the ordinates by changing the appropriate values in the ``param_dict``. +For example, in the above model, the following line will change the scatter to 0.2 dex in :math:`M_{\rm halo} = 10^{12}M_{\odot}` halos: >>> model.param_dict['scatter_model_param1'] = 0.2 @@ -80,26 +80,26 @@ scatter to 0.2 dex in :math:`M_{\rm halo} = 10^{12}M_{\odot}` halos: Populating Mocks and Generating Behroozi et al. (2010) Model Predictions =========================================================================== -As with any Halotools composite model, the model instance -can populate N-body simulations with mock galaxy catalogs. -In the following, we'll show how to do this -with fake simulation data via the ``halocat`` argument. +As with any Halotools composite model, the model instance +can populate N-body simulations with mock galaxy catalogs. +In the following, we'll show how to do this +with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltSubhaloModelFactory('behroozi10') ->>> model.populate_mock(halocat = halocat) +>>> model.populate_mock(halocat) # doctest: +SKIP -See `ModelFactory.populate_mock` for information about how to -populate your model into different simulations. -See :ref:`galaxy_catalog_analysis_tutorial` for a sequence of worked examples -on how to use the `~halotools.mock_observables` sub-package -to study a wide range of astronomical statistics predicted by your model. +See `ModelFactory.populate_mock` for information about how to +populate your model into different simulations. +See :ref:`galaxy_catalog_analysis_tutorial` for a sequence of worked examples +on how to use the `~halotools.mock_observables` sub-package +to study a wide range of astronomical statistics predicted by your model. -Studying the Behroozi et al. (2010) Model Features +Studying the Behroozi et al. (2010) Model Features ====================================================== -In addition to populating mocks, the ``behroozi10`` model also gives you access to +In addition to populating mocks, the ``behroozi10`` model also gives you access to its underlying analytical relations. Here are a few examples: >>> import numpy as np @@ -114,37 +114,37 @@ To compute the mean stellar mass as a function of halo mass: Parameters of the Behroozi et al. (2010) model ================================================= -The best way to learn what the parameters of a model do is to -just play with the code: change parameter values, make plots of how the -underying analytical relations vary, and also of how the -mock observables vary. Here we just give a simple description of the meaning -of each parameter. You can also refer to the original -Behroozi et al. (2010) publication, arXiv:1001.0015, -for further details. +The best way to learn what the parameters of a model do is to +just play with the code: change parameter values, make plots of how the +underying analytical relations vary, and also of how the +mock observables vary. Here we just give a simple description of the meaning +of each parameter. You can also refer to the original +Behroozi et al. (2010) publication, arXiv:1001.0015, +for further details. To see how the following parameters are implemented, see `Behroozi10SmHm.mean_stellar_mass`. -* param_dict['smhm_m0_0'] - Characteristic stellar mass at redshift-zero in the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. +* param_dict['smhm_m0_0'] - Characteristic stellar mass at redshift-zero in the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. -* param_dict['smhm_m0_a'] - Redshift evolution of the characteristic stellar mass. +* param_dict['smhm_m0_a'] - Redshift evolution of the characteristic stellar mass. -* param_dict['smhm_m1_0'] - Characteristic halo mass at redshift-zero in the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. +* param_dict['smhm_m1_0'] - Characteristic halo mass at redshift-zero in the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. -* param_dict['smhm_m1_a'] - Redshift evolution of the characteristic halo mass. +* param_dict['smhm_m1_a'] - Redshift evolution of the characteristic halo mass. -* param_dict['smhm_beta_0'] - Low-mass slope at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. +* param_dict['smhm_beta_0'] - Low-mass slope at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. -* param_dict['smhm_beta_a'] - Redshift evolution of the low-mass slope. +* param_dict['smhm_beta_a'] - Redshift evolution of the low-mass slope. -* param_dict['smhm_delta_0'] - High-mass slope at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. +* param_dict['smhm_delta_0'] - High-mass slope at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. -* param_dict['smhm_delta_a'] - Redshift evolution of the high-mass slope. +* param_dict['smhm_delta_a'] - Redshift evolution of the high-mass slope. -* param_dict['smhm_gamma_0'] - Transition between low- and high-mass behavior at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. +* param_dict['smhm_gamma_0'] - Transition between low- and high-mass behavior at redshift-zero of the :math:`\langle M_{\ast} \rangle(M_{\rm halo})` map. -* param_dict['smhm_gamma_a'] - Redshift evolution of the transition. +* param_dict['smhm_gamma_a'] - Redshift evolution of the transition. -* param_dict['u'scatter_model_param1'] - Log-normal scatter in the stellar-to-halo mass relation. +* param_dict['u'scatter_model_param1'] - Log-normal scatter in the stellar-to-halo mass relation. diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/cacciato09_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/cacciato09_composite_model.rst index 7bbdb85db..e496b9b67 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/cacciato09_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/cacciato09_composite_model.rst @@ -77,7 +77,7 @@ with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltHodModelFactory('cacciato09') ->>> model.populate_mock(halocat = halocat) +>>> model.populate_mock(halocat) # doctest: +SKIP See `ModelFactory.populate_mock` for information about how to populate your model into different simulations. @@ -100,7 +100,7 @@ To compute the median luminosity of central galaxies as a function of halo mass: To compute the average number of satellites per halo as a function of halo mass: ->>> mean_nsat = model.mean_occupation_satellites(prim_haloprop = halo_mass) +>>> mean_nsat = model.mean_occupation_satellites(prim_haloprop=halo_mass) By modifying the parameters stored in the ``param_dict``, the underlying analytical relations such as those above allow you to study how the model behaves without the @@ -126,7 +126,7 @@ Briefly, changing the delta parameters should only affect the abundance of satellites that have luminosities similar to the central luminosity. On the other hand, faint satellites should be unaffected. The details of the 2 delta parameters are described in Lange et al. (in prep.). Setting both to 0, as done by default, is -equivalent to the model of Cacciato et al. (2009). +equivalent to the model of Cacciato et al. (2009). * param_dict['log_L_0'] - Normalization of central mass-to-light ratio. diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/hearin15_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/hearin15_composite_model.rst index f1b417bc1..18d4f4b56 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/hearin15_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/hearin15_composite_model.rst @@ -6,36 +6,36 @@ Hearin et al. (2015) Composite Model .. currentmodule:: halotools.empirical_models -This section of the documentation describes the basic behavior of -the ``hearin15`` composite HOD model. To see how this composite -model is built by the `~halotools.empirical_models.PrebuiltHodModelFactory` class, -see `~halotools.empirical_models.hearin15_model_dictionary`. +This section of the documentation describes the basic behavior of +the ``hearin15`` composite HOD model. To see how this composite +model is built by the `~halotools.empirical_models.PrebuiltHodModelFactory` class, +see `~halotools.empirical_models.hearin15_model_dictionary`. Overview of the Hearin et al. (2015) Model Features ====================================================== -This HOD-style model is based on Hearin et al. (2015), arXiv:1512.03050. -The behavior of this model is identical to Leauthaud et al. (2011), -except this model implements assemby bias using decorated HOD methods in the -`HeavisideAssembias` class. - -There are two populations, centrals and satellites. -Central occupation statistics are given by a nearest integer distribution -with first moment given by an ``erf`` function; the class governing this -behavior is `~halotools.empirical_models.Leauthaud11Cens`. -Central galaxies are assumed to reside at the exact center of the host halo; -the class governing this behavior is `~halotools.empirical_models.TrivialPhaseSpace`. - -Satellite occupation statistics are given by a Poisson distribution -with first moment given by a power law that has been truncated at the low-mass end; -the class governing this behavior is `~halotools.empirical_models.Leauthaud11Sats`; -satellites in this model follow an (unbiased) NFW profile, as governed by the -`~halotools.empirical_models.NFWPhaseSpace` class. - -For both centrals and satellites, the occupation statistics are decorated with assembly bias. - -Building the Hearin et al. (2015) Model +This HOD-style model is based on Hearin et al. (2015), arXiv:1512.03050. +The behavior of this model is identical to Leauthaud et al. (2011), +except this model implements assemby bias using decorated HOD methods in the +`HeavisideAssembias` class. + +There are two populations, centrals and satellites. +Central occupation statistics are given by a nearest integer distribution +with first moment given by an ``erf`` function; the class governing this +behavior is `~halotools.empirical_models.Leauthaud11Cens`. +Central galaxies are assumed to reside at the exact center of the host halo; +the class governing this behavior is `~halotools.empirical_models.TrivialPhaseSpace`. + +Satellite occupation statistics are given by a Poisson distribution +with first moment given by a power law that has been truncated at the low-mass end; +the class governing this behavior is `~halotools.empirical_models.Leauthaud11Sats`; +satellites in this model follow an (unbiased) NFW profile, as governed by the +`~halotools.empirical_models.NFWPhaseSpace` class. + +For both centrals and satellites, the occupation statistics are decorated with assembly bias. + +Building the Hearin et al. (2015) Model ========================================= -You can build an instance of this model using the +You can build an instance of this model using the `~halotools.empirical_models.PrebuiltHodModelFactory` class as follows: >>> from halotools.empirical_models import PrebuiltHodModelFactory @@ -44,84 +44,84 @@ You can build an instance of this model using the Customizing the Hearin et al. (2015) Model ============================================= -There are numerous keyword arguments you can use to customize -the instance returned by the factory. - -The ``threshold`` keyword argument and the ``redshift`` keyword -argument behave in the exact same way as they do in the ``leauthaud11`` model. -See :ref:`leauthaud11_composite_model` for further details. - -The ``sec_haloprop_key`` keyword argument determines the secondary halo property -used to modulate the assembly bias. So, if you want halos at fixed mass with -above- or below-average concentration to have above- or below-average mean occupations, -you would set ``sec_haloprop_key`` to ``halo_nfw_conc``. - -The ``central_assembias_strength`` keyword argument determines how strong the -assembly bias is in the occupation statistics of central galaxies. -For constant assembly bias strength at all masses, -set this variable to be a float between -1 to 1. -For assembly bias strength that has mass-dependence, -you should provide a list of control values, which will be interpreted as the -strength at each of the input ``central_assembias_strength_abscissa`` control points. - -As described below in :ref:`hearin15_parameters`, the strength of assembly bias -can always be modulated after instantiation by changing the appropriate values -in ``param_dict``. However, the ``central_assembias_strength_abscissa`` cannot be -determined dynamically after instantiation. If you want to change the abscissa, -you must instantiate a new model. - -Exactly analogous comments apply to the ``satellite_assembias_strength`` and -``satellite_assembias_strength_abscissa`` keyword arguments. - -The ``split`` keyword argument determines how your halo population is divided into -two sub-populations at each mass. So, if you want halos in the upper 75th -percentile of concentration at each mass to have different occupation statistics than -halos in the lower 25th percentile, you would set ``split`` to 0.75. -You can study the impact of mass-dependence of subpopulation division by passing in -a list of control values for the ``split`` keyword, which will be interpreted as the -splitting fraction at each of the input ``split_abscissa`` control points. - -Once you make a choice for ``split``, you cannot change this after instantiating a model. -If you want to study the effects of different choices for ``split``, -you must instantiate a new model. +There are numerous keyword arguments you can use to customize +the instance returned by the factory. + +The ``threshold`` keyword argument and the ``redshift`` keyword +argument behave in the exact same way as they do in the ``leauthaud11`` model. +See :ref:`leauthaud11_composite_model` for further details. + +The ``sec_haloprop_key`` keyword argument determines the secondary halo property +used to modulate the assembly bias. So, if you want halos at fixed mass with +above- or below-average concentration to have above- or below-average mean occupations, +you would set ``sec_haloprop_key`` to ``halo_nfw_conc``. + +The ``central_assembias_strength`` keyword argument determines how strong the +assembly bias is in the occupation statistics of central galaxies. +For constant assembly bias strength at all masses, +set this variable to be a float between -1 to 1. +For assembly bias strength that has mass-dependence, +you should provide a list of control values, which will be interpreted as the +strength at each of the input ``central_assembias_strength_abscissa`` control points. + +As described below in :ref:`hearin15_parameters`, the strength of assembly bias +can always be modulated after instantiation by changing the appropriate values +in ``param_dict``. However, the ``central_assembias_strength_abscissa`` cannot be +determined dynamically after instantiation. If you want to change the abscissa, +you must instantiate a new model. + +Exactly analogous comments apply to the ``satellite_assembias_strength`` and +``satellite_assembias_strength_abscissa`` keyword arguments. + +The ``split`` keyword argument determines how your halo population is divided into +two sub-populations at each mass. So, if you want halos in the upper 75th +percentile of concentration at each mass to have different occupation statistics than +halos in the lower 25th percentile, you would set ``split`` to 0.75. +You can study the impact of mass-dependence of subpopulation division by passing in +a list of control values for the ``split`` keyword, which will be interpreted as the +splitting fraction at each of the input ``split_abscissa`` control points. + +Once you make a choice for ``split``, you cannot change this after instantiating a model. +If you want to study the effects of different choices for ``split``, +you must instantiate a new model. Populating Mocks and Generating Hearin et al. (2015) Model Predictions ========================================================================= -As with any Halotools composite model, the model instance -can populate N-body simulations with mock galaxy catalogs. -In the following, we'll show how to do this -with fake simulation data via the ``halocat`` argument. +As with any Halotools composite model, the model instance +can populate N-body simulations with mock galaxy catalogs. +In the following, we'll show how to do this +with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltHodModelFactory('hearin15') ->>> model.populate_mock(halocat = halocat) +>>> model.populate_mock(halocat) # doctest: +SKIP -See `ModelFactory.populate_mock` for information about how to -populate your model into different simulations. -See :ref:`galaxy_catalog_analysis_tutorial` for a sequence of worked examples -on how to use the `~halotools.mock_observables` sub-package -to study a wide range of astronomical statistics predicted by your model. +See `ModelFactory.populate_mock` for information about how to +populate your model into different simulations. +See :ref:`galaxy_catalog_analysis_tutorial` for a sequence of worked examples +on how to use the `~halotools.mock_observables` sub-package +to study a wide range of astronomical statistics predicted by your model. -Studying the Hearin et al. (2015) Model Features +Studying the Hearin et al. (2015) Model Features ================================================== -In addition to populating mocks, the ``hearin15`` model also gives you access to -its underlying analytical relations. Firstly, the ``hearin15`` model naturally -inherits all of the methods of the ``leauthaud11`` model, which you can read about -in :ref:`leauthaud11_composite_model`. Here we give examples of the additional -methods that are unique to this model. +In addition to populating mocks, the ``hearin15`` model also gives you access to +its underlying analytical relations. Firstly, the ``hearin15`` model naturally +inherits all of the methods of the ``leauthaud11`` model, which you can read about +in :ref:`leauthaud11_composite_model`. Here we give examples of the additional +methods that are unique to this model. >>> import numpy as np >>> halo_mass = np.logspace(11, 15, 100) -The ``mean_occupation`` methods of the ``hearin15`` model operate slightly -differently than they do in the ``leauthaud11`` model, because here -two halo properties govern the behavior of the model, not just one. -Suppose you wish to compute the mean occupation of centrals for halos -in the upper-percentile split. In this case you can force the -``mean_occupation_centrals`` method to interpret the halos as being +The ``mean_occupation`` methods of the ``hearin15`` model operate slightly +differently than they do in the ``leauthaud11`` model, because here +two halo properties govern the behavior of the model, not just one. +Suppose you wish to compute the mean occupation of centrals for halos +in the upper-percentile split. In this case you can force the +``mean_occupation_centrals`` method to interpret the halos as being in the upper-percentile division via the ``sec_haloprop_percentile`` keyword: >>> mean_ncen_upper = model.mean_occupation_centrals(prim_haloprop = halo_mass, sec_haloprop_percentile=1) @@ -130,28 +130,28 @@ For halos in the lower-percentile split: >>> mean_ncen_lower = model.mean_occupation_centrals(prim_haloprop = halo_mass, sec_haloprop_percentile=0) -If you have a mixed population, just pass in a second array storing the actual value values +If you have a mixed population, just pass in a second array storing the actual value values of the secondary halo property via the ``sec_haloprop`` keyword: >>> fake_sec_prop = np.random.random(len(halo_mass)) ->>> mean_ncen = model.mean_occupation_centrals(prim_haloprop = halo_mass, sec_haloprop = fake_sec_prop) +>>> mean_ncen = model.mean_occupation_centrals(prim_haloprop=halo_mass, sec_haloprop=fake_sec_prop) To compute the strength of assembly bias as a function of halo mass: ->>> assembias_cens = model.assembias_strength_centrals(prim_haloprop = halo_mass) ->>> assembias_sats = model.assembias_strength_satellites(prim_haloprop = halo_mass) +>>> assembias_cens = model.assembias_strength_centrals(prim_haloprop=halo_mass) +>>> assembias_sats = model.assembias_strength_satellites(prim_haloprop=halo_mass) .. _hearin15_parameters: Parameters of the Hearin et al. (2015) Model ================================================= -The ``hearin15`` model naturally inherits all of -the parameters of the ``leauthaud11`` model, which you can read about -in :ref:`leauthaud11_parameters`. Here we only describe the parameters -that are unique to the ``hearin15`` model. +The ``hearin15`` model naturally inherits all of +the parameters of the ``leauthaud11`` model, which you can read about +in :ref:`leauthaud11_parameters`. Here we only describe the parameters +that are unique to the ``hearin15`` model. -* param_dict['mean_occupation_centrals_assembias_param1'] - controls the strength of assembly bias in the centrals population as specified at the first control point. If you passed in a float to the ``centrals_assembias_strength`` keyword argument, there will only be one such parameter. If you passsed in a list, there will be one parameter per list element. Changing the values of this parameter modulates the strength of assembly bias. The only permissible values are between -1 to 1; values outside this range will be interpreted as endpoint values. +* param_dict['mean_occupation_centrals_assembias_param1'] - controls the strength of assembly bias in the centrals population as specified at the first control point. If you passed in a float to the ``centrals_assembias_strength`` keyword argument, there will only be one such parameter. If you passsed in a list, there will be one parameter per list element. Changing the values of this parameter modulates the strength of assembly bias. The only permissible values are between -1 to 1; values outside this range will be interpreted as endpoint values. diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zheng07_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zheng07_composite_model.rst index cc47ae065..fd72593b7 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zheng07_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zheng07_composite_model.rst @@ -129,7 +129,7 @@ with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltHodModelFactory('zheng07') ->>> model.populate_mock(halocat = halocat) +>>> model.populate_mock(halocat = halocat) # doctest: +SKIP See `ModelFactory.populate_mock` for information about how to populate your model into different simulations. diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum15_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum15_composite_model.rst index a6cc9751b..bb6403e48 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum15_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum15_composite_model.rst @@ -87,7 +87,7 @@ with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltHodModelFactory('zu_mandelbaum15') ->>> model.populate_mock(halocat) +>>> model.populate_mock(halocat) # doctest: +SKIP See `ModelFactory.populate_mock` for information about how to populate your model into different simulations. diff --git a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum16_composite_model.rst b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum16_composite_model.rst index b3fd80863..79a48148f 100644 --- a/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum16_composite_model.rst +++ b/docs/quickstart_and_tutorials/tutorials/model_building/preloaded_models/zu_mandelbaum16_composite_model.rst @@ -92,7 +92,7 @@ with fake simulation data via the ``halocat`` argument. >>> from halotools.sim_manager import FakeSim >>> halocat = FakeSim() >>> model = PrebuiltHodModelFactory('zu_mandelbaum16') ->>> model.populate_mock(halocat) +>>> model.populate_mock(halocat) # doctest: +SKIP See `ModelFactory.populate_mock` for information about how to populate your model into different simulations. diff --git a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/biased_isotropic_velocity.py b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/biased_isotropic_velocity.py index 6949754a3..ff2e16749 100644 --- a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/biased_isotropic_velocity.py +++ b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/biased_isotropic_velocity.py @@ -56,7 +56,7 @@ def dimensionless_radial_velocity_dispersion(scaled_radius, halo_conc, gal_conc, result = np.zeros_like(x) prefactor = gal_conc*gal_conc*x*(1. + gal_conc*x)**2/_g_integral(halo_conc) - extra_args = halo_conc/gal_conc + extra_args = halo_conc/np.atleast_1d(gal_conc).astype('f4') lower_limit = gal_conc*x upper_limit = float("inf") diff --git a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch10_cg5.dat b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch10_cg5.dat new file mode 100644 index 000000000..c1fc5e9bc --- /dev/null +++ b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch10_cg5.dat @@ -0,0 +1,100 @@ + 1 1.00000005E-03 0.337781817 + 2 1.07226719E-03 0.346341670 + 3 1.14975683E-03 0.355056435 + 4 1.23284652E-03 0.363927215 + 5 1.32194080E-03 0.372949064 + 6 1.41747447E-03 0.382128298 + 7 1.51991134E-03 0.391455710 + 8 1.62975094E-03 0.400935948 + 9 1.74752844E-03 0.410559714 + 10 1.87381729E-03 0.420332551 + 11 2.00923276E-03 0.430242807 + 12 2.15443433E-03 0.440291733 + 13 2.31013028E-03 0.450474024 + 14 2.47707684E-03 0.460783362 + 15 2.65608821E-03 0.471216261 + 16 2.84803612E-03 0.481768638 + 17 3.05385562E-03 0.492430717 + 18 3.27454903E-03 0.503198981 + 19 3.51119135E-03 0.514063656 + 20 3.76493507E-03 0.525017083 + 21 4.03701654E-03 0.536052167 + 22 4.32875985E-03 0.547158360 + 23 4.64158971E-03 0.558326304 + 24 4.97702416E-03 0.569544792 + 25 5.33669954E-03 0.580801189 + 26 5.72236767E-03 0.592086732 + 27 6.13590656E-03 0.603384197 + 28 6.57933485E-03 0.614682138 + 29 7.05480063E-03 0.625966072 + 30 7.56463548E-03 0.637220800 + 31 8.11131019E-03 0.648431242 + 32 8.69749114E-03 0.659577370 + 33 9.32603423E-03 0.670644879 + 34 9.99999978E-03 0.681614339 + 35 1.07226716E-02 0.692467272 + 36 1.14975683E-02 0.703182578 + 37 1.23284683E-02 0.713741660 + 38 1.32194115E-02 0.724121690 + 39 1.41747408E-02 0.734303176 + 40 1.51991127E-02 0.744263589 + 41 1.62975099E-02 0.753979623 + 42 1.74752846E-02 0.763429582 + 43 1.87381729E-02 0.772589922 + 44 2.00923271E-02 0.781437635 + 45 2.15443484E-02 0.789949834 + 46 2.31012981E-02 0.798103154 + 47 2.47707628E-02 0.805874646 + 48 2.65608821E-02 0.813242316 + 49 2.84803621E-02 0.820183396 + 50 3.05385552E-02 0.826677263 + 51 3.27454917E-02 0.832703054 + 52 3.51119153E-02 0.838240743 + 53 3.76493521E-02 0.843271911 + 54 4.03701738E-02 0.847779632 + 55 4.32876237E-02 0.851747930 + 56 4.64158952E-02 0.855162561 + 57 4.97702286E-02 0.858010828 + 58 5.33669963E-02 0.860282063 + 59 5.72236739E-02 0.861967802 + 60 6.13590665E-02 0.863061070 + 61 6.57933280E-02 0.863557637 + 62 7.05480501E-02 0.863455057 + 63 7.56463110E-02 0.862753332 + 64 8.11130777E-02 0.861454844 + 65 8.69749114E-02 0.859563947 + 66 9.32603404E-02 0.857087612 + 67 0.100000001 0.854034722 + 68 0.107226714 0.850416183 + 69 0.114975683 0.846245468 + 70 0.123284653 0.841537058 + 71 0.132194087 0.836307883 + 72 0.141747445 0.830576181 + 73 0.151991129 0.824361563 + 74 0.162975013 0.817685068 + 75 0.174752846 0.810568273 + 76 0.187381729 0.803034246 + 77 0.200923279 0.795106292 + 78 0.215443552 0.786808252 + 79 0.231013045 0.778164446 + 80 0.247707561 0.769199252 + 81 0.265608817 0.759936512 + 82 0.284803629 0.750400901 + 83 0.305385560 0.740615726 + 84 0.327454895 0.730604529 + 85 0.351119131 0.720390141 + 86 0.376493514 0.709994674 + 87 0.403701633 0.699439764 + 88 0.432875991 0.688746035 + 89 0.464158982 0.677933574 + 90 0.497702420 0.667021394 + 91 0.533669949 0.656027436 + 92 0.572236776 0.644970596 + 93 0.613590658 0.633865893 + 94 0.657933116 0.622729540 + 95 0.705480456 0.611576378 + 96 0.756463528 0.600420594 + 97 0.811131001 0.589275360 + 98 0.869749129 0.578153014 + 99 0.932603419 0.567065179 + 100 1.00000000 0.556022882 diff --git a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch5_cg10.dat b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch5_cg10.dat new file mode 100644 index 000000000..83fcc862b --- /dev/null +++ b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/data/van_den_bosch_nfw_vr_disp_ch5_cg10.dat @@ -0,0 +1,100 @@ + 1 1.00000005E-03 0.207579911 + 2 1.07226719E-03 0.212847486 + 3 1.14975683E-03 0.218204394 + 4 1.23284652E-03 0.223658785 + 5 1.32194080E-03 0.229214743 + 6 1.41747447E-03 0.234865800 + 7 1.51991134E-03 0.240626827 + 8 1.62975094E-03 0.246474519 + 9 1.74752844E-03 0.252417296 + 10 1.87381729E-03 0.258463264 + 11 2.00923276E-03 0.264594972 + 12 2.15443433E-03 0.270835310 + 13 2.31013028E-03 0.277156115 + 14 2.47707684E-03 0.283565253 + 15 2.65608821E-03 0.290081322 + 16 2.84803612E-03 0.296678692 + 17 3.05385562E-03 0.303348839 + 18 3.27454903E-03 0.310112745 + 19 3.51119135E-03 0.316957146 + 20 3.76493507E-03 0.323876113 + 21 4.03701654E-03 0.330874890 + 22 4.32875985E-03 0.337948084 + 23 4.64158971E-03 0.345085502 + 24 4.97702416E-03 0.352289021 + 25 5.33669954E-03 0.359552920 + 26 5.72236767E-03 0.366876721 + 27 6.13590656E-03 0.374251902 + 28 6.57933485E-03 0.381677926 + 29 7.05480063E-03 0.389145315 + 30 7.56463548E-03 0.396653980 + 31 8.11131019E-03 0.404197097 + 32 8.69749114E-03 0.411769927 + 33 9.32603423E-03 0.419365495 + 34 9.99999978E-03 0.426978528 + 35 1.07226716E-02 0.434604615 + 36 1.14975683E-02 0.442237556 + 37 1.23284683E-02 0.449866861 + 38 1.32194115E-02 0.457491517 + 39 1.41747408E-02 0.465101719 + 40 1.51991127E-02 0.472692847 + 41 1.62975099E-02 0.480254829 + 42 1.74752846E-02 0.487781435 + 43 1.87381729E-02 0.495267391 + 44 2.00923271E-02 0.502702355 + 45 2.15443484E-02 0.510079622 + 46 2.31012981E-02 0.517392397 + 47 2.47707628E-02 0.524630129 + 48 2.65608821E-02 0.531785667 + 49 2.84803621E-02 0.538850129 + 50 3.05385552E-02 0.545814574 + 51 3.27454917E-02 0.552669644 + 52 3.51119153E-02 0.559406400 + 53 3.76493521E-02 0.566014886 + 54 4.03701738E-02 0.572485089 + 55 4.32876237E-02 0.578807235 + 56 4.64158952E-02 0.584969938 + 57 4.97702286E-02 0.590963304 + 58 5.33669963E-02 0.596775472 + 59 5.72236739E-02 0.602395535 + 60 6.13590665E-02 0.607811153 + 61 6.57933280E-02 0.613011003 + 62 7.05480501E-02 0.617982566 + 63 7.56463110E-02 0.622713745 + 64 8.11130777E-02 0.627191782 + 65 8.69749114E-02 0.631403923 + 66 9.32603404E-02 0.635338008 + 67 0.100000001 0.638981104 + 68 0.107226714 0.642321110 + 69 0.114975683 0.645345926 + 70 0.123284653 0.648043454 + 71 0.132194087 0.650402606 + 72 0.141747445 0.652412713 + 73 0.151991129 0.654063642 + 74 0.162975013 0.655346394 + 75 0.174752846 0.656252503 + 76 0.187381729 0.656774759 + 77 0.200923279 0.656907141 + 78 0.215443552 0.656644702 + 79 0.231013045 0.655983984 + 80 0.247707561 0.654922724 + 81 0.265608817 0.653460205 + 82 0.284803629 0.651596963 + 83 0.305385560 0.649335325 + 84 0.327454895 0.646678567 + 85 0.351119131 0.643631876 + 86 0.376493514 0.640201807 + 87 0.403701633 0.636395931 + 88 0.432875991 0.632223308 + 89 0.464158982 0.627694249 + 90 0.497702420 0.622820079 + 91 0.533669949 0.617613375 + 92 0.572236776 0.612087190 + 93 0.613590658 0.606255889 + 94 0.657933116 0.600133955 + 95 0.705480456 0.593736947 + 96 0.756463528 0.587080777 + 97 0.811131001 0.580181658 + 98 0.869749129 0.573055983 + 99 0.932603419 0.565720320 + 100 1.00000000 0.558191359 diff --git a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/test_biased_isotropic_velocity.py b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/test_biased_isotropic_velocity.py index b235b35ab..0e84e4032 100644 --- a/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/test_biased_isotropic_velocity.py +++ b/halotools/empirical_models/phase_space_models/analytic_models/satellites/nfw/kernels/tests/test_biased_isotropic_velocity.py @@ -1,6 +1,7 @@ """ """ import numpy as np +from astropy.utils.data import get_pkg_data_filename from ..unbiased_isotropic_velocity import dimensionless_radial_velocity_dispersion as unbiased_dimless_vel_rad_disp from ..biased_isotropic_velocity import dimensionless_radial_velocity_dispersion as biased_dimless_vel_rad_disp @@ -27,3 +28,23 @@ def test_unbiased_vel_rad_disp2(): gal_conc = 2*halo_conc biased_result = biased_dimless_vel_rad_disp(scaled_radius, halo_conc, gal_conc) assert not np.allclose(unbiased_result, biased_result) + + +def test_unbiased_vel_rad_disp_external_ch10_cg5(): + halo_conc, gal_conc = 10, 5 + fname = get_pkg_data_filename('data/van_den_bosch_nfw_vr_disp_ch10_cg5.dat') + x = np.loadtxt(fname) + frank_r_by_Rvir = x[:, 1] + frank_dimless_sigma_rad = x[:, 2] + aph_result = biased_dimless_vel_rad_disp(frank_r_by_Rvir, halo_conc, gal_conc) + assert np.allclose(aph_result, frank_dimless_sigma_rad, rtol=1e-3) + + +def test_unbiased_vel_rad_disp_external_ch5_cg10(): + halo_conc, gal_conc = 5, 10 + fname = get_pkg_data_filename('data/van_den_bosch_nfw_vr_disp_ch5_cg10.dat') + x = np.loadtxt(fname) + frank_r_by_Rvir = x[:, 1] + frank_dimless_sigma_rad = x[:, 2] + aph_result = biased_dimless_vel_rad_disp(frank_r_by_Rvir, halo_conc, gal_conc) + assert np.allclose(aph_result, frank_dimless_sigma_rad, rtol=1e-3) diff --git a/halotools/tests/docs_code_block_tests/test_preloaded_mockpop.py b/halotools/tests/docs_code_block_tests/test_preloaded_mockpop.py new file mode 100644 index 000000000..ec0e61dcb --- /dev/null +++ b/halotools/tests/docs_code_block_tests/test_preloaded_mockpop.py @@ -0,0 +1,91 @@ +""" These tests populate mocks using all the pre-loaded models. These calculations +time-out on the Travis CI environment, and so we run them here on APH_MACHINE only +to ensure the still get executed. +""" +import numpy as np +from astropy.config.paths import _find_home + +from ...sim_manager import FakeSim +from ...empirical_models import PrebuiltHodModelFactory, PrebuiltSubhaloModelFactory +# Determine whether the machine is mine +# This will be used to select tests whose +# returned values depend on the configuration +# of my personal cache directory files +aph_home = '/Users/aphearin' +detected_home = _find_home() +if aph_home == detected_home: + APH_MACHINE = True +else: + APH_MACHINE = False + + +def test_zu_mandelbaum15_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('zu_mandelbaum15') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_zu_mandelbaum16_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('zu_mandelbaum16') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_zheng07_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('zheng07') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_behroozi10_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltSubhaloModelFactory('behroozi10') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_hearin15_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('hearin15') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_cacciato09_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('cacciato09') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_leauthaud11_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('leauthaud11') + + if APH_MACHINE: + model.populate_mock(halocat) + + +def test_tinker13_mockpop(): + + halocat = FakeSim(seed=43) + model = PrebuiltHodModelFactory('tinker13') + + if APH_MACHINE: + model.populate_mock(halocat)