../_images/smdrqa_logo1.svg

Utility Functions#

Features#

assert_matrix()#

assert_matrix(input_array)[source]#

Function to assert that an input is a matrix

Parameters:

input_array (ndarray) – double array

Returns:

matrix (ndarray) – 2D matrix

compute_3D_matrix_size()#

compute_3D_matrix_size(dim1, dim2, dim3, dtype=<class 'numpy.float64'>)[source]#

Function to calculate memory required(GiB) for storing a 3D matrix of given size and data type

Parameters:
  • dim1 (int) – dimension

  • dim2 (int) – dimension

  • dim3 (int) – dimension

  • dtype (dtype) – data type, default = np.float64

Returns:

size (double) – size of the 3D matrix in GiB

assert_3D_matrix_size()#

assert_3D_matrix_size(dim1, dim2, dim3, dtype=<class 'numpy.float64'>, memory_limit=4)[source]#

Function to assert that a 3D matrix of given dimensions and data type is below a specified size

Parameters:
  • dim1 (int) – dimension

  • dim2 (int) – dimension

  • dim3 (int) – dimension

  • dtype (dtype) – data type, default = np.float64

  • memory_limit (double) – memory limit in GiB, default = 4

Returns:

output (bool) – True if the memory requirement is less than the specified limit