Fixed K computation. Handle fully the Nyquist plane depending on the parity of dimensions.

This commit is contained in:
Guilhem Lavaux 2012-11-10 19:11:34 -05:00
parent cc7996175c
commit 3c0e7ae8f8
2 changed files with 70 additions and 21 deletions

View file

@ -9,14 +9,16 @@ using namespace std;
double spectrum_generator(double k)
{
return 1/(0.1+pow(k, 3.0));
if (k==0)
return 0;
return 1/(0.01+pow(k, 3.0));
}
int main()
{
EuclidianFourierTransform_2d<double> dft(128,128,1.0,1.0);
EuclidianFourierTransform_2d<double> dft(1024,1024,1.0,1.0);
EuclidianSpectrum_1D<double> spectrum(spectrum_generator);
double volume = 128*128;
double volume = 1024*1024;
gsl_rng *rng = gsl_rng_alloc(gsl_rng_default);
dft.realSpace().eigen().setRandom();
@ -33,7 +35,7 @@ int main()
dft.fourierSpace() = *m.get();
dft.synthesis();
uint32_t dims[2] = { 128, 128 };
uint32_t dims[2] = { 1024, 1024 };
CosmoTool::saveArray("generated_map.nc", dft.realSpace().data(), dims, 2);
return 0;