k_arr

kgpy.fft.freq.k_arr(n, dx=1.0, radians=False)

This is a port of CCK’s k_arr.pro to Python 3. Ported by NCG, 2020-07-31

Generate an array of wave-number values (by default in units of cycles per sample interval), arranged corresponding to the FFT of an N-element array. This is similar, but not identical, to using the helper function scipy.fft.fftfreq to generate arrays of frequencies. The main difference is that scipy.fft.fftfreq is limited to one dimension, and does not have the keyword argument to convert between radians snd cycles. -NCG

Parameters:
  • n (int) – number of elements

  • dx (float) – sample interval. If included, then k will be converted into 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, instead of the default cycles

Returns:

array k, n element array of positive and negative wave-numbers, where the maximum (Nyquist) frequency has a value of pi radians per sample interval. The dx and radians keywords can be used to modidy the units of k.