Skip to content

Deviations from Parseval's theorem #11

@egorssed

Description

@egorssed

Hey, thanks for the package.

Though there is a bug(feature) in your code.
If you consider Parseval's theorem you can theoretically compute the variance of the generated GRF from its power spectrum.
In your case, the variance of the generated field quite significantly deviates from the theoretical one (right plot). For big-scale perturbations (big power slope) deviation can even reach 300% ! Though, if you average generated variance over ~100 phases you will get the theoretical one.

I assume it is related to the way how you generate phases of the Fourier image. One can either sample phases using straightforward random.uniform or he can use more sophisticated, yet robust, Polar Box-Muller transform.

The figure represents how deviation between generated variance and one from Parseval's theorem depends on the Power Slope of the GRF. (figures were computed for 100x100 pixels GRF and 100 random seeds for every Power slope)

GRF_variance

If my guess is correct you might want to change these two functions

def gauss_hermitian(self):

def _adjust_phase(ft, left_edge, freq, axes, b):

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions