diff --git a/src/fourier/details/euclidian_spectrum_1d.hpp b/src/fourier/details/euclidian_spectrum_1d.hpp index 291470d..6e2c21e 100644 --- a/src/fourier/details/euclidian_spectrum_1d.hpp +++ b/src/fourier/details/euclidian_spectrum_1d.hpp @@ -69,17 +69,22 @@ namespace CosmoTool std::complex *d = rand_map.data(); long idx; const DimArray& dims = rand_map.getDims(); + const std::vector& delta_k = rand_map.get_delta_k(); long plane_size; bool alleven = rand_map.allDimensionsEven(); + double V = 1; + + for (int p = 0; p < delta_k.size(); p++) + V *= (2*M_PI/delta_k[p]); for (long p = 1; p < rand_map.size(); p++) { - double A_k = std::sqrt(0.5*f(rand_map.get_K(p))); + double A_k = std::sqrt(0.5*V*f(rand_map.get_K(p))); d[p] = std::complex(gsl_ran_gaussian(rng, A_k), gsl_ran_gaussian(rng, A_k)); } // Generate the mean value - d[0] = std::complex(gsl_ran_gaussian(rng, std::sqrt(f(0))), 0); + d[0] = std::complex(gsl_ran_gaussian(rng, std::sqrt(V*f(0))), 0); if (!rand_map.firstDimensionEven()) return;