Fourier Transform

class nmrPype.fn.FT.FourierTransform(ft_inv: bool = False, ft_real: bool = False, ft_neg: bool = False, ft_alt: bool = False, mp_enable: bool = False, mp_proc: int = 0, mp_threads: int = 0)

Data Function object for performing a DFFT or IDFFT on the data.

Parameters:
  • ft_inv (bool) – Use inverse fourier transform instead of fourier transform

  • ft_real (bool) – Perform fourier transform on the real data only

  • ft_neg (bool) – Negate imaginary values when performing fourier transform

  • ft_alt (bool) – Alternate the signs of even and odd data points

  • mp_enable (bool) – Enable multiprocessing

  • mp_proc (int) – Number of processors to utilize for multiprocessing

  • mp_threads (int) – Number of threads to utilize per process

static alternate(array: ndarray, positiveStart: bool = True)

Return inputted array with alternating signs from postitive to negative

Parameters:
  • array (ndarray) – Target array to sign alternate, assumed to be non-complex

  • positiveStart (bool) – Set whether the values start as negative or positive

Returns:

Sign alternating array

Return type:

ndarray

static clArgs(subparser, parent_parser)

Fourier Transform command-line arguments

Adds Fourier Transform parser to the subparser, with its corresponding default args Called by nmrPype.parse.parser().

Parameters:

subparser (_SubParsersAction[ArgumentParser]) – Subparser object that will receive function and its arguments

initialize(data: DataFrame)
Initialization follows the following steps:
  • Handle function specific arguments

  • Update any header values before any calculations occur that are independent of the data, such as flags and parameter storage

Parameters:

data (DataFrame) – Target data to manipulate

static negate(array: ndarray) ndarray

Negate values of inputted array

parallelize(array: ndarray, ndQuad: int, verb: tuple[int, int, str] = (0, 16, 'H')) ndarray

Multiprocessing implementation for function to properly optimize for hardware

Parameters:
  • array (ndarray) – Target data array to process with function

  • ndQuad (int) – NDQUADFLAG header value

Returns:

new_array – Updated array after function operation

Return type:

ndarray

process(array: ndarray, ndQuad: int, verb: tuple[int, int, str] = (0, 16, 'H')) ndarray

See nmrPype.fn.function.DataFunction.process() for documentation

run(data: DataFrame) int

See nmrPype.fn.function.DataFunction.run() for documentation

updateHeader(data: DataFrame)

Update the header following the main function’s calculations. Typically this includes header fields that relate to data size.

Parameters:

data (DataFrame) – Target data frame containing header to update

vectorFFT(array: ndarray) ndarray

Perform fourier transform on 1D array, transform result to match nmrPipe

Parameters:

array (ndarray) – Target vector

Returns:

Processed vector

Return type:

ndarray

vectorIFFT(array: ndarray) ndarray

Perform inverse fourier transform on 1D array, transform result to match nmrPipe

Parameters:

array (ndarray) – Target vector

Returns:

Processed vector

Return type:

ndarray