power_law_image

kgpy.fft.random.power_law_image(nx, ny, alpha, meanval, pad=1, keep_complex=False)

Port of CCK’s power_law_image.pro to Python. Ported by NCG 2020-07-30

Generate a random image with a specified power law spectrum. The result is a 2D array with all positive values. The result will be periodic unless padding is used.

Note: In CCK’s orginal IDL version of this function, a real-valued array was returned without needing to take an abs() of the final image. Here, I have added a keyword to let the user decide between returning a complex-valued array, or the abs() of that complex valued array, depending on the user’s desire for phase information. For most practical applications, I imagine that only the amplitude will be needed. -NCG

Parameters:
  • Nx – size of image in x direction

  • Ny – size of image in y direction

  • alpha (float) – power law index for the image power spectrum (goes as k^(-alpha))

  • meanval (float) – mean value of the image.

  • pad (int) – positive integer factor for padding arrays. pad=2 or higher prevents the output image from being periodic in structure.

  • nx (int) –

  • ny (int) –

  • keep_complex (bool) –

Returns: