Example #1
0
def mo_matrix(mock, obs, opts):

    """
    Function to determine the mass-observable matrix.
    """

    n_mass_bins = comp.num_bins(opts.mass_bin[0], opts.mass_bin[1], opts.mass_bin[2])
    n_proxy_bins = comp.num_bins(opts.proxy_bin[0], opts.proxy_bin[1], opts.proxy_bin[2])

    mass_x = comp.x_vals(n_mass_bins, opts.mass_bin[0], opts.mass_bin[2])
    proxy_x = comp.x_vals(n_proxy_bins, opts.proxy_bin[0], opts.proxy_bin[2])
    
    matrix = np.zeros((n_proxy_bins, n_mass_bins))

    clusters = find_matches(mock, obs, opts)

    for cluster in clusters:
    
        proxy_bin = n_proxy_bins - 1 - \
          comp.find_bin(np.log10(cluster.proxy), opts.proxy_bin[0], opts.proxy_bin[2])

        for i in range(n_proxy_bins):
            if proxy_bin == i and opts.z_bin[0] <= cluster.z < opts.z_bin[1]:
                matrix[proxy_bin] += comp.scale(cluster.hist, min(cluster.hist),
                                                np.sum(cluster.hist))
                   
    for i in range(n_proxy_bins):
        matrix[i] = comp.scale(matrix[i], min(matrix[i]), np.sum(matrix[i]))

    return matrix, mass_x, proxy_x
Example #2
0
def mo_matrix(mock, obs, opts):
    """
    Function to determine the mass-observable matrix.
    """

    n_mass_bins = comp.num_bins(opts.mass_bin[0], opts.mass_bin[1],
                                opts.mass_bin[2])
    n_proxy_bins = comp.num_bins(opts.proxy_bin[0], opts.proxy_bin[1],
                                 opts.proxy_bin[2])

    mass_x = comp.x_vals(n_mass_bins, opts.mass_bin[0], opts.mass_bin[2])
    proxy_x = comp.x_vals(n_proxy_bins, opts.proxy_bin[0], opts.proxy_bin[2])

    matrix = np.zeros((n_proxy_bins, n_mass_bins))

    clusters = find_matches(mock, obs, opts)

    for cluster in clusters:

        proxy_bin = n_proxy_bins - 1 - \
          comp.find_bin(np.log10(cluster.proxy), opts.proxy_bin[0], opts.proxy_bin[2])

        for i in range(n_proxy_bins):
            if proxy_bin == i and opts.z_bin[0] <= cluster.z < opts.z_bin[1]:
                matrix[proxy_bin] += comp.scale(cluster.hist,
                                                min(cluster.hist),
                                                np.sum(cluster.hist))

    for i in range(n_proxy_bins):
        matrix[i] = comp.scale(matrix[i], min(matrix[i]), np.sum(matrix[i]))

    return matrix, mass_x, proxy_x
Example #3
0
def r200_match(i, index, mock, obs):

    dists = astro.ang_sep((mock.ra[index], mock.dec[index]), (obs.ra[i], obs.dec[i])) * 60.0

    new_index = np.where((dists - (1.0 * mock.r200[index])) <= 0.0)[0]

    if len(new_index) > 0:
        dist_data = 1.0 - (dists[new_index] / mock.r200[index[new_index]]) ** 2  
        return index[new_index], comp.scale(dist_data, 0.0, np.sum(dist_data))
    else:
        return [], []
Example #4
0
def match_weight(proxy, dist, r200):

    weights = (proxy ** 2) + (1.0 - (dist / r200) ** 2)

    return comp.scale(weights, 0.0, np.sum(weights))
Example #5
0
def scale_matrix(matrix):

    return [comp.scale(matrix[i], 0.0, np.sum(matrix[i])) for i in
            range(len(matrix))]
Example #6
0
def match_weight(proxy, dist, r200):

    weights = (proxy**2) + (1.0 - (dist / r200)**2)

    return comp.scale(weights, 0.0, np.sum(weights))
Example #7
0
def scale_matrix(matrix):

    return [
        comp.scale(matrix[i], 0.0, np.sum(matrix[i]))
        for i in range(len(matrix))
    ]
Example #8
0
def scale_matrix(matrix):
    
    for i in range(len(matrix)):
        matrix[i] = comp.scale(matrix[i], 0.0, np.sum(matrix[i]))

    return matrix