Open gouyoub opened 5 years ago
I believe k reported by nbodykit is an average of k in the grid points that fall into the shell, not the middle points or either edges of the shells:
https://github.com/bccp/nbodykit/blob/master/nbodykit/algorithms/fftpower.py
I suppose if you look at power.centers['k'] or power.edges['k'] it should be similar to what you expected. The power value is still the mean of the power in the shell, so I think it shouldn't be very much off from yours, except in cases where round-off error can put a mode in either of two neighbouring shells.
The |k| binning is set by the dk and kmin parameter. I think you can tweak it to agree with yours. Also, if you pass dk=0, the power spectrum will be measured on individual |k| modes, and there is no such confusions any more.
Hi,
I am new to nbodykit and I find it very useful and easy to use. But I'm facing a problem : I wanted to compare the result of estimating the power spectrum from a simulation box using the Direct Summation method (that I coded myself) with the result from nbodykit. The problem I have is that it seems that nbodykit is not computing the power spectrum on the same 3D k grid than I do. I am just constructing a 3D grid regularly spaced in k_F = 2*pi/L, and then making a shell average where a shell going from k-k_F/2 to k+k_F/2. I thought nbodykit would compute the power spectrum on the same grid because it is on those modes (the multiples of the fundamental mode k_F) that the power is, as it is a periodic box with period L.
But the k I'm obtaining are : [ 0.00400912, 0.00700829, 0.00984624, 0.0127567, 0.0160145, ... ]
And the k nbodykit obtains are : [0., 0.00444982, 0.00753956, 0.01072395, 0.0139183, 0.0171755, ... ]
It seems that the grids are a bit displaced with respect to each other.
So my question is twofold :
Here the BoxSize is L=2000 Mpc/h.
Cheers, Sylvain Gouyou Beauchamps.