spec_xy

kgpy.fft.power.spec_xy(image, nfreq=64, dx=1.0, radians=False, retain_dc=False)

Estimate horizontal and vertical power spectra of an image. The horizontal power spectrum, for example, is calculated as an average of the power spectra of the rows. Moreover, the power spectrum of each row is estimated by averaging over a sequence of short segments along the row. Columns are treated similarly. The normalization convention is the same as with periodogram_fft

Parameters:
  • image (numpy.ndarray) – the 2d image for which the power spectra are to be calculated :param nfreq: Number of elements in each segment, and also the number of elements in each of the output power spectra. The smaller the nfreq, the lower the spectral resolution but the better the noise supression.

  • dx (float) – sample interval. Defaults to 1. If included, then k will be converted to units of cycles (or radians, if that keyword is set) per unit distance (or time), corresponding to the units of dx

  • radians (bool) – if True, then let k be in radians, rather than cycles, per whatever.

  • retain_dc (bool) – if set, then retain the DC offset when calculating the power spectrum. Ordinarily, the DC offset is subtracted before calculating the spectrum, because the Hanning window tends to make the offset bleed into the nearest neighbors of the pixel [0,0] of the 2D power spectrum.

  • nfreq (int) –

Returns:

psx, psy: the power spectra averages of x and y, respectively