Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in mean_delta_sigma function for non-periodic-box #1058

Open
aphearin opened this issue Feb 16, 2023 · 0 comments
Open

Bug in mean_delta_sigma function for non-periodic-box #1058

aphearin opened this issue Feb 16, 2023 · 0 comments

Comments

@aphearin
Copy link
Contributor

The mean_delta_sigma function should give identical results if the particles are divided in half and the results on the two halves are summed at the end. As pointed out by @johannesulf this test is successful for the case of a periodic box, but there is a minor discrepancy when the box is not periodic. Here is a minimal reproducer:

from halotools.mock_observables import return_xyz_formatted_array, mean_delta_sigma
import numpy as np
from halotools.sim_manager import CachedHaloCatalog

halocat = CachedHaloCatalog(simname='bolplanck')

halos = halocat.halo_table
ptcls = halocat.ptcl_table

pos_halos = return_xyz_formatted_array(halos['halo_x'], halos['halo_y'],
                                       halos['halo_z'])
pos_ptcls = return_xyz_formatted_array(ptcls['x'], ptcls['y'], ptcls['z'])

rp_bins = np.logspace(-1, +1, 11)

ds_tot = mean_delta_sigma(pos_halos[:10000], pos_ptcls, 1e9, rp_bins)
ds_1 = mean_delta_sigma(pos_halos[:10000], pos_ptcls[::2], 1e9, rp_bins)
ds_2 = mean_delta_sigma(pos_halos[:10000], pos_ptcls[1::2], 1e9, rp_bins)

print(ds_tot)
print(ds_1 + ds_2)
print(ds_tot / (ds_1 + ds_2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant