<commit_before>from halomod.cross_correlations import CrossCorrelations, ConstantCorr
import numpy as np


def test_cross_same():
    """Test if using two components that are the same gives the same as an auto corr."""

    cross = CrossCorrelations(
        cross_hod_model=ConstantCorr,
        halo_model_1_params={
            "exclusion_model": "NoExclusion",
            "sd_bias_model": None,
            "transfer_model": "EH",
        },
        halo_model_2_params={
            "exclusion_model": "NoExclusion",
            "sd_bias_model": None,
            "transfer_model": "EH",
        },
    )

    assert np.allclose(cross.corr_2h_cross, cross.halo_model_1.corr_2h_auto_tracer)
    assert np.allclose(
        cross.corr_1h_cross,
        cross.halo_model_1.corr_1h_auto_tracer,
        atol=1e-5,
        rtol=1e-2,
    )
    assert np.allclose(cross.power_2h_cross, cross.halo_model_1.power_2h_auto_tracer)
    # assert np.allclose(cross.power_1h_cross, cross.halo_model_1.power_1h_auto_tracer)<commit_msg>test: add 1halo power test for cross_corr<commit_after>from halomod.cross_correlations import CrossCorrelations, ConstantCorr
import numpy as np


def test_cross_same():
    """Test if using two components that are the same gives the same as an auto corr."""

    cross = CrossCorrelations(
        cross_hod_model=ConstantCorr,
        halo_model_1_params={
            "exclusion_model": "NoExclusion",
            "sd_bias_model": None,
            "transfer_model": "EH",
            "force_1halo_turnover": False,
        },
        halo_model_2_params={
            "exclusion_model": "NoExclusion",
            "sd_bias_model": None,
            "transfer_model": "EH",
            "force_1halo_turnover": False,
        },
    )

    assert np.allclose(cross.corr_2h_cross, cross.halo_model_1.corr_2h_auto_tracer)
    assert np.allclose(
        cross.corr_1h_cross,
        cross.halo_model_1.corr_1h_auto_tracer,
        atol=1e-5,
        rtol=1e-2,
    )
    assert np.allclose(cross.power_2h_cross, cross.halo_model_1.power_2h_auto_tracer)

    # This doesn't work because autos have a low-k cutoff applied
    assert np.allclose(
        cross.power_1h_cross,
        cross.halo_model_1.power_1h_auto_tracer,
        atol=1e-6,
        rtol=1e-2,
    )
{'fraction_non_alphanumeric': 0.09162303664921466, 'fraction_numerical': 0.018760907504363003, 'mean_word_length': 2.6924315619967794, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3067839', 'n_tokens_mistral': 816, 'n_tokens_neox': 783, 'n_words': 140}