# conditional_abunmatch¶

halotools.empirical_models.conditional_abunmatch(x, y, x2, y2, nwin, add_subgrid_noise=True, assume_x_is_sorted=False, assume_x2_is_sorted=False, return_indexes=False)[source] [edit on github]

Given a set of input points with primary property x and secondary property y, and a mapping between that primary property and another secondary property (y2 | x2), assign values of the y2 property to the input points.

The y2 that is assigned (ynew) is in monotonic correspondence with y at fixed x. Therefore, $$P(<y_{\rm new} | x) = P(<y | x)$$.

See Tutorial on Conditional Abundance Matching demonstrating how to use this function in galaxy-halo modeling with several worked examples.

Parameters: x : ndarray Numpy array of shape (n1, ) storing the primary property of the input points. y : ndarray Numpy array of shape (n1, ) storing the secondary property of the input points. x2 : ndarray Numpy array of shape (n2, ) storing the primary property of the desired distribution. This should be the same physical property (e.g. halo mass) as x. y2 : ndarray Numpy array of shape (n2, ) storing the secondary property of the desired distribution. This is a different physical property to y. nwin : int Odd integer specifying the size of the window used to estimate \(P(

Notes

The nwin argument controls the precision of the calculation, and also the performance. For estimations of Prob(< y | x) with sub-percent accuracy, values of window_length must exceed 100. Values more tha a few hundred are likely overkill when using the (recommended) sub-grid noise option.

With the release of Halotools v0.7, this function replaced a previous function of the same name. The old function is now called conditional_abunmatch_bin_based.

Examples

>>> npts1, npts2 = 5000, 3000
>>> x = np.linspace(0, 1, npts1)
>>> y = np.random.uniform(-1, 1, npts1)
>>> x2 = np.linspace(0.5, 0.6, npts2)
>>> y2 = np.random.uniform(-5, 3, npts2)
>>> nwin = 51
>>> new_y = conditional_abunmatch(x, y, x2, y2, nwin)