예제 #1
0
def _ed_projected_process_args(sample1, rp_bins, pi_max, sample2, period, num_threads):
    r"""
    Private method to do bounds-checking on the arguments passed to
    `~halotools.mock_observables.alignments.ed_3d`.
    """

    sample1 = enforce_sample_has_correct_shape(sample1)
    sample2 = enforce_sample_has_correct_shape(sample2)
    
    N1 = len(sample1)
    N2 = len(sample2)

    rp_bins = get_separation_bins_array(rp_bins)
    rp_max = np.amax(rp_bins)

    pi_max = float(pi_max)
    pi_bins = np.array([0.0, pi_max])

    period, PBCs = get_period(period)

    _enforce_maximum_search_length([rp_max, rp_max, pi_max], period)

    num_threads = get_num_threads(num_threads)

    return sample1, rp_bins, pi_bins, sample2, period, num_threads, PBCs
예제 #2
0
def _ii_minus_projected_process_args(sample1, rp_bins, pi_max, sample2,
                                     randoms1, randoms2, period, num_threads,
                                     approx_cell1_size, approx_cell2_size):
    r"""
    Private method to do bounds-checking on the arguments passed to
    `~halotools.mock_observables.alignments.ii_minus_projected`.
    """
    sample1 = enforce_sample_has_correct_shape(sample1)

    if randoms1 is not None:
        randoms1 = np.atleast_1d(randoms1)
        no_randoms1 = False
    else:
        no_randoms1 = True

    if randoms2 is not None:
        randoms2 = np.atleast_1d(randoms2)
        no_randoms2 = False
    else:
        no_randoms2 = True

    #if one of the randoms is missing, raise an error
    no_randoms = True
    if no_randoms1:
        if no_randoms2 is False:
            msg = "if one set of randoms is provided, both randoms must be provided.\n"
            raise ValueError(msg)
    elif no_randoms2:
        if no_randoms1 is False:
            msg = "if one set of randoms is provided, both randoms must be provided.\n"
            raise ValueError(msg)
    else:
        no_randoms = False

    pi_max = float(pi_max)
    pi_bins = np.array([0.0, pi_max])

    rp_bins = get_separation_bins_array(rp_bins)
    rp_max = np.amax(rp_bins)

    period, PBCs = get_period(period)

    _enforce_maximum_search_length([rp_max, rp_max, pi_max], period)

    if (randoms1 is None) & (PBCs is False):
        msg = "If no PBCs are specified, both randoms must be provided.\n"
        raise ValueError(msg)

    num_threads = get_num_threads(num_threads)

    return sample1, rp_bins, pi_bins, sample2, randoms1, randoms2, period, num_threads, PBCs, no_randoms
예제 #3
0
def _ee_3d_process_args(sample1, rbins, sample2, period, num_threads):
    r"""
    Private method to do bounds-checking on the arguments passed to
    `~halotools.mock_observables.alignments.ee_3d`.
    """

    sample1 = enforce_sample_has_correct_shape(sample1)

    rbins = get_separation_bins_array(rbins)
    rmax = np.amax(rbins)

    period, PBCs = get_period(period)

    _enforce_maximum_search_length([rmax, rmax, rmax], period)

    num_threads = get_num_threads(num_threads)

    return sample1, rbins, sample2, period, num_threads, PBCs