java.lang.Object
org.eclipse.dawnsci.analysis.dataset.impl.FFT

public class FFT extends Object
Class to hold methods to compute discrete Fourier transforms Emulates numpy.fft
  • Constructor Summary

    Constructors
    Constructor
    Description
    FFT()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.eclipse.january.dataset.Dataset
    extendWithPad(org.eclipse.january.dataset.Dataset input, int[] newShape, Object padValue)
    Pad out dataset to new shape with the provided padValue.
    static org.eclipse.january.dataset.Dataset
    fft(org.eclipse.january.dataset.Dataset a)
    forward 1D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    fft(org.eclipse.january.dataset.Dataset a, int n, int axis)
    forward 1D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    fft2(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
    forward 2D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    fftn(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
    forward nD fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    fftshift(org.eclipse.january.dataset.Dataset a, int[] axes)
    Shift zero-frequency component to centre of dataset
    static org.eclipse.january.dataset.Dataset
    ifft(org.eclipse.january.dataset.Dataset a)
    inverse 1D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    ifft(org.eclipse.january.dataset.Dataset a, int n, int axis)
    inverse 1D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    ifft2(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
    inverse 2D fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    ifftn(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
    inverse nD fast Fourier transform
    static org.eclipse.january.dataset.Dataset
    ifftshift(org.eclipse.january.dataset.Dataset a, int[] axes)
    Reverse shift of zero-frequency component to centre of dataset
    static org.eclipse.january.dataset.Dataset
    sampleFrequencies(int n, double d)
    Discrete FFT sample frequencies
    static org.eclipse.january.dataset.Dataset
    shift(org.eclipse.january.dataset.Dataset input, boolean forward)
    Shift frequency components
    static org.eclipse.january.dataset.Dataset
    zeroPad(org.eclipse.january.dataset.Dataset input, int[] newShape, boolean inFreqSpace)
    Pad out dataset to new shape with zeros.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FFT

      public FFT()
  • Method Details

    • fft

      public static org.eclipse.january.dataset.Dataset fft(org.eclipse.january.dataset.Dataset a)
      forward 1D fast Fourier transform
      Parameters:
      a - dataset
      Returns:
      new dataset holding transform
    • fft

      public static org.eclipse.january.dataset.Dataset fft(org.eclipse.january.dataset.Dataset a, int n, int axis)
      forward 1D fast Fourier transform
      Parameters:
      a - dataset
      n - number of points
      axis - (negative numbers refer to axes from end, eg. -1 is last axis)
      Returns:
      new dataset holding transform
    • fft2

      public static org.eclipse.january.dataset.Dataset fft2(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
      forward 2D fast Fourier transform
      Parameters:
      a - dataset
      s - shape of FFT dataset (if null, use whole dataset)
      axes - for FFT (if null, default as [-2,-1])
      Returns:
      new dataset holding transform
    • fftn

      public static org.eclipse.january.dataset.Dataset fftn(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
      forward nD fast Fourier transform
      Parameters:
      a - dataset
      s - shape of FFT dataset (if null, use whole dataset)
      axes - for FFT (if null, default as [..., -1])
      Returns:
      new dataset holding transform
    • ifft

      public static org.eclipse.january.dataset.Dataset ifft(org.eclipse.january.dataset.Dataset a)
      inverse 1D fast Fourier transform
      Parameters:
      a - dataset
      Returns:
      new dataset holding transform
    • ifft

      public static org.eclipse.january.dataset.Dataset ifft(org.eclipse.january.dataset.Dataset a, int n, int axis)
      inverse 1D fast Fourier transform
      Parameters:
      a - dataset
      n - number of points
      axis - (negative numbers refer to axes from end, eg. -1 is last axis)
      Returns:
      new dataset holding transform
    • ifft2

      public static org.eclipse.january.dataset.Dataset ifft2(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
      inverse 2D fast Fourier transform
      Parameters:
      a - dataset
      s - shape of FFT dataset (if null, use whole dataset)
      axes - for FFT (default as [-2,-1])
      Returns:
      new dataset holding transform
    • ifftn

      public static org.eclipse.january.dataset.Dataset ifftn(org.eclipse.january.dataset.Dataset a, int[] s, int[] axes)
      inverse nD fast Fourier transform
      Parameters:
      a - dataset
      s - shape of FFT dataset (if null, use whole dataset)
      axes - for FFT (if null, default as [..., -1])
      Returns:
      new dataset holding transform
    • fftshift

      public static org.eclipse.january.dataset.Dataset fftshift(org.eclipse.january.dataset.Dataset a, int[] axes)
      Shift zero-frequency component to centre of dataset
      Parameters:
      a -
      axes - (if null, then shift all axes)
      Returns:
      shifted dataset
    • ifftshift

      public static org.eclipse.january.dataset.Dataset ifftshift(org.eclipse.january.dataset.Dataset a, int[] axes)
      Reverse shift of zero-frequency component to centre of dataset
      Parameters:
      a -
      axes - (if null, then shift all axes)
      Returns:
      shifted dataset
    • sampleFrequencies

      public static org.eclipse.january.dataset.Dataset sampleFrequencies(int n, double d)
      Discrete FFT sample frequencies
      Parameters:
      n - number of samples
      d - sample spacing
      Returns:
      frequencies
    • zeroPad

      public static org.eclipse.january.dataset.Dataset zeroPad(org.eclipse.january.dataset.Dataset input, int[] newShape, boolean inFreqSpace)
      Pad out dataset to new shape with zeros. There are two ways to zero-pad:
      1. set data in volume starting at origin
      2. split data in 2^N volumes and scatter to corners of larger volume
      Parameters:
      input -
      newShape -
      inFreqSpace - if true, then pad higher frequencies as zero
      Returns:
      zero-padded dataset
    • extendWithPad

      public static org.eclipse.january.dataset.Dataset extendWithPad(org.eclipse.january.dataset.Dataset input, int[] newShape, Object padValue)
      Pad out dataset to new shape with the provided padValue.
      Parameters:
      input -
      newShape -
      padValue -
      Returns:
      padded dataset
    • shift

      public static org.eclipse.january.dataset.Dataset shift(org.eclipse.january.dataset.Dataset input, boolean forward)
      Shift frequency components

      A forward shift moves the zero-frequency from the origin position to the centre of the dataset. A backward shift reverts a forward shift

      Parameters:
      input -
      forward - if true, shift forward, else shift back
      Returns:
      shifted dataset