Closed beckermr closed 1 year ago
@aphearin @manodeep I have been banging my head against this for a week. Here is my most minimal example of something I don't understand. Hopefully, it is my code!
Thanks for the bug report @beckermr - let me check whether I can reproduce it. I did have a couple of questions though - i) Does the bug still appear if you reduce zmax to a value smaller than Lbox/2, say 55 ? and ii) Can you reproduce the bug with Corrfunc installed from source/pip? (Related, I thought that the conda installed Corrfunc was called corrfunc
- is that not the case?)
Just confirming that I can run your script and get the same output; thanks for making the minimal reproducer! Haven't had a chance to track down the bug yet.
On Tue, Jan 28, 2020 at 3:04 PM Manodeep Sinha notifications@github.com wrote:
Thanks for the bug report @beckermr https://github.com/beckermr - let me check whether I can reproduce it. I did have a couple of questions though - i) Does the bug still appear if you reduce zmax to a value smaller than Lbox/2, say 55 ? and ii) Can you reproduce the bug with Corrfunc installed from source/pip? (Related, I thought that the conda installed Corrfunc was called corrfunc - is that not the case?)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/manodeep/Corrfunc/issues/210?email_source=notifications&email_token=ABLA7S6STYSQOINX2HARYGTRACFWLA5CNFSM4KMVBGQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKEWPHQ#issuecomment-579430302, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLA7S3JT5UZ7TAWWHTCM4TRACFWLANCNFSM4KMVBGQA .
-- Lehman Garrison lgarrison@flatironinstitute.org Flatiron Research Fellow, Cosmology X Data Science Group Center for Computational Astrophysics, Flatiron Institute lgarrison.github.io
@manodeep yes I can reproduce the bug in both of those cases.
I suspect this is connected to the relative size of rmax and zmax to Lbox. For instance, if I change (xbin, ybin, zbin) refine-factors to (1, 1, 1)
, then we have many mis-matches. And if I increase all the bin-refine-factors to >= 3, then the bug disappears. Since allowing such large relative separations is a new feature introduced with #189 (via commit https://github.com/manodeep/Corrfunc/commit/e53bce3050139337dae5723a3601e707f1f37920), may be a bug was introduced.
@lgarrison At minimum, we will need a separate test case (from a brute force output) to test these sorts of large separations.
If I disable the duplicate cell-checking in here, then the bug disappears. However, we need to work through the logic and make sure we are not double-counting under any circumstances...
@manodeep is it possible that we we are missing particles when we do duplicate cell elimination because we are only considering one "wrapping" direction? I think we need to consider both, the question is how to do so without double counting pairs. Probably the answer lies in some restriction llike Rmax < CellSize/2...
Once this is resolved, do y'all have a brute force pair-counter test in the unit-testing to protect against regression? I find it's really hard to fool those kind of tests. Let me know in case that would be useful for me to pass along your way.
@lgarrison That is definitely what is happening here. Consider zmax = Lbox/2, and we have 2 bins. In that case, the top half of iz=0
can be within zmax
of the bottom half of the iz=1
, and the bottom half of the iz=0
can be within the top half of iz=1
cell after periodic wrapping. However, we will only associate (iz=0, iz=1) once and without periodic wrapping. Essentially the duplicate check has to needs to make sure both directions of the cell-pairs are included. For this specific scenario, no double-counting should occur but I am not sure about all the possible combinations of bin-refs, min-sep-opt, and various zmax/Lbox ratios ranging between [0.3-0.5] (i.e, between 2 <= nzbins <= 3
. I am reasonably confident that once nzbins > 3
, Corrfunc works correctly. We would need to run the tests with the COMPREHENSIVE_INTEGRATION_TESTS` option enabled.
@aphearin Thanks for the offer - we will absolutely need to add tests for large Rmax/zmax for all the pair-counters.
@lgarrison In the meantime, should we revert the previous change (introduced in v2.3.2) for allowing large ratios of (Rmax, zmax)/Lboox?
@manodeep Yes, I think since we happen to be making a release right now anyways we should revert this change while we consider the best way to fix this. Let's double-check with @beckermr that it fixes his problem before releasing!
@lgarrison If we revert the change, then Corrfunc will report an error for (nx, ny, nzbins < 3)
and @beckermr will not be able to run this example
@beckermr This should be fixed now with #277. As long as Rmax < Lbox/2
, Corrfunc should correctly compute the pairs.
Closing the issue but please feel free to reopen if you are still facing any issues
Thank you!
General information
Issue description
I am computing the pairs by hand and not getting what corrfunc reports.
Expected behavior
It should match the brute force computation.
Actual behavior
It doesn't match it.
What have you tried so far?
A bunch of stuff to try and see if it will miss one particle. It does not, so the bug is more subtle. It does not appear to be a bin edge thing.
Minimal failing example
This script outputs