I/O Operations

nmrPype.nmrio.readFromBuffer(buffer: TextIOWrapper | BufferedReader) tuple[dict, ndarray]

Set the header object and data array based on the input file

Parameters:

buffer (BufferStream [io.TextIOWrapper or io.BufferedReader]) – input buffer to read from, read from standard input if the designated standard input does not have a buffer

Returns:

  • dic (dict) – Header Dictionary

  • data (np.ndarray) – NMR data represented by an ndarray

nmrPype.nmrio.readFromFile(file: str) tuple[dict, ndarray]

Set the header object and data array based on the input file

Parameters:

file (str) – NMR data format file to read from

Returns:

  • dic (dict) – Header Dictionary

  • data (np.ndarray) – NMR data represented by an ndarray

nmrPype.nmrio.writeToBuffer(data: DataFrame, output: TextIOWrapper | BufferedWriter, overwrite: bool) int

Utilizes modified nmrglue code to output the Dataframe to standard output or standard output buffer in a NMR data format.

Parameters:
  • data (DataFrame) – DataFrame object to write out

  • output (WriteStream [io.TextIOWrapper | .BufferedWriter]) – Output stream

  • overwrite (bool) – Choose whether or not to overwrite existing files for file output

Returns:

Integer exit code (e.g. 0 success 1 fail)

Return type:

int

nmrPype.nmrio.writeToFile(data: DataFrame, output: str, overwrite: bool) int

Utilizes modified nmrglue code to output the Dataframe to a file in a NMR data format.

Parameters:
  • data (DataFrame) – DataFrame object to write out

  • output (str) – Output file path represented as string

  • overwrite (bool) – Choose whether or not to overwrite existing files for file output

Returns:

Integer exit code (e.g. 0 success 1 fail)

Return type:

int