.. _galaxy_catalog_analysis_tutorial6: Galaxy Catalog Analysis Example: Mean infall velocity into cluster BCGs ================================================================================================== In this example we'll show how to calculate the mean infall velocity of galaxies towards the cluster BCGs. In particular, we'll use the `~halotools.empirical_models.Behroozi10SmHm` model to paint stellar masses onto subhalos, and then we'll select a population of :math:`M_{\ast}/M_{\odot}>10^{11.75}` galaxies as our BCG sample, and :math:`10^{10.75} 10**11.5) cluster_centrals = model.mock.galaxy_table[cluster_central_mask] low_mass_tracers_mask = ((model.mock.galaxy_table['stellar_mass'] > 10**10) & (model.mock.galaxy_table['stellar_mass'] < 10**10.5)) low_mass_tracers = model.mock.galaxy_table[low_mass_tracers_mask] cluster_pos = return_xyz_formatted_array(cluster_centrals['x'], cluster_centrals['y'] ,cluster_centrals['z']) cluster_vel = return_xyz_formatted_array(cluster_centrals['vx'], cluster_centrals['vy'] ,cluster_centrals['vz']) low_mass_tracers_pos = return_xyz_formatted_array(low_mass_tracers['x'], low_mass_tracers['y'], low_mass_tracers['z']) low_mass_tracers_vel = return_xyz_formatted_array(low_mass_tracers['vx'], low_mass_tracers['vy'], low_mass_tracers['vz']) Calculate :math:`(r)` ---------------------------------- .. code:: python from halotools.mock_observables import mean_radial_velocity_vs_r rbins = np.logspace(-0.5, 1.25, 15) rbin_midpoints = (rbins[1:] + rbins[:-1])/2. vr_clusters = mean_radial_velocity_vs_r(cluster_pos, cluster_vel, rbins_absolute=rbins, sample2=low_mass_tracers_pos, velocities2=low_mass_tracers_vel, period = model.mock.Lbox, do_auto=False, do_cross=True) Plot the result ~~~~~~~~~~~~~~~ .. code:: python fig, ax = plt.subplots(1, 1) __=ax.plot(rbin_midpoints, vr_clusters, color='k') xscale = ax.set_xscale('log') xlim = ax.set_xlim(xmin=0.5, xmax=20) xlabel = ax.set_xlabel(r'$r $ $\rm{[Mpc]}$', fontsize=15) ylabel = ax.set_ylabel(r'$\langle V_{\rm rad}\rangle$ $[{\rm km/s}]$', fontsize=15) title = ax.set_title('Radial infall velocity into cluster BCGs', fontsize=15) .. image:: cluster_bcg_infall_velocity.png As shown in the plot, as galaxies approach the neighborhood of a BCG, on average they tend to fall towards it. Spatial separations that are on the order of the halo radius of the BCG correspond to the multi-stream region where the velocities of the tracer galaxies start to virialize with the cluster halo. This is why we see the upturn in the mean radial velocity on scales ~3 Mpc. This tutorial continues with :ref:`galaxy_catalog_analysis_tutorial7`.