seshnadathur / Revolver

Real-space void locations from survey reconstruction
GNU General Public License v3.0
7 stars 12 forks source link

AbacusSummit Cubic box catalogue out of bounds error right on boundary #18

Open tsfraser opened 1 year ago

tsfraser commented 1 year ago
```Traceback (most recent call last):
  File "/project/rrg-wperciva/tsfraser/Revolver/Revolver/revolver_modified.py", line 191, in <module>
    voidcat.run_voidfinder()
  File "/lustre06/project/6033532/tsfraser/Revolver/Revolver/python_tools/voxelvoids.py", line 164, in run_voidfinder
    fastmodules.allocate_gal_cic(rhog, self.cat.x, self.cat.y, self.cat.z, self.cat.weight, self.cat.size,
  File "python_tools/fastmodules.pyx", line 143, in fastmodules.allocate_gal_cic
IndexError: Out of bounds on buffer access (axis 2)```

Triggers when running AbacusSummit mocks, especially for the 1000 HOD mocks per cosmology. Axis in the error refers to the specific column in the coordinate array that's passed to allocate_gal_cic (i.e. in this case z has a single value at 2000.0 instead of 1999.9, which for a boxsize of 2000 is enough to trigger this). Will also flag this with Abacus, since their parameter space is 0<xyz<=2000 instead of 0<xyz<2000 since I'm assuming several codes are built around the latter assumption?

HAWinther commented 1 year ago

Yeah some snapshots from sims use [0,Boxsize) - the convention the code expects - and some (0,Boxsize] (and some have forgotten to do a final wrapping) for the coordinates. A hack for this is to put 2000.01 as the boxsize, but some snapshots might have negative positions if they forgot to wrap so its a good idea is to not assume input is perfect and always wrap the coordinates in the code (this does not take any time) i.e. x = (x + Boxsize) % Boxsize etc. Then we ensure everything is in [0,Boxsize) and avoids this issue alltogether.