manodeep / Corrfunc

⚡️⚡️⚡️Blazing fast correlation functions on the CPU.
https://corrfunc.readthedocs.io
MIT License
166 stars 51 forks source link

Misleading documentation and potential for serious error with DDrppi(_mocks) codes #96

Closed manodeep closed 8 years ago

manodeep commented 8 years ago

Documentation implies that the following section of code will generate nbins=20. That is NOT true -- the following lines of code only generates nbins = 19. To truly generate nbins, nbins+1 has to be passed into np.(log/lin)space.

import numpy as np
rmin = 0.1
rmax = 10.0
nbins = 20
rbins = np.linspace(rmin, rmax, nbins)
log_rbins = np.logspace(np.log10(rmin), np.log10(rmax), nbins)

Replace the last two lines with :

rbins = np.linspace(rmin, rmax, nbins + 1)
log_rbins = np.logspace(np.log10(rmin), np.log10(rmax), nbins + 1)

H/T to @aphearin for catching this. Fix needs to be in documentation and some change in the interface (say, embedding nrpbins and npibins into the numpy array, and/or requiring both npibins and pimax in convert_rp_pi_counts_to_wp).

manodeep commented 8 years ago

Bug checking code in this gist