Skip to content

Generating GRF with Odd vs. Even Number of Pixels #10

@bmbuncher

Description

@bmbuncher

Hi! I tried to generate 2D GRFs (using powerbox.Powerbox as shown here), but have run into issues depending on whether I use an odd or even number of pixels when generating the field. When using an even number of pixels, delta_x comes out fine; however, when using an odd number of pixels, delta_x has large top-left to bottom-right stripes. I presume that it has to do with how pyfftw handles odd vs. even numbers of modes, but it's pretty odd.

I attached a MWE, along with images of delta_x and the sampeld particles. These used P(k) ~ k^-1.2, a side length of 1, 512 (or 513) pixels, and ~10,000 particles each. I used two separate amplitudes: a "reasonable" one (where there is little clipping of the field) and an exaggerated one (which requies ~30% of the pixels in the field to be clipped to -1.0); the exaggerated one was used to show that it affects the discrete sampling.

Any suggestions (other than just using an even number of pixels)?

I'm using powerbox version v0.6.1, numpy v1.15.4, and pyfftw v0.12.0 on an Ubuntu 20.04 OS.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions