Patterns Module

Overview

Functions and classes to process string data.

As with any text file format, some string manipulation may be required to process CIF data. The classes and functions in this module provide simple tools for the manipulation of string data extracted from CIF files by methods in parsnip.parse.

Data:

ALLOWED_DELIMITERS

Delimiters allowed for nonsimple (multi-line) data entries.

Functions:

cast_array_to_float(arr[, dtype])

Cast a Numpy array to a dtype, pruning significant digits from numerical values.

ALLOWED_DELIMITERS = [';\n', "'''", '"""']

Delimiters allowed for nonsimple (multi-line) data entries.

cast_array_to_float(arr, dtype=<class 'numpy.float32'>)

Cast a Numpy array to a dtype, pruning significant digits from numerical values.

Parameters:
  • arr (np.array[str]) – Array of data to convert

  • dtype (type, optional) – dtype to cast array to. Default value = np.float32

Returns:

np.array[dtype]

Return type:

Array with new dtype and no significant digit information.