Zero Fill

class nmrPype.fn.ZF.ZeroFill(zf_count: int = -1, zf_pad: int = 0, zf_size: int = 0, zf_auto: bool = False, zf_inv: bool = False, mp_enable: bool = False, mp_proc: int = 0, mp_threads: int = 0)

Data Function object for performing a zero-fill on the data

Parameters:
  • zf_count (int) – Number of times to double the data

  • zf_pad (int) – Number of zeros to pad the data by

  • zf_size (int) – Set data to new size while filling empty data with zeros

  • zf_auto (bool) – Automatically add zeros to pad data to the next power of two

  • zf_inv (bool) – Reverse a zero-fill operation based on header params

  • 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 clArgs(subparser, parent_parser)

Zero Fill command-line arguments

Adds Zero Fill 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 nextPowerOf2(x: int)

Helper function to set input integer to the nearest power of two greater than input integer.

parallelize(array: ndarray, 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

  • verb (tuple[int,int,str], optional)

  • print (Tuple containing elements for verbose) –

    • Verbosity level

    • Verbosity Increment

    • Direct Dimension Label

  • (0 (by default) –

    • Verbosity level

    • Verbosity Increment

    • Direct Dimension Label

  • 16

    • Verbosity level

    • Verbosity Increment

    • Direct Dimension Label

  • 'H')

    • Verbosity level

    • Verbosity Increment

    • Direct Dimension Label

Returns:

new_array – Updated array after function operation

Return type:

ndarray

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

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

processMP(array: ndarray, arg: tuple, operation, verb: tuple[int, int, str] = (0, 16, 'H')) ndarray

Process specifically for MP, changes how it performs operation

Parameters:
  • array (ndarray) – array to process

  • args (tuple) – Arguments to implement for target operation

  • operation (function) – function to call in each thread

Returns:

modified array post-process

Return type:

ndarray

run(data: DataFrame) int

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

static truncate(array: array, size: int)
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