Open alanxuhaojie opened 5 years ago
Thanks for the report! I can reproduce this bug.
It looks like an error in how we populate the interpolation arrays in set_cosmo_dist()
. Specifically, I think this line:
https://github.com/manodeep/Corrfunc/blob/master/utils/set_cosmo_dist.c#L44
should be zmax/max_size
instead of 1/max_size
. Right now, the interpolation array is effectively capped at 1; we trigger the line 60 break before actually reaching zmax
.
Additionally, the interpolation redshifts start at 1/max_size
~1e-4, so we will fail the same way if we get a redshift smaller than that. That's causing the error in the zmax=0.2
case.
@manodeep: I think the most robust way to fix this would be to force the last element in the array to be equal to zmax
. Probably we should force the first element to be equal to zmin
or 0, too
@alanxuhaojie, if you need a quick fix, you can pass comoving distances instead of cz
. That will avoid this part of the code entirely.
@lgarrison Yup - that entire function needs to be updated to use GSL integration. If I remember correctly updating to gsl integration was breaking the tests. That's probably why the gsl integration headers are included in that file
@alanxuhaojie I will second @lgarrison's suggestion. You might be better off simply calculating the co-moving distances with something like astropy coordinates and then set the flag is_comoving_dist=True
. Here is the see note in the python wrapper explaining the is_comoving_dist
semantics
@lgarrison @manodeep I'll go with passing comoving distances instead of cz for now. Thanks for quick responding. Let me know if the bug is fixed.
General information
Issue description
gsl: interp.c:150: ERROR: interpolation error Default GSL error handler invoked. Abort trap: 6 See the following two examples...
Initially, I thought it may be due to my large input redshift (up to ~1). Then I select out the those galaxies with lower z (say, z<0.2) in my samples, it works.
When I am trying to show some examples, it even fails with z<0.2 with random ra, dec. Any idea?
My gsl version is 2.5
Expected behavior
Actual behavior
What have you tried so far?
Minimal failing example