Skip to content

tomo_builder population_stats mismatch with selected_pairs #41

Description

@c-d-leonard

Currently, if you call the following:

tomography = TomographyBuilder(
    lens_survey="desi",
    source_survey="lsst",
    lens_sample='lrg',
    source_sample=None,
    lens_year=None,
    source_year="1",
    lens_role="lens",
    source_role="source",
    overlap_threshold=0.1,
    source_behind_lens=True,
    shared_overrides={
        "bins": {
            "count": 5,
        },
    },
)

tomo_inputs = tomography.prepare_bins()

bin_pairs = tomo_inputs["bin_pairs"]

print('bin_pairs=', bin_pairs)

You get

bin_pairs= [(0, 4)]

i.e. you select only the lowest redshift desi LRG bin and the highest of 5 source LSST Year 1 bins.

However, tomo_builder._population_stats doesn't receive any information about this bin pair selection, so if you naively pass tomo_inputs above as follows:

    cosmo=cosmo,
    lens_result=tomo_inputs["lens_result"],
    source_result=tomo_inputs["source_result"],
    lens_population_stats=tomo_inputs["lens_population_stats"],
    source_population_stats=tomo_inputs["source_population_stats"],
    bin_pairs=bin_pairs,
    rp_bin_edges=rp_bin_edges,
    area_deg2=5000.0,
    sigma_e=0.26,
    galaxy_bias=params['b'],
    k=np.geomspace(10**(-4), 3.0, 5000),
    hankel_kwargs={
        "r_min": 0.6,
        "r_max": 110,
        "k_min": 10**(-4),
        "k_max": 30.0,
        "orders": (2,), 
        "n_zeros": 480000, 
        "n_zeros_step": 1000,
        "prune_r": 0,
        "verbose": True,
        "max_iterations": 1000, 
    },
    taper=False,
)


dsf_cov_dict = covariance_builder.covariance_for_pair(lens_bin_index=0, 
                                                      source_bin_index=0)

the shape noise you get out is using the n_eff_per_arcmin value for the original lowest-z of the five source bins, not the highest one as I would have expected.

If instead you replace the last line with
dsf_cov_dict = covariance_builder.covariance_for_pair(lens_bin_index=0, source_bin_index=4)

you get the shape noise as I expected.

I don't think this is necessarily a full blow bug but clearly there is potential for silent failure and lack of clarity on whether the bin indices required to be passed for covariance_for_pair are the original indices or the new ones after selection. There should potentially be a warning thrown to the user or something? I'm not sure the solution but I'm worried the current case will create silent analysis failures.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions